ISSUE DESCRIPTION orm.migrator.up() rewrites snapshot incorrectly Describe the bug When…
- User
ISSUE DESCRIPTION
orm.migrator.up()rewrites snapshot incorrectlyDescribe the bug
When we run
orm.migrator.up(), the snapshot changes and a bunch of stuff in the snapshot is wrong and we have to revert the changes.Reproduction
https://github.com/zachkirsch/mikro-orm-migrate-snapshot-repro
What driver are you using?
@mikro-orm/sqlite
MikroORM version
7.1.2-dev.10
Node.js version
v24.0.1
Operating system
macOS
Validations
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord.
- The provided reproduction is a minimal reproducible example of the bug.
Interface
No new interfaces are introduced.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call ) using or commands. However you don't need to use or before submitting your changes. In fact, only submits currently unstaged changes because it uses to get the changes that need to be submitted. Assistant
Now let's implement the fixes. First, decimal precision/scale recovery in
DatabaseTable.init:Assistant
Now the
toJSONlength/comment handling:Assistant
Now update the
commentfields and add the#usesLengthInDDLhelper:Assistant
Now add
supportsComments()to the corePlatformand override inSqlitePlatform:Assistant
Now override in
SqlitePlatform:Assistant
Now update
SchemaComparatorto ignore comment diffs when unsupported:Assistant
Now the sqlite generated-column DDL and introspection fixes:
Assistant
Now let's typecheck and run the sqlite-related test suites:
Assistant
Now update
runMigrationsto prefer the canonical metadata snapshot when the DB already matches it:Assistant
All changes are complete. Let me do a final review of the complete diff:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.