frankfurter/lib/tasks/db.rake

18 lines
390 B
Ruby
Raw Normal View History

2014-03-14 13:12:21 +01:00
namespace :db do
2015-12-30 20:52:02 +01:00
desc 'Create db'
task :create do
`createdb fixer`
end
2014-03-14 13:12:21 +01:00
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
end