Sha256: 241203fdfd9d5a142233138c82654473ed19a74387c1d2bd7b6c81c8a418a24b

Contents?: true

Size: 667 Bytes

Versions: 3

Compression:

Stored size: 667 Bytes

Contents

require_relative 'config/boot'
require_relative 'my_app'
require 'sinatra/asset_pipeline/task'

Sinatra::AssetPipeline::Task.define! MyApp

namespace :db do
  desc "Run migrations"
  task :migrate, [:version] do |t, args|
    Sequel.extension :migration
    db = Sequel.connect(YAML.load_file("#{Melodiest::ROOT}/config/database.yml")[ENV['RACK_ENV']])
    migration_path = "#{Melodiest::ROOT}/db/migrations"

    if args[:version]
      puts "Migrating to version #{args[:version]}"
      Sequel::Migrator.run(db, migration_path, target: args[:version].to_i)
    else
      puts "Migrating to latest"
      Sequel::Migrator.run(db, migration_path)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
melodiest-2.0.1 spec/fixtures/with_db/rakefile.txt
melodiest-2.0.0 spec/fixtures/with_db/rakefile.txt
melodiest-1.0.0 spec/fixtures/with_db/rakefile.txt