An error occurred while restoring from a backup: discourse_functions.raise_discourse_voting_category_settings_readonly() does not exist

I’m getting the same error on a development instance (where I just upgraded to pg16 to get the latest pgvector that was causing this retore to fail earlier) that I just git pulled.

I’ve added both post voting and topic voting (topic voting was on the source).

My inclination was to

 DROP table discourse_voting_category_settings;

But then I needed to add CASCADE and I chickened out and tried restoring to staging.

On a staging site, if I try to restore the same database, I get this:

ERROR:  type "hotlinked_media_status" already exists
EXCEPTION: psql failed: ERROR:  type "hotlinked_media_status" already exists
/var/www/discourse/lib/backup_restore/database_restorer.rb:92:in `restore_dump'
/var/www/discourse/lib/backup_restore/database_restorer.rb:26:in `restore'
/var/www/discourse/lib/backup_restore/restorer.rb:51:in `run'