When starting out a new project, there are lot of changes in models that I find it easy to edit an existing migration & run db:clean
or db:reset
than create a new migration. I do this when app has not hit production which means I can reset/clean database without worries & I am working solo or part of a small team.
But Today, I came across the following advice in Rails Guide saying its not a good idea & discourages editing existing migrations:
Editing existing migrations is not a good idea: you will be creating
extra work for yourself and your co-workers and cause major headaches
if the existing version of the migration has already been run on
production machines. Instead, you should write a new migration that
performs the changes you require. Editing a freshly generated
migration that has not yet been committed to source control (or, more
generally, which has not been propagated beyond your development
machine) is relatively harmless.
I want to know:
- what potential pitfalls I can run into ?
- Does those pitfalls apply in my case(development stage,working solo)?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…