On Sunday, March 1, 2015 at 9:03:22 AM UTC-8, Andrew Burleson wrote: > > I've got a migration that needs to introduce two new tables and make > significant changes to a third. In the third table I need to drop some > foreign keys. > > Everything about the two new tables is suitable for a `change` block > rather than up/down, but as I understand it the third won't be as > `drop_foreign_key` isn't something that is allowed in a change block. > > So my question is, is it safe to have both a `change`, `up`, and `down` > block in the same migration? It seems to work when I tested it, but I'm not > sure if there are risky / unintended side-effects that I may not be aware > of. >
You can have all three, but Sequel is going to use whatever is called last. So if you call up and down after change, then up/down is used. If you call change after up and down, then change is used. If you have any code that can't be reversed, then use up/down and not change. Personally, even when I have a fully reversible migration, I tend to use up/down and not change. Thanks, Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
