lib/padrino-gen/padrino-tasks/sequel.rb in padrino-gen-0.9.28 vs lib/padrino-gen/padrino-tasks/sequel.rb in padrino-gen-0.9.29
- old
+ new
@@ -3,34 +3,34 @@
namespace :migrate do
desc "Perform automigration (reset your db data)"
task :auto => :environment do
::Sequel.extension :migration
- ::Sequel::Migrator.run DB, "db/migrate", :target => 0
- ::Sequel::Migrator.run DB, "db/migrate"
+ ::Sequel::Migrator.run Sequel::Model.db, "db/migrate", :target => 0
+ ::Sequel::Migrator.run Sequel::Model.db, "db/migrate"
puts "<= sq:migrate:auto executed"
end
desc "Perform migration up/down to VERSION"
- task :to, :version, :needs => :environment do |t, args|
+ task :to, [:version] => :environment do |t, args|
version = (args[:version] || ENV['VERSION']).to_s.strip
::Sequel.extension :migration
raise "No VERSION was provided" if version.empty?
- ::Sequel::Migrator.apply(DB, "db/migrate", version.to_i)
+ ::Sequel::Migrator.apply(Sequel::Model.db, "db/migrate", version.to_i)
puts "<= sq:migrate:to[#{version}] executed"
end
desc "Perform migration up to latest migration available"
task :up => :environment do
::Sequel.extension :migration
- ::Sequel::Migrator.run DB, "db/migrate"
+ ::Sequel::Migrator.run Sequel::Model.db, "db/migrate"
puts "<= sq:migrate:up executed"
end
desc "Perform migration down (erase all data)"
task :down => :environment do
::Sequel.extension :migration
- ::Sequel::Migrator.run DB, "db/migrate", :target => 0
+ ::Sequel::Migrator.run Sequel::Model.db, "db/migrate", :target => 0
puts "<= sq:migrate:down executed"
end
end
end
end
\ No newline at end of file