Sha256: 7a643b80e16d2856d92352fb41b2f73dd0dfd84a97b7a93878756eced70e4bb3
Contents?: true
Size: 795 Bytes
Versions: 6
Compression:
Stored size: 795 Bytes
Contents
namespace :db do # pass the relative path to the migrations directory by MIGRATION_DIR task :setup_migration_dir do unless defined?(MIGRATION_DIR) migration_dir = ENV["MIGRATION_DIR"] || File.join("db", "migrations") MIGRATION_DIR = File.expand_path(File.join(File.dirname(__FILE__), migration_dir)) end FileUtils.mkdir_p MIGRATION_DIR end # set DIRECTION to migrate down desc "Run your system's migrations" task :migrate => [:setup_migration_dir] do require File.expand_path(File.join(File.dirname(__FILE__), "lib", "migration_runner.rb")) require File.expand_path(File.join(MIGRATION_DIR, "config.rb")) Dir[File.join(MIGRATION_DIR, "*.rb")].each { |file| require file } ENV["DIRECTION"] != "down" ? migrate_up! : migrate_down! end end
Version data entries
6 entries across 6 versions & 2 rubygems