There is another way to avoid deleting a table with data in it.
What I do in these cases is to check which migration fails.
Suppose you have a db/migrate/20130908214222_create_requests.rb , and for some reason ActiveRecord failed in the past when it saved this migration in its tracking system.
To verify that this is the case, simply look in the schema_migrations table schema_migrations row containing a number similar to this example: 20130908214222
If this line does not exist, you just need to insert a new one:
INSERT INTO schema_migrations( version ) VALUES ( 20130908214222 );
The next time you run rake db:migrate , ActiveRecord will skip this step and continue the migration to the end without complications.
source share