Upgrading 2.7 to 3.1 failing: "hotlinked_media_status" already exists

This is most likely the problem migration:

Ideally that should first check the type doesn’t exist?

  • One option is you could try running that migration backwards from the command line:

    ./launcher enter app
    rake db:migrate:down VERSION=20220428094026
    

    Then rebuilding, but you will lose the current contents of that table. The migration seems to rebuild it though?

  • Another option is to go into the database and delete that type manually from the pg_type table and then rebuild. But this is arguably more risky as you are getting out of step with the migrations.