In Rails we can create database migrations to modify the database columns, like add_column. But we can also directly edit the database file in db/migrate. So do we bother writing the migrations each time instead of changing the database file?
Thanks in advance.
In theory look at it like you have a production database with millions of rows. Each time you want to change or add in a database, you want to amend another file and apply those changes as to not lose that data.
If you just edit a db/migrate file, say from last week , first it wouldn’t be picked up with
bundle exec rake db:migratebut you’d have to rollback those changes, which destroys the data.So, to answer the question in one line, keep adding migrations, even for simple changes.