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

Our site is back! Thanks to everyone for your help.

It seems i had solved it days ago, but was careless with reading the error message. There were two duplicated tags, ‘socialmedia’ and ‘social-media’. After fixing the 1st i didn’t notice that the error message had changed, given how similar both duplicate tags were.

Here’s the processes for fixing those two errors:

1. Finding the tag table and the duplicate tag

  • Download the backup to your operating system. This guide is for windows, but the process will be about the same on Linux

  • Extract all the zipped folders in it which should leave you with a dump.sql file and an uploads folder

  • Open the dump.sql file with a text editor, i used Visual Studio Code

  • Search for “COPY public.tags” to locate the tags table. It should be near the bottom and look like this:

  • Either browse through it manually, or copy paste your tags table into a separate document where you can use the search function on it to find your duplicate tag

  • Save your fixed dump.sql file as dump.sql

2. The order and names of files and folders has to be perfect in the re-zip.

  • After extraction you should have a dump.sql file and an uploads folder

  • Right click on dump.sql. select 7zip and ‘add to archive’.

  • Select gzip as the archive format, keeping the name of the file the same

  • Select the new dump.sql.gz file and the uploads file, then right click > 7zip > add to archive > archive format: tar. Make sure the name of the file is exactly the same as the original backup, it should look something like this: ‘public-happiness-2023-07-25-033857-v20220628031850’

  • Select your new .tar file > 7zip > add to archive > archive format: gzip. Make sure the name of the file is exactly the same as the original backup, it should look something like this: ‘public-happiness-2023-07-25-033857-v20220628031850’

  • Your final result should be a .tar.gz file with the same name as your original backup.

  • Upload to the admin area and restore your backup