instance method
check_current_protected_environment!
Ruby on Rails 7.2.3
Since v7.1.6 Last seen in v8.0.4 PrivateSignature
check_current_protected_environment!(db_config)
No documentation comment.
Parameters
-
db_configreq
Source
# File activerecord/lib/active_record/tasks/database_tasks.rb, line 654
def check_current_protected_environment!(db_config)
with_temporary_pool(db_config) 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
Defined in activerecord/lib/active_record/tasks/database_tasks.rb line 654
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Tasks::DatabaseTasks