method
check_current_protected_environment!
rails latest stable - Class:
ActiveRecord::Tasks::AbstractTasks
check_current_protected_environment!(db_config, migration_class)public
No documentation available.
# File activerecord/lib/active_record/tasks/abstract_tasks.rb, line 23
def check_current_protected_environment!(db_config, migration_class)
with_temporary_pool(db_config, migration_class) do |pool|
migration_context = pool.migration_context
current = migration_context.current_environment
stored = migration_context.last_stored_environment
if migration_context.protected_environment?
raise ActiveRecord::ProtectedEnvironmentError.new(stored)
end
if stored && stored != current
raise ActiveRecord::EnvironmentMismatchError.new(current: current, stored: stored)
end
rescue ActiveRecord::NoDatabaseError
end
end