Never ever manage data by using active record migrations
So you happily using migrations to handle your database and everything goes pretty well. I love them.
New requirement comes to you and you need to add new data set into a new table and you create a new migration to handle it. Flawless.
Later on, this column does not make sense anymore and you, good developer, decide to remove it. Perfect.
However, you managed data using migrations and don’t actually remember. You screwed all your migrations. They don’t run anymore and you didn’t realise because your database was in a further version of this failure point and you haven’t found yourself in need to drop and recreate your development db.
New developer arrives and try rake db:create db:migrate. Fail. More time to spent why migrations is failing.
This was just one case. Many others can happen. Fields changed in your model. New validations were added. You’ve added new field to not have mass assignment. And so many others.
Lessons learned and gold tip: Never ever ever manage data using migrations. Create a script which can do it for you and throw it away after you’ve done the dirty service. You make your life and whoever is coming next easier.



