Improved the db:migrate function in the Rakefile to utilize the Sequel API for running migrations, and to allow downgrading to a specific migration easily
This commit is contained in:
parent
b819f4f1cd
commit
1a363a5862
10
Rakefile
10
Rakefile
@ -1,8 +1,14 @@
|
|||||||
require 'bundler/setup'
|
require 'bundler/setup'
|
||||||
|
|
||||||
namespace :db do
|
namespace :db do
|
||||||
task :migrate do
|
desc 'Run migrations'
|
||||||
%x{sequel -m 'db/migrations/' 'sqlite://data/gamedata.db'}
|
task :migrate, [:version] do |t, args|
|
||||||
|
require "sequel/core"
|
||||||
|
Sequel.extension :migration
|
||||||
|
version = args[:version].to_i if args[:version]
|
||||||
|
Sequel.connect('sqlite://data/gamedata.db') do |db|
|
||||||
|
Sequel::Migrator.run(db, "db/migrations", target: version)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user