Michael, It looks like your "version" is being passed as "target" to run. Take a look at (at least in Ubuntu on my machine):
/var/lib/gems/1.9.1/gems/sequel-3.13.0/lib/sequel/extensions/migration.rb at around line 199 or so. Scott On Wed, Sep 1, 2010 at 8:31 AM, Michael Lang <[email protected]> wrote: > What's the difference between "version" (which I use) and "target" > (which yours uses)? > > Michael > > On Wed, Sep 1, 2010 at 11:21 AM, Scott LaBounty <[email protected]> > wrote: > > Michael, > > > > I actually tried "apply" first (same issue) and it's just a wrapper to > "run" > > for "maintaining backwards API compatibility". > > > > Scott > > > > On Wed, Sep 1, 2010 at 8:15 AM, Michael Lang <[email protected]> > wrote: > >> > >> Seems to me that "apply" is the appropriate method to call. From my > >> sequel_plus rake tasks: > >> > >> desc "Perform migration up/down to VERSION" > >> task :to, [:version] => :load_config do |t, args| > >> version = (args[:version] || ENV['VERSION']).to_s.strip > >> raise "No VERSION was provided" if version.empty? > >> ::Sequel::Migrator.apply(DB, "db/migrate", version.to_i) > >> end > >> > >> Michael > >> On Wed, Sep 1, 2010 at 11:06 AM, Scott LaBounty <[email protected]> > >> wrote: > >> > I have the following code ... > >> > > >> > << > >> > m = Sequel::Migrator > >> > db = Sequel.connect(ENV['DATABASE_URL'] || > >> > 'sqlite://library.sqlite') > >> > dir = "dbMigration" > >> > target = ENV['TARGET'] ? "#{ENV['TARGET']}" : nil > >> > current = ENV['CURRENT'] ? "#{ENV['CURRENT']}" : nil > >> > puts "m = #{m} db = #{db} dir = #{dir} target = #{target} > >> > current = > >> > #{current}" > >> > # m.apply(db, dir, target.to_i, current.to_i) > >> > m.run(db, dir, :target => target.to_i, :current => > current.to_i) > >> >>> > >> > > >> > which I thought would be more or less equivalent to > >> > > >> > sequel -m dbMigration/ -M 0 sqlite://library.sqlite > >> > > >> > if I set the TARGET value correctly. What I see though is that the > >> > programmatic version always goes to the latest no matter how I have > >> > TARGET > >> > set. > >> > > >> > What am I missing here? > >> > > >> > -- > >> > 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]<sequel-talk%[email protected]> > . > >> > For more options, visit this group at > >> > http://groups.google.com/group/sequel-talk?hl=en. > >> > > >> > >> > >> > >> -- > >> http://codeconnoisseur.org > >> > >> -- > >> 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]<sequel-talk%[email protected]> > . > >> For more options, visit this group at > >> http://groups.google.com/group/sequel-talk?hl=en. > >> > > > > > > > > -- > > 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]<sequel-talk%[email protected]> > . > > For more options, visit this group at > > http://groups.google.com/group/sequel-talk?hl=en. > > > > > > -- > http://codeconnoisseur.org > > -- > 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]<sequel-talk%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/sequel-talk?hl=en. > > -- 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.
