Remove migration after rollback

I am new to rubies and rails, and just enjoy the migration.

My question is what is the best fit or time to remove migration after rollback. So far I have read the question of whether you delete the migration after the rollback, but are there any serious consequences for deleting the migration when working in a team and are there any advantages for exiting the migration file rather than deleting it?

In my case, what would make the most sense?

I had the source migration file 20140731141350_create_users.rb

class CreateUsers < ActiveRecord::Migration
  def change
    create_table :users do |t|
      t.string :email
      t.string :password

      t.timestamps
    end
  end
end

Why did I need to add a salt column, so I created a migration 20140804125449_add_salt_colum_to_users.rb

class AddSaltColumToUsers < ActiveRecord::Migration
  def change
    add_column :users, :salt, :string
  end
end

But during development, I realized that the salt column was not needed and was running

rake db:migrate:down VERSION=20140731141350

20140804125449_add_salt_colum_to_users.rb.

?

+4
3

. , , , .

, . , , , . , , !

+7

. :

, : : . . .

, , .

0

Never delete or edit old migrations! You can do a lot of harm to your application by working with a team or even alone.

0
source

All Articles