Database commands
Database commands work with db units.
dpl db wait <name>
Section titled “dpl db wait <name>”Waits until the database is reachable through the database server CLI.
dpl db wait app-dbdpl db wait app-db --timeout 120The default timeout is 60 seconds.
dpl db console <name>
Section titled “dpl db console <name>”Opens an interactive SQL console as the database user.
dpl db console app-dbUse --root to connect as the engine superuser:
dpl db console app-db --rootdpl runs the client inside the running db-server container with podman exec -it.
dpl db backup <name> [path]
Section titled “dpl db backup <name> [path]”Dumps a database as the database user.
dpl db backup app-db app-db.sqldpl db backup app-db app-db.sql.gzdpl db backup app-db - | gzip > app-db.sql.gzUse -z to force gzip:
dpl db backup app-db backup.sql -zWhen the path is omitted, dpl writes SQL to stdout. Client messages go to stderr, so piping stays clean.
dpl db drop <name>
Section titled “dpl db drop <name>”Drops the database, login user, and local unit state. It keeps the YAML config.
dpl db drop app-dbWithout flags, dpl asks for confirmation and asks whether to create a backup first.
Use --yes for non-interactive runs:
dpl db drop app-db --yesWith --yes, dpl creates a gzip backup in <base>/backup before dropping.