I can‘t restore the backup-sql

i can‘t restore the backup-sql by Backup and restore Taiga

Hi @fxxmani,

Welcome to the community! :wave:

You’re getting this error because your database is not empty and you’re trying to duplicate unique data when trying to load the dump.

I assume you have created a dump following the guide using this command:

$ docker exec taiga-docker-taiga-db-1 pg_dump -U taiga taiga > taiga-db-backup.sql

So, you already have a backup file in your directory called taiga-db-backup.sql .

Then, you just have to move it to the database container, delete the existing database with your POSTGRES_USER/POSTGRES_PASSWORD (values from your .env file), and restore it again with the previous dump. I left you these steps:

  1. move the dump to the database container:
$ docker cp taiga-db-backup.sql taiga-docker-taiga-db-1:/taiga-db-backup.sql
  1. connect to taiga-db, delete the existing ‘taiga’ database and re-create a new empty one using the same name:
$ docker exec -ti taiga-docker-taiga-db-1 /bin/bash
root@fc44e32c1db4:/# psql -U taiga taiga
taiga=# \c postgres

postgres=# drop database taiga;
DROP DATABASE

postgres=# create database taiga;
CREATE DATABASE
  1. then press Ctrl + D to exit the postgres console, and finally load the dump in the new database:
root@fc44e32c1db4:/# psql -U taiga taiga < taiga-db-backup.sql

Tell us how it goes!

Thank you very much, this is helpful!