开发者

Compact all migrations

开发者 https://www.devze.com 2023-02-24 09:38 出处:网络
I have multiple migrations: ..... create table add column add another co开发者_Python百科lumn remove other column

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

精彩评论

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

关注公众号