Is it possible to create a single migration from all the previous ones, so that it would have the effect of rake db:schema:load? I have many migrations that are useless (going back and forth between models).
Is it possible to create a single migration from all the previous ones, so
Share
You could take the code from
db/schema.rbthat gets generated, and make a migration out of it – deleting the old migrations.However I reccomend you not to do that.
You should keep your original “messy” migrations, they represent versions of your db schema in sync with your source code versioning. There is no value in doing that other the perceived cleanliness of the code. More than than, it’s actually a loss of value since you loose some of your code history, and history is meaningful when one analyses the code – maybe someone debugs something etc.