Repository navigation
fix: Vector dimension changes now trigger column recreation in migrations - #4276
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. Comment |
- Fix canMigrateTo to detect vector dimension changes - Add comprehensive tests for vector dimension migrations - Vector dimension changes now properly trigger column drop/recreate Co-authored-by: marcelomendoncasoares <[email protected]>
- Verify DROP COLUMN SQL is generated - Verify ADD COLUMN with new dimension SQL is generated Co-authored-by: marcelomendoncasoares <[email protected]>
Co-authored-by: marcelomendoncasoares <[email protected]>
SandPod
left a comment
There was a problem hiding this comment.
LGTM!
One suggestion for improvements.
… setup duplication Co-authored-by: marcelomendoncasoares <[email protected]>
Changing a vector column's dimension (e.g.,
vector(1536)→vector(768)) generated migrations that did not update the database, causing schema mismatch warnings on server startup.Root cause: The
canMigrateTomethod only checked column type and name, ignoring dimension changes. This caused the migration generator to skip dimension changes entirely.Changes:
ColumnComparisons.canMigrateToto return false whenvectorDimensiondiffers, triggering drop/recreate logicMigration behavior:
This is necessary because PostgreSQL's pgvector does not support
ALTER TYPEfor dimension changes. Migration warnings correctly flag this as a destructive operation.Fixes #2495
Pre-launch Checklist
///), and made sure that the documentation follows the same style as other Serverpod documentation. I checked spelling and grammar.If you need help, consider asking for advice on the discussion board.
Breaking changes
Vector dimension changes will now be treated as destructive changes requiring column drop/recreate, which will result in data loss for the affected column. Users should backup their data before applying migrations that change vector dimensions.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.