Nate, I'm curious if you ever ended up writing an auto-migrations extension for sequel?
Aman On Fri, Oct 16, 2009 at 2:47 PM, Jeremy Evans <jeremyeva...@gmail.com> wrote: > > On Oct 16, 12:51 pm, Nate Wiger <nwi...@gmail.com> wrote: >> I'm fine with an external extension, makes sense. >> >> But just some food for thought: >> >> Automatically, stuff like the above is problematic, but that's easily >> solved with: >> >> column :num_items, Integer, :was => :number_of_items >> >> So if :was, rename column > > True, but that's not really automatic, in the sense you can say that > this is my current schema and this is the schema I want, do whatever > it takes to get me there. You have to add hints like this. > >> In practice, we never run into that in reality. You may iterate on >> your data structure names in DEV, but by the time you're anywhere >> close to QA/PROD, you have so many views/other models/admin screens/ >> etc dependent on column names that changing them is rarely worth it. >> Also, if you're publishing an API (like we do), changing columns == >> changing your API and that's just not possible (esp in the Web 2.0 >> scape where others you've never heard of are mashing up your feeds). > > With Sequel::Model, you should be able to change column names fairly > easily by alias the accessor methods (alias old new; alias old= > new=). You do have to change any dataset level calls (like filters) > that reference the columns, at least if you don't want to resort to > gross hacks. And certainly if you have database functions/triggers/ > views, it's not worth the effort except in extreme cases. > >> We use auto-migrations all the way thru PROD and we find the workflow >> is actually WAY better and more reliable than ordered migrations. >> Ordered migrations have their own set of problems - there's no unified >> info for a given table after a few iterations, so mistakes become more >> and more probable over time. > > Ordered migrations definitely have their own problems, no doubt about > it. > > Auto-migrations work great until they do something you didn't intend. > If that never happens, there's no downside. As long as you know the > constraints of your auto-migrator and you don't violate them, I could > definitely see that they are more productive. > > Jeremy > --~--~---------~--~----~------------~-------~--~----~ > You received this message because you are subscribed to the Google Groups > "sequel-talk" group. > To post to this group, send email to sequel-talk@googlegroups.com > To unsubscribe from this group, send email to > sequel-talk+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/sequel-talk?hl=en > -~----------~----~----~----~------~----~------~--~--- > > -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To post to this group, send email to sequel-t...@googlegroups.com. To unsubscribe from this group, send email to sequel-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en.