开发者

Compact all migrations

I have multiple migrations:

  1. .....
  2. create table
  3. add column
  4. add another co开发者_Python百科lumn
  5. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜