Backup and Restore
Create Backup
To create a backup of your Rapidapp PostgreSQL database, use the following command:
PGPASSWORD='your-password' \
pg_dump -h pg.rapidapp.io \
-U your-username \
-d your-database \
-p 5433 \
-n public \
-OFc > /path/to/backup/pg_file.dump
PGPASSWORD:
Specifies your database password. This environment variable is used to pass the password securely to the pg_dump command.-h:
Specifies the hostname of the PostgreSQL server, in this case, pg.rapidapp.io.-U:
Specifies the username to connect with.-d:
Specifies the database name.-p:
Specifies the port number, which is 5433 for Rapidapp.-n public:
Backs up only the public schema.-OFc:
Specifies the output format as a custom-format archive (-Fc), and the -O option excludes the ownership information from the backup.>:
Redirects the output to the specified file path.
Example:
PGPASSWORD='mypassword' \
pg_dump -h pg.rapidapp.io \
-U myusername \
-d mydatabase \
-p 5433 \
-n public \
-OFc > /backups/mydatabase.dump
Restore Backup
To restore your RapidApp PostgreSQL database from a backup file, use the following command:
PGPASSWORD='your-password' \
pg_restore -h pg.rapidapp.io \
-U your-username \
-d your-database \
-p 5433 \
-n public \
-O /path/to/backup/pg_file.dump
PGPASSWORD:
Specifies your database password. This environment variable is used to pass the password securely to the pg_restore command.-h:
Specifies the hostname of the PostgreSQL server, in this case, pg.rapidapp.io.-U:
Specifies the username to connect with.-d:
Specifies the database name to which the backup will be restored.-p:
Specifies the port number, which is 5433 for RapidApp.-n public:
Restores only the public schema from the backup.-O:
Skips restoring ownership information from the backup file. This is useful when restoring to a different user or environment./path/to/backup/pg_file.dump:
The path to your backup file that you want to restore.
Example:
PGPASSWORD='mypassword' \
pg_restore -h pg.rapidapp.io \
-U myusername \
-d mydatabase \
-p 5433 \
-n public \
-O /backups/mydatabase.dump