Any pending migrations are done automatically during deployment as part of
npm run build
, more precisely they are run from web/bin/sync-db.js.We also have a custom setup where, if the database is not initialized, we first:This is something that should be merged into Sequelize itself, or at least asked on Stack Overflow, but lazy now.
- just creates the database from the latest model descriptions
- manually fill in the
SequelizeMeta
migration tracking table with all available migrations to tell Sequelize that all migrations have been done up to this point
In order to test migrations locally interactively, you can:
- commit them on Git
git checkout HEAD~
- reset the database with demo data:
cd web ./bin/generate-demo-data.js --clear
- Move back to master:
git checkout -
- Run the migration:
./bin/sync-db.js