Open shterrett opened 6 years ago
Same here, I'm having to run the migrations a second time so that the db schemas reflect the changes to the database.
Just applying a bump to this – could use this fix in master so I don't have to reference this branch from my project.
@mikecmpbll @meganemura Hi guys, sorry to bother, but could someone review this changes please? thanks!
With an existing tenant in our database, the
db/structure.sql
file is not updated with migrations for the tenant(s) the first time they're run. We're having to run the migrations a second time so that thedb/structure.sql
accurately reflects the changes to the database.This change dumps the schema after every tenant, overwriting the existing file as usual, so that when all the migrations are complete, the schema will be completely up-to-date. The schema is dumped after each tenant rather than after all the migrations in case one of the tenants fails to migrate - the schema will at least continue to represent the current state of the database.