instance method check_current_protected_environment!

Ruby on Rails 7.1.6

Since v7.1.6 Last seen in v8.0.4 Private

Available in: v7.1.6 v7.2.3 v8.0.4

Signature

check_current_protected_environment!(db_config)

No documentation comment.

Parameters

db_config req
Source
# File activerecord/lib/active_record/tasks/database_tasks.rb, line 626
        def check_current_protected_environment!(db_config)
          with_temporary_pool(db_config) do |pool|
            connection = pool.connection
            current = connection.migration_context.current_environment
            stored  = connection.migration_context.last_stored_environment

            if connection.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 626 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::Tasks::DatabaseTasks

Type at least 2 characters to search.

↑↓ navigate · open · esc close