Sha256: 8964e9477639980690075afa86867fd7d824ed84fe85b741cedd80fe23731973
Contents?: true
Size: 1.23 KB
Versions: 19
Compression:
Stored size: 1.23 KB
Contents
if defined?(Sequel) namespace :sq do 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" puts "<= sq:migrate:auto executed" end desc "Perform migration up/down to VERSION" task :to, :version, :needs => :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) 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" 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 puts "<= sq:migrate:down executed" end end end end
Version data entries
19 entries across 19 versions & 1 rubygems