Sha256: 2a21e2fe32f45912f686b58cc3b44e91f851c0f4ec4a302e2a2fadfece292d20
Contents?: true
Size: 1.23 KB
Versions: 1
Compression:
Stored size: 1.23 KB
Contents
require "yaml" namespace :db do database_url = YAML.load_file("./config/database.yml")["default"]["url"] desc "Perform migration reset (full erase and migration up)" task :reset do puts `sequel -Etm ./db/migrations -M 0 #{database_url}` puts `sequel -Etm ./db/migrations #{database_url}` puts "<= rake db: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? puts `sequel -Etm db/migrations -M #{version} #{database_url}` puts "<= rake db:version version=[#{version}] executed" end desc "Perform migration up to latest migration available" task :migrate do puts `sequel -Etm ./db/migrations #{database_url}` puts "<= rake db:migrate executed" end desc "Perform migration down (erase all data)" task :rollback do puts `sequel -Etm ./db/migrations -M 0 #{database_url}` puts "<= rake db:rollback executed" end desc "Perform schema dump (dumping the current schema as a migration)" task :dump do raise "No FILENAME was provided" if ENV["FILENAME"].nil? puts `sequel -Etd #{database_url} > ./db/migrations/#{ENV["FILENAME"]}` puts "<= rake db:dump executed" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
simba-0.0.5 | lib/simba/base_app/lib/tasks/db.rake |