Database & persistence
PostgreSQL stores application data. Know which database you are using before you stop, recreate, upgrade, or clean a runtime.
Where the data lives
Section titled “Where the data lives”| Runtime | Storage | What to watch |
|---|---|---|
| Complete Docker app | Compose named volume open-trading-data (normally project-prefixed) |
make docker-stop-dev retains it |
| Separate development SQL service | Anonymous Docker volume | make docker-run recreates the container without automatically reattaching the old volume |
| Packaged desktop | Application user-data directory | Separate from Docker; reinstalling is not a backup |
The complete app and hybrid SQL service are different databases. Data in one does not automatically appear in the other. MCP and browser sessions can also see different stores within the same database; check sessions before assuming data has been lost.
Initialization is not migration
Section titled “Initialization is not migration”docker/init.sql
creates the initial schema for a new Docker database and the desktop
PostgreSQL template. It is not reapplied to a retained database on every start.
There is no automatic schema upgrade or migration system at API startup.
Editing initialization SQL, pulling a new image, or restarting a container does
not upgrade an existing schema. A seaql_migrations table left by an older
build is no longer used and is not removed automatically.
Back up a running Docker database
Section titled “Back up a running Docker database”The following commands assume the standard database name and administrator
role, open_trading. Run them from the product repository root while the
chosen database is running. Choose a new output filename for each backup:
shell redirection replaces an existing file with the same name.
For the complete app:
docker exec open-trading \ pg_dump -U open_trading -d open_trading --format=custom \ > open-trading-backup.dumpFor the separate SQL service, use its container instead:
docker exec open-trading-sql \ pg_dump -U open_trading -d open_trading --format=custom \ > open-trading-hybrid-backup.dumpCheck that pg_dump succeeded. For the complete-app archive, inspect its
contents without restoring anything:
docker exec -i open-trading pg_restore --list < open-trading-backup.dumpExpect an archive listing of database objects, not an error. A listing is not a recovery test: restore into an isolated, compatible PostgreSQL database and validate your data before relying on the backup. These database dumps do not capture Docker configuration, provider credentials, or cluster-wide roles. Protect backups as private data.
Update an existing database
Section titled “Update an existing database”- Identify the active runtime and database, and make a verified backup.
- Compare its schema with the initialization SQL for the version you are adopting. Do not infer compatibility from a successful container start.
- For data you need to keep, rehearse the required changes on an isolated copy. There is no supplied data-preserving upgrade command.
- For disposable development data only, deliberately recreate the database after accepting the data loss.
Even without a cleanup command, rerunning make docker-run recreates the
separate SQL container and does not automatically reconnect its previous
anonymous volume. Back up or explicitly manage that volume first.
Check persistence
Section titled “Check persistence”After a normal stop and restart of the complete app, verify an existing watchlist or other known record using the same session. If it is missing, check the selected runtime, mounted volume and session before resetting the database. See Troubleshooting.
Source: the product database guide.