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].
> 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].
For more options, visit this group at
http://groups.google.com/group/sequel-talk?hl=en.