repost schema migrate deploy sends your migration history to an environment, which materializes its event-type registry and answers with the applied diff. It requires a clean local history and refuses any deploy that would lose deployed history.
Usage#
repost schema migrate deploy [options]Options#
| Option | Description |
|---|---|
--dry-run | Print the deployment payload instead of sending it. Never touches the network. |
--force | Replace a diverged deployed history after showing exactly what will be replaced. |
--accept-replace | Proceed without prompting when --force replaces. Only valid together with --force. |
--schema <path> | A .repost file or a directory of them. Defaults to ./repost/schema.repost, else ./repost/schema/. |
Authentication#
The command loads the workspace .env (next to or above the schema directory) and then reads:
| Variable | Meaning |
|---|---|
REPOST_TOKEN | Required. An environment-scoped token with the schema:deploy scope. |
REPOST_API_URL | Optional. Defaults to https://api.repost.sh. |
Values already set in the process environment win over .env.
What it does#
- Validates the schema and builds the payload. No migrations, unmigrated changes, a fork, or a tampered snapshot each abort with instructions; run
migrate devfirst. - Sends the head, the full lineage, and the accumulated JSON Schemas. The server applies it only when your head descends from the deployed one.
- On refusal, the server's reason is printed:
client_behindmeans pull the newer migrations and redeploy;divergedmeans merge and reconcile, or use--force.
With --force, the CLI first fetches the deployed head and prints what will be replaced (checksum, kind, migration name, deploy time), then asks Replace the deployed history? [y/N]:. In CI, pass --accept-replace. The reviewed head is sent back as a lease, so a deploy that lands in between makes the server refuse rather than overwrite unreviewed history. Forcing to a previously deployed checksum is the rollback path and prints an extra rewind warning. When --force turns out to be unnecessary, the CLI says so and performs a normal deploy.
Exit code 1 on any refusal, unconfirmed replacement, or server rejection.
Examples#
repost schema migrate deploy✔ deployment applied
created: order.created
updated: book.created
archived: legacy.importedRe-deploying the same head:
✔ already up to dateA refused deploy prints the server's reason:
error: deploy failed (409): deployed history is not an ancestor
deployed head: sha256:9f2c...
reason: diverged