Added database tasks to Rakefile

This commit is contained in:
Gregory Ballantine 2024-07-03 09:41:09 -04:00
parent 8b742cfed7
commit 3b952dd11e

View File

@ -1,5 +1,17 @@
require 'bundler/setup'
namespace :db do
desc 'Run migrations'
task :migrate, [:version] do |t, args|
require "sequel/core"
Sequel.extension :migration
version = args[:version].to_i if args[:version]
Sequel.connect('sqlite://data/destructo.db') do |db|
Sequel::Migrator.run(db, "db/migrations", target: version)
end
end
end
namespace :server do
task :start do
ENV['APP_ENV'] = 'production'