frankfurter/lib/tasks/db.rake
2018-06-08 15:32:52 +01:00

17 lines
396 B
Ruby

# frozen_string_literal: true
namespace :db do
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
task setup: %w[db:migrate rates:all]
end