Added sequel with example setup
This commit is contained in:
parent
1a3a4287b0
commit
bffbab8fbc
9 changed files with 70 additions and 3 deletions
33
Rakefile
Normal file
33
Rakefile
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
namespace :db do
|
||||
|
||||
migrator = lambda do |version|
|
||||
require_relative 'db'
|
||||
Sequel.extension :migration
|
||||
Sequel::Migrator.apply(DB, 'migrate', version)
|
||||
end
|
||||
|
||||
namespace :migrate do
|
||||
|
||||
desc "Perform migration up to latest migration available"
|
||||
task :up do
|
||||
migrator.call(nil)
|
||||
end
|
||||
|
||||
desc "Perform migration all the way down (erase all data)"
|
||||
task :down do
|
||||
migrator.call(0)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
desc "Erase all data, then bring back to latest migration"
|
||||
task :reset do
|
||||
migrator.call(0)
|
||||
Sequel::Migrator.apply(DB, 'migrate')
|
||||
end
|
||||
|
||||
#desc "Migrate to a specific version"
|
||||
#task :migrate do |version|
|
||||
#end
|
||||
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue