I have a Rails-API app that I\'m going to re-deploy after a long time. The app is non-production, but I am ready to deploy the production version. I want to basically delete all
Migrations are used to update your database or to rollback to previous versions. Once migrations have been run in all environments, they're never looked at again (unless you're manually messing around with the schema_migrations
table of course). Once all your migrations have been run, the current state of the database is in db/schema.rb
(or db/structure.sql
) so schema.rb
is all you need to start with a fresh database.
I tend to clear out old migrations every couple months just to cut down on clutter.
As far as the version goes, you can leave it alone. As long as it represent a time in the past (such as 2017-11-29 02:35:38) and it is lower than any migrations that need to be run (which doesn't apply as you're deleting them all) then it doesn't matter what it is.
Go ahead and clear out all the migrations, they're already reflected in schema.rb
and you can always dig them out of revision control if you really need them.