method

check_protected_environments!

Importance_0
v5.0.0.1 - Show latest stable - 0 notes - Class: DatabaseTasks
check_protected_environments!() public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/tasks/database_tasks.rb, line 45
      def check_protected_environments!
        unless ENV['DISABLE_DATABASE_ENVIRONMENT_CHECK']
          current = ActiveRecord::Migrator.current_environment
          stored  = ActiveRecord::Migrator.last_stored_environment

          if ActiveRecord::Migrator.protected_environment?
            raise ActiveRecord::ProtectedEnvironmentError.new(stored)
          end

          if stored && stored != current
            raise ActiveRecord::EnvironmentMismatchError.new(current: current, stored: stored)
          end
        end
      rescue ActiveRecord::NoDatabaseError
      end
Register or log in to add new notes.