ceth
ceth

Reputation: 45285

Compact all migrations

I have multiple migrations:

  1. .....
  2. create table
  3. add column
  4. add another column
  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?

Upvotes: 2

Views: 949

Answers (1)

Matteo Alessani
Matteo Alessani

Reputation: 10412

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.

Upvotes: 1

Related Questions