frankfurter/lib/tasks/db.rake
2017-01-10 12:06:03 +00:00

19 lines
420 B
Ruby

# frozen_string_literal: true
namespace :db do
desc 'Create db'
task :create do
`createdb fixer`
end
desc 'Run database migrations'
task migrate: :environment do
Sequel.extension(:migration)
db = Sequel::DATABASES.first
dir = App.root.join('db/migrate')
opts = {}
opts.update(target: ENV['VERSION'].to_i) if ENV['VERSION']
Sequel::IntegerMigrator.new(db, dir, opts).run
end
end