Restore fails with "hotlinked_media_status" already exists

Continuing the discussion from Upgrade fails on duplicate key error ("index post hotlinked media on post id and url md5"):

I’m now trying to restore from one prod site to a staging site and I’m getting:

ERROR:  type "hotlinked_media_status" already exists
EXCEPTION: psql failed: ERROR:  type "hotlinked_media_status" already exists

@david is there some case you somehow missed when you fixed this before (I think it was failing on migrations then, and this is a restore).

1 Like

How are you restoring the site? Via the UI? discourse CLI? direct psql?

From the command line restoring the most recent backup (I figured out this sed trick today, but it was the same if I copy/pasted).

$(discourse restore |sed -n '3p')

And the backup is on S3 restored from a slightly older version:

Discourse 3.4.0.beta1-dev - https://github.com/discourse/discourse version a3d61ba1c43931eb688f9b2b85c207b5bab02b8c

to

Discourse 3.4.0.beta2-dev - https://github.com/discourse/discourse version f405c021ebd36d5f11499159bd2b54098356a8f9"

Are you able to reproduce the issue on any other installation?

It’s quite surprising that this issue is cropping up more than 2 years later, and without any other reports :thinking:

Maybe not? I did successfully restore that same backup on my dev box.

Do you have any idea what I might have done to cause this or what I can do to fix it? I dropped the database and than was able to restore. Dropping the database was the actual solution, but I don’t deserve a solution for a problem I (seem to have) caused.