frankfurter/lib/tasks/db.rake

27 lines
686 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2017-06-14 22:16:21 +02:00
2014-03-14 13:12:21 +01:00
namespace :db do
desc 'Run database migrations'
2014-03-14 13:49:16 +01:00
task migrate: :environment do
2014-03-14 13:12:21 +01:00
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
desc 'Run database migrations and seed data'
2020-04-02 15:38:07 +02:00
task prepare: %w[db:migrate rates:all]
namespace :test do
desc 'Run database migrations and seed with saved data'
2020-04-02 15:38:07 +02:00
task :prepare do
ENV['APP_ENV'] ||= 'test'
Rake::Task['db:migrate'].invoke
Rake::Task['rates:seed_with_saved_data'].invoke
end
end
2014-03-14 13:12:21 +01:00
end