mirror of
https://github.com/hakanensari/frankfurter.git
synced 2024-10-29 23:32:35 +01:00
25 lines
579 B
Ruby
25 lines
579 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 prepare: %w[db:migrate rates:all]
|
|
|
|
namespace :test do
|
|
task :prepare do
|
|
ENV['APP_ENV'] ||= 'test'
|
|
Rake::Task['db:migrate'].invoke
|
|
Rake::Task['rates:seed_with_saved_data'].invoke
|
|
end
|
|
end
|
|
end
|