Proposal for contributing WatermelonDB Migration Generator
See original GitHub issueHey, @radex !
I previously made a migration yeoman generator for realm-js to help with managing linear migrations: https://www.npmjs.com/package/generator-realm-migration
WatermelonDB’s migrations are understandably different from realm-js. But the same core scenario occurs where some table’s schema gets changed and you need a migration created for it. This migration wouldn’t cover performing CRUD operations to to migrate existing data to the next schema version. But it would at least cover the creation of the migration steps that would mirror the changes you made to the database schema.
What would be all of the schema alterations we would need to cover?
- Create Table
- Drop Table
- Alter Table
- Add Column
- ???
I’m wondering if you would first like help to complete the supported schema operation steps, before even proceeding forward with a migration generator based on your comment here: https://nozbe.github.io/WatermelonDB/Advanced/Migrations.html#migration-steps
In any case, let me know what you think!
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:11 (6 by maintainers)

Top Related StackOverflow Question
Fwiw, Alembic has support for dropping / altering columns in SQLite tables by bulk recreating the table, and will even automatically generate a migration to do so. Might be worth having a peek at their impl if Watermelondb decides to support such a thing down the road
I would like to see a migration for sequelize and mysql.