STRAZAdocs

strazad migrate

Move the database schema to one migration version

On this page

Synopsis

Move the database schema up or down to one migration version with the migrations this strazad carries, then exit without serving. A move down goes one migration per run, because each down step can drop tables and the rows they hold.

A rollback to an older strazad release runs this command with the newer binary first, since only the newer binary has the steps that undo its own migrations, and then starts the older binary on the same database.

Stop every strazad replica first. The command cannot see other replicas, and a replica that keeps serving writes to the tables the move changes. Give the command the same --config, --profile, --data-dir and --store-dsn that strazad serve runs with, so that it finds the same database.

strazad migrate --to <version> [flags]

Options

      --config string      config file path (default: $STRAZA_CONFIG, else ./straza.yaml when it exists)
      --data-dir string    local state directory (default data)
      --profile string     governance profile, standalone or enterprise (default standalone); it decides every other default
      --store-dsn string   store DSN: a SQLite file path or a PostgreSQL connection string (default: <data-dir>/straza.db on SQLite; PostgreSQL needs one here, in store.dsn or in STRAZA_STORE_DSN)
      --to uint            the migration version to move the database to

See also

Search documentation

Search page titles, commands, and article text.

↑ ↓ Choose resultEnter OpenEsc Close