Modifying the database inside of a backup to remove a duplicate key tag so that it doesn't fail when restoring

A bit of an update. Someone else in my team was working on this last week but a solution didn’t come so i had another try, this time by editing the DB on my local system.

What i did:

  1. downloaded old backup that i want to restore
  2. unzipped files with 7zip
  3. opened dump.sql with visual studio code
  4. found the duplicated tags directly in the DB.
  5. found what appeared to be the tag listing by searching using ’ ’ around the tag. In my case ‘socialmedia’. The tags look to be the 2nd and 3rd from bottom of the found instances.

  1. edited one to read

132 ‘socialmedia2’:1A socialmedia2 en_GB 3

  1. Rezipped the dump.sql file in 7zip
  • Add to archive
  • Archive format .gzip
  1. Rezipped the main backup file
  • Add to archive
  • Archive format .tar (gzip is not yet available)
  1. You should now see a zipped .tar fixed backup file

  2. Zip the .tar file in 7zip to create a .tar.gz file, to match the format used by Discourse

  • Add to archive
  • Archive format .gzip
  1. Upload to backups and restore via the admin section

At this point i hit an error message:

Extracting dump file…
[2023-08-08 15:09:15] EXCEPTION: No such file or directory @ rb_check_realpath_internal - /var/www/discourse/tmp/restores/default/2023-08-08-150913/dump.sql.gz

Anyone have any ideas what i missed in the above process?

The only thing i can think of is that the path its looking for is using todays date and not the the date of the backup (i’m writing this on 08-08-2023).