Sha256: f660013b03ef678aa3bf7c537a612b35552dd76d062d945e7b2b04696da18758

Contents?: true

Size: 587 Bytes

Versions: 1

Compression:

Stored size: 587 Bytes

Contents

require 'active_record/tasks/database_tasks'

module ActiveRecord
  module Tasks
    module DatabaseTasks
      def alias_migrate
        return original_migrate unless Rails.env.test?

        original_migrate
        errors = ::ActiveRecord::ConnectionAdapters::SchemaStatements.instance_variable_get(:@alias_remove_foreign_key_errors)
        raise ::Rails4InvalidForeignKeyMigrationChecker::InvalidRemoveForeignKeyError.new(errors.join("\n")) unless errors.empty?
      end

      alias_method :original_migrate, :migrate
      alias_method :migrate, :alias_migrate
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_4_invalid_foreign_key_migration_checker-0.1.0 lib/rails_4_invalid_foreign_key_migration_checker/active_record/database_tasks.rb