Best way to modify DB schema in development
Currently i'm using this:
edit creation migrate
rake db:drop
rake db:migrate
rake db:seed
but I often can see making migrations for every added or edited column and so on.
I think my way is better because its much cleaner and faster to migrate to开发者_如何转开发 production environment (one sql for one table). Are there any disadvantages of using my method? What do you think? EDIT: Just to be clear: i'm talking about stage BEFORE any production, when I'm coding on my own PC and even don't think about production yet.Incremental migrations are definitely needed in production, where you can't get away with dropping entire databases. Using them in development as well helps you to ensure that they're correct.
Understand what you are trying to achieve here but how you're going about it is very wrong. Your development environment should be as close to your production environment as possible. Could run into allsorts of problems.
What happens when you need to replicate the production environment on dev? What happens when you "forget" to add/take-away something on prod that you have done using a migration that is lost?
For dev, maybe a better command would be rake db:rolback, which rolls back the previous migration if you need to edit it for typo or something.
Just out of curosity - why not use rake db:reset instead of the three individual rake tasks?
精彩评论