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

Version Path
padrino-gen-0.9.28 lib/padrino-gen/padrino-tasks/sequel.rb
padrino-gen-0.9.27 lib/padrino-gen/padrino-tasks/sequel.rb
padrino-gen-0.9.26 lib/padrino-gen/padrino-tasks/sequel.rb
padrino-gen-0.9.24 lib/padrino-gen/padrino-tasks/sequel.rb
padrino-gen-0.9.25 lib/padrino-gen/padrino-tasks/sequel.rb
padrino-gen-0.9.23 lib/padrino-gen/padrino-tasks/sequel.rb
padrino-gen-0.9.22 lib/padrino-gen/padrino-tasks/sequel.rb
padrino-gen-0.9.21 lib/padrino-gen/padrino-tasks/sequel.rb
padrino-gen-0.9.20 lib/padrino-gen/padrino-tasks/sequel.rb
padrino-gen-0.9.19 lib/padrino-gen/padrino-tasks/sequel.rb
padrino-gen-0.9.18 lib/padrino-gen/padrino-tasks/sequel.rb
padrino-gen-0.9.17 lib/padrino-gen/padrino-tasks/sequel.rb
padrino-gen-0.9.16 lib/padrino-gen/padrino-tasks/sequel.rb
padrino-gen-0.9.15 lib/padrino-gen/padrino-tasks/sequel.rb
padrino-gen-0.9.14 lib/padrino-gen/padrino-tasks/sequel.rb
padrino-gen-0.9.13 lib/padrino-gen/padrino-tasks/sequel.rb
padrino-gen-0.9.12 lib/padrino-gen/padrino-tasks/sequel.rb
padrino-gen-0.9.11 lib/padrino-gen/padrino-tasks/sequel.rb
padrino-gen-0.9.10 lib/padrino-gen/padrino-tasks/sequel.rb