class DataMigrater::Migrator
Public Class Methods
new(collection = DataMigrater::Collection.new)
click to toggle source
# File lib/data_migrater/migrator.rb, line 5 def initialize(collection = DataMigrater::Collection.new) @collection = collection end
Public Instance Methods
migrate()
click to toggle source
# File lib/data_migrater/migrator.rb, line 9 def migrate return unless DataMigration.table_exists? begin ActiveRecord::Migration.check_pending! ActiveRecord::Base.transaction do @collection.migrations.each(&:execute) end rescue ActiveRecord::PendingMigrationError puts 'DataMigrater stopped. Pending migrations need to executed!' end end