-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
23 lines (18 loc) · 707 Bytes
/
Copy pathRakefile
File metadata and controls
23 lines (18 loc) · 707 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require './config/environment'
namespace :db do
require 'sequel'
require 'sequel/extensions/seed'
Sequel.extension :migration
Sequel.extension :seed
desc "Perform database migration"
task :migrate do
version = Sequel::Migrator.run(DB, "db/migrations", table: Sequel[:public][:_schema_info])
puts "<= sq:migration:to version=[#{version}] executed"
end
desc "Perform migration reset (migrate down to version 0 and up to latest)"
task :reset do
Sequel::Migrator.run(DB, "db/migrations", :target => 0, table: Sequel[:public][:_schema_info])
Sequel::Migrator.run(DB, "db/migrations", table: Sequel[:public][:_schema_info])
puts "<= sq:migrate:reset executed"
end
end