Restore
This section describes how to restore the database from a backup.
Using the Restore Script
The restore_backup.sh script is used to restore a database backup. This script will completely erase and replace the current database with the data from the backup file.
Usage
<PATH_TO_BACKUP_FILE>: The path to the backup file to restore.<DB_HOST>: The hostname of the database to restore to.[DB_PORT]: The port of the database. Defaults to5432.
Example
To restore a backup to a local database running on the default port:
The script will prompt you for confirmation before proceeding, as this is a destructive operation.
.env File
The restore_backup.sh script requires the following environment variables to be set in the .env file in the project root:
DB_NAMEPOSTGRES_ADMIN_USERPOSTGRES_ADMIN_PASSWORD
Restore Process
The restore script performs the following steps:
- Terminates active connections: It disconnects all users from the target database.
- Drops the database: The existing database is completely deleted.
- Creates a new database: A new, empty database is created with the same name.
- Restores the backup: The data from the backup file is imported into the new database.