method

check_current_protected_environment!

rails latest stable - Class: ActiveRecord::Tasks::AbstractTasks

Method not available on this version

This method is only available on newer versions. The first available version (v8.1.1) is shown here.

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