DB Rollup Migration? #1476
-
The way we run unit tests against our code is to create a new DB against an in-memory/temporary file system and then apply the migrations. As we have added more migrations our test time has increased. I was wondering if there was a way to produce a rollup migration that would create the schema for the current models if it doesn't exist? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
if you are testing the migrations, then I assume you want to run them all for your test suite. if you are not testing the migrations, then I'd just use create_all() for your test suite's purposes. As far a "rollup migration" you can do this also but you'd need to construct the migration code by hand, or otherwise run an autogenerate against a database which is updated to the target version for the rollup, removing all migration files above that version so that autogenerate thinks it's at the head (you can make a new migration directory for this kind of thing). |
Beta Was this translation helpful? Give feedback.
if you are testing the migrations, then I assume you want to run them all for your test suite. if you are not testing the migrations, then I'd just use create_all() for your test suite's purposes.
As far a "rollup migration" you can do this also but you'd need to construct the migration code by hand, or otherwise run an autogenerate against a database which is updated to the target version for the rollup, removing all migration files above that version so that autogenerate thinks it's at the head (you can make a new migration directory for this kind of thing).