top | item 2524000

Reversible Migrations in Rails 3.1

53 points| rohitarondekar | 15 years ago |edgerails.info | reply

34 comments

order
[+] moe|15 years ago|reply
Wake me up when they finally generate those stupid migrations automatically (see http://south.aeracode.org/docs/tutorial/part1.html#changing-...).
[+] jarin|15 years ago|reply
That probably won't happen (anytime soon at least), because Rails takes the approach of generating your model attributes based on the table fields, not Django's (equally valid) approach of declaring the model attributes on the model and then generating the migrations based on that.

Personally, I prefer the Rails way of doing it, since it keeps my model files cleaner and avoids ambiguity (to me) when adding/removing/changing attributes. Of course, there is a tradeoff in increased startup time because Rails has to analyze your tables, but PassengerPreStart pretty much takes care of that annoyance for me (and I use background processing that doesn't require the Rails environment be instantiated for every job).

[+] nwjsmith|15 years ago|reply
I've been using `:Rinvert` in rails.vim to accomplish the same thing for the last couple of months. Extremely useful.
[+] jackseviltwin|15 years ago|reply
I like that the author added a section on demystifying the magic involved in how reversible migrations actually work. I like knowing how things actually work behind the scenes. I'd like to see the Rails community put less emphasis on the magic and more on how things work.
[+] epochwolf|15 years ago|reply
About time. This has bugged me for years.