Compact all migrations
I have multiple migrations:
- .....
- create table
- add column
- add another co开发者_Python百科lumn
- remove other column 6 .....
Is there any ablity to change all these migrations to one new migration which will create the same database schema?
I think that you can change remove those migrations and create a new one, called for example "initial_schema", where you should put the content of the schema.rb composed by all your previous migrations.
Consider that rails generate a schema.rb for you when you run those migrations.
Then you need to drop all tables in your database and run again rake db:migrate.
精彩评论