I have a model & a table which I no longer need in my App, I could leave them there but I would like to remove them to keep things tidy.
I\'m trying to figure out
The second method is the ideal way to handle this: your migration files are meant to represent how your database has changed over time. The older migration files will remain in your project (in case, hypothetically, you wanted to roll back to an older version), but Rails will not run them when you rake db:migrate
because it knows they've already been run (based on data in the database's schema_migrations table).
Your schema.rb will just be updated once to reflect that your database no longer contains that table.
One minor tweak to your code: your migration file should drop the table in the up
method, and ideally recreate it in the down
method. The "up" signifies that your migration drops the table to move forward in time, and if the migration is rolled back, the down
method will be run.