Skip to content

Commit

Permalink
Merge pull request #207 from krig/postgresql-import-docs
Browse files Browse the repository at this point in the history
Document the Import Backups screen for Postgres databases
  • Loading branch information
ShadowArcanist authored Mar 7, 2025
2 parents 18f09f4 + dfe8799 commit 439f1d9
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion docs/databases/postgresql.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,35 @@ PostgreSQL, often simply "Postgres", uses and extends the SQL language combined
## Links

- [The official website ›](https://www.postgresql.org/)
- [GitHub ›](https://github.com/postgres/postgres)
- [GitHub ›](https://github.com/postgres/postgres)

## Import Backups

Coolify can import a database dump into a running PostgreSQL instance using the
**Import Backups** section of the Configuration for the instance.

The database dump can either be a file uploaded to the server, or dragged and
dropped into the Configuration screen directly.

The import command can be customized, but by default it expects a database dump
created using the `pg_dump` command with the `-Fc` flag passed in (custom
format).

For example, the following command connects to a PostgreSQL database running in
a local Docker container named `pg-db` as the database user `postgres` and
writes a dump of the `postgres` database to the file `example-database.sql.gz`:

```bash
docker exec pg-db pg_dump -U postgres -d postgres -Fc >example-database.sql.gz
```

### Note on upgrading PostgreSQL

The __custom__ dump format is sensitive to version differences between the dump and
restore commands.

Use the plain (default) or __tar__ dump formats to migrate from an older version
of PostgreSQL to a newer version. When using plain format dumps, use `psql` as
the custom import command instead of `pg_restore`.

See the PostgreSQL documentation for `pg_dump` and `pg_restore` for more information.

0 comments on commit 439f1d9

Please sign in to comment.