On Sunday, May 15, 2011 1:05:30 PM UTC-4, DK wrote: > > On Sun, May 15, 2011 at 11:53 AM, Nicolas Buduroi <[email protected]>wrote: > >> On Sunday, May 15, 2011 12:44:08 PM UTC-4, DK wrote: >>> >>> Right. It is actually a really good question you raise, and yes a merge >>> would not be any different than two devs who have modified any other file, >>> git handles that gracefully. One thing I thoght of that at first I thought >>> would make a one file situation more difficult but on reflection make a one >>> file situation easier is rolling up migrations --- once I accumulate a lot >>> of migrations I roll them up and dump the contents of the schema into the >>> initial migration. Having one file would allow me just to delete text and >>> copy rather than having to delete files. Not a big deal but one less step. >>> >> >> Yes, that would be a nice advantage. For Lobos, this could go one step >> further, as Clojure evaluates source code linearly, I could make the >> migrations ordered by their position into the file, thus making it really >> easy to reorder migrations. >> > > Hmm. but how would that work if you have dependencies? Like if you move a > migration which adds a field to a table before you create the table? >
That would be the responsibility of the developer for now. I could make my library analyze the migrations to find such conflicts, that might be a feature to add in some future release, but I'm not sure it's worth it. > What would be cool is that you could order the file in any order by Rails > would run the migrations in sequence regardless of the order in the file (I > am assuming each 'migration' in the file would have some sort of id or > timestamp). > Unless I'm mistaken, that would be the only way to implement the 'all migrations into one file' feature in Ruby, at least without resorting to top-level calls ensuring the order of evaluation. Although I must say that I'm not that good at Ruby meta-programming. > Thinking more, one more advantage is that it would be easier to find > changes say for a specific table. Right now I just have to grep for it > unless I can read the five mile long name I have given the file. > Yeah, while thinking about this, I realized how tiring it can be to search/consult/erase migrations files and I'm more and more sold to put all migrations into one file. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

