16 lines
384 B
Ruby
16 lines
384 B
Ruby
namespace :db do
|
|
require 'sequel'
|
|
Sequel.extension :migration
|
|
|
|
task :migrate do
|
|
m = Sequel::Migrator
|
|
db = Sequel.connect(ENV['DATABASE_URL'] || 'sqlite://library.sqlite')
|
|
dir = "migrations"
|
|
|
|
target = ENV['TARGET'] ? ENV['TARGET'].to_i : nil
|
|
current = ENV['CURRENT'] ? ENV['CURRENT'].to_i : nil
|
|
|
|
m.run(db, dir, target: target, current: current)
|
|
end
|
|
end
|