require "logger" require "minitest/test_task" Minitest::TestTask.create 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(ENV.fetch("DATABASE_URL"), logger: Logger.new($stderr)) do |db| Sequel::Migrator.run(db, "db/migrations", target: version) end end end