It is a memorandum.
I wanted to reset heroku's database and see if the production environment works from a clean state with nothing registered. However, because the heroku run rails db: migrate command was executed with the migration files rolled back and edited mixed, the message "We are sorry but something went wrong." Was displayed. Therefore, I decided to reset the database.
Correct reset method
% heroku run rails db:reset DISABLE_DATABASE_ENVIRONMENT_CHECK=1
At the beginning, I used to enter and execute commands like this. It was not reset.
% heroku run rails db:reset
rails aborted!
ActiveRecord::ProtectedEnvironmentError: You are attempting to run a destructive action against your 'production' database.
If you are sure you want to continue, run the same command with the environment variable:
DISABLE_DATABASE_ENVIRONMENT_CHECK=1
If you do not enter the environment variable DISABLE_DATABASE_ENVIRONMENT_CHECK = 1, the production database may be destroyed.
Recommended Posts