frankfurter/lib/tasks/db.rake
2017-06-14 23:01:27 +01:00

20 lines
421 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