Sha256: dd0f8d5a58a541080a1a83e7ce5f0e713bd0ced36d4816ac85b0b90ce74829de

Contents?: true

Size: 964 Bytes

Versions: 3

Compression:

Stored size: 964 Bytes

Contents

namespace :db do
  require "sequel"
  Sequel.extension :migration
  DB = Sequel.sqlite('db/test.db')

  desc "Perform migration reset (full erase and migration up)"
  task :setup do
    Sequel::Migrator.run(DB, "db/migrations", :target => 0)
    Sequel::Migrator.run(DB, "db/migrations")
    puts "<= sq:migrate:reset executed"
  end

  desc "Perform migration up/down to VERSION"
  task :version do
    version = ENV['VERSION'].to_i
    raise "No VERSION was provided" if version.nil?
    Sequel::Migrator.run(DB, "db/migrations", :target => version)
    puts "<= sq:migrate:to version=[#{version}] executed"
  end

  desc "Perform migration up to latest migration available"
  task :migrate do
    Sequel::Migrator.run(DB, "db/migrations")
    puts "<= sq:migrate:up executed"
  end

  desc "Perform migration down (erase all data)"
  task :rollback do
    Sequel::Migrator.run(DB, "db/migrations", :target => 0)
    puts "<= sq:migrate:down executed"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
simba-0.0.3 lib/simba/base_app/lib/tasks/db.rake
simba-0.0.2 lib/simba/base_app/lib/tasks/db.rake
simba-0.0.1 lib/simba/base_app/lib/tasks/db.rake