Sha256: 420df8d91464c1bee73abdfcbd6453d8b10aa65273b5446ab612f98c3ab13e55
Contents?: true
Size: 1.28 KB
Versions: 1
Compression:
Stored size: 1.28 KB
Contents
if defined?(ActiveRecord) namespace :db do namespace :migrate do task :all => [:load_config] do invoke_task_if_exists :rails_env run_in_all_environments do |config| ActiveRecord::Base.establish_connection(config) ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true ActiveRecord::Migrator.migrate(ActiveRecord::Migrator.migrations_paths, ENV["VERSION"] ? ENV["VERSION"].to_i : nil) do |migration| ENV["SCOPE"].blank? || (ENV["SCOPE"] == migration.scope) end end Rake::Task["db:_dump"].invoke end end namespace :rollback do task :all => [:load_config] do invoke_task_if_exists :rails_env run_in_all_environments do |config| ActiveRecord::Base.establish_connection(config) step = ENV['STEP'] ? ENV['STEP'].to_i : 1 ActiveRecord::Migrator.rollback(ActiveRecord::Migrator.migrations_paths, step) end Rake::Task["db:_dump"].invoke end end def run_in_all_environments &block if defined?(ActiveRecord::Tasks::DatabaseTasks) ActiveRecord::Tasks::DatabaseTasks.send :each_local_configuration, &block else configs_for_environment.each &block end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bard-rake-0.10.3 | lib/bard/rake/db_migrate_sanity.rb |