Jeremy, I guess what I was looking to do was start with no database (i.e. I removed the test.db from my directory). I then wanted to run one of the two commands to go to version one which is what I was trying to accomplish with what I was showing below. Then I wanted check the database using the sqllite Manager that I downloaded for Firefox and check that the database had the table and the first column. Then finally, run a second command to pick up the 002_ file and check the database again to make sure the second column got added correctly. How does Sequel know which files in a directory to use. In my case I had the two migration files, the data base, and the ruby file for migrating all in the same directory. Is that allowed?
Thanks again for the help and I'll see you at the LA Ruby conference, Scott On Tue, Mar 17, 2009 at 1:58 PM, Jeremy Evans <[email protected]>wrote: > > On Mar 17, 1:12 pm, Scott LaBounty <[email protected]> wrote: > > Say I have two migration files 001_TestMigration1.rb and > > 002_TestMigration2.rb with the first containing a create_table and the > > second containing an alter_table/add_column for up and the down > containing > > drop_table and drop_column respectively. > > > > What do I need to do to apply these migrations? I've tried a couple of > > things: > > > > sequel -m . -M 1 sqlite://test.db > > Don't specify -M unless you want to migrate to a specific version. If > you just want to migrate to the current version, just leave off -M. > You can use the -E option to echo the SQL it sends to the database, so > you can see what migrations are run. > > > which I thought would run the first migration but didn't. I also tried > > programatically running: > > Hmm, it should just run the first migration if you are using -M 1 and > no migrations have yet been run. If you put your reply with your > migration code, I'll test it. > > > require 'rubygems' > > require 'sequel' > > Sequel::Migrator.apply(DB, '.', 1, 1) # To current version > > I don't think you want both of those numbers to be 1. I believe one > specifies the version you are migrating from and the other the version > to migrate to, so if they are equal it shouldn't do much. > > Jeremy > > > -- Scott http://steamcode.blogspot.com/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
