Skip to content

Database & persistence

PostgreSQL stores application data. Know which database you are using before you stop, recreate, upgrade, or clean a runtime.

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.

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.

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:

Terminal · complete-app logical backup
docker exec open-trading \
pg_dump -U open_trading -d open_trading --format=custom \
> open-trading-backup.dump

For the separate SQL service, use its container instead:

Terminal · hybrid SQL logical backup
docker exec open-trading-sql \
pg_dump -U open_trading -d open_trading --format=custom \
> open-trading-hybrid-backup.dump

Check that pg_dump succeeded. For the complete-app archive, inspect its contents without restoring anything:

Terminal · inspect the archive
docker exec -i open-trading pg_restore --list < open-trading-backup.dump

Expect 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.

  1. Identify the active runtime and database, and make a verified backup.
  2. Compare its schema with the initialization SQL for the version you are adopting. Do not infer compatibility from a successful container start.
  3. For data you need to keep, rehearse the required changes on an isolated copy. There is no supplied data-preserving upgrade command.
  4. 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.

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.