On Tue, Nov 22, 2011 at 7:59 AM, Tom Wardrop <[email protected]> wrote: > > I've got a directory that contains all my migrations using the format > xxx_migration_description.rb. They of course work using the sequel > command line tool. I'm wondering though, is there a simple way I can > run/call these migrations from within ruby. As part of spec setup in > my spec_helper.rb file, I want to drop all the tables in the database > and re-create them using the migration. I can drop all the tables > alright, but don't know how to run the migrations without falling back > to calling the sequel command line tool. > > Anyone know how to achieve what I'm after? >
I do. If your directory containing the schema migration scripts is named 'migrations' and you've use the constant DB for your sequel connection, just add these 2 lines. Sequel.extension :migration Sequel::Migrator.apply(DB,'migrations') -- Christian -- You received this message because you are subscribed to the Google Groups "sequel-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/sequel-talk?hl=en.
