Strait Docs
CLI

Commands for database backups, migrations, and maintenance.

backup create

Create a database backup using pg_dump.

FlagTypeDefaultDescription
--output, -ostringOutput file path
--database-urlstringDatabase connection URL
--formatstringplainBackup format (plain, custom, directory, tar)
--verbose, -VboolfalseEnable verbose output
strait backup create --output backup.sql --format custom

backup restore

Restore a database from a backup file. The format is automatically detected.

FlagTypeDefaultDescription
--input, -istringInput backup file (Required)
--database-urlstringDatabase connection URL
--cleanboolfalseClean (drop) database objects before restoring
--verbose, -VboolfalseEnable verbose output
--yesboolfalseSkip confirmation prompt
strait backup restore --input backup.sql --clean --yes

migrate up

Apply pending database migrations.

strait migrate up

You can provide an optional argument to specify the number of migrations to apply (e.g., strait migrate up 2).

migrate down

Rollback database migrations.

FlagTypeDefaultDescription
--yesboolfalseSkip confirmation prompt
strait migrate down --yes

migrate status

Show the current migration version and status.

strait migrate status

migrate create

Create a new pair of up/down SQL migration files.

strait migrate create <name>

This command creates files in the format apps/strait/migrations/<version>_<name>.up.sql and apps/strait/migrations/<version>_<name>.down.sql.

db shell

Open an interactive psql shell.

FlagTypeDefaultDescription
--querystringExecute a single query and exit
strait db shell --query "SELECT * FROM runs LIMIT 10;"

db stats

Show database table sizes and connection statistics.

strait db stats

cleanup

Remove old runs that are in a terminal state.

FlagTypeDefaultDescription
--projectstringFilter by project
--runs-older-thandurationAge threshold for removal (Required)
--statusstringFilter by specific terminal status
--dry-runboolfalseShow what would be deleted without performing the action
--yesboolfalseSkip confirmation prompt
--limitint100Maximum number of runs to delete

Terminal statuses include: completed, failed, timed_out, crashed, system_failed, canceled, and expired.

strait cleanup --runs-older-than 30d --status completed --yes
Was this page helpful?

On this page