Added sequel with example setup

This commit is contained in:
James 2023-12-28 18:36:49 -06:00
parent 1a3a4287b0
commit bffbab8fbc
9 changed files with 70 additions and 3 deletions

33
Rakefile Normal file
View 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