Skip to content
Latchkey

sqitch deploy: Deploy Changes in CI

sqitch deploy applies every change in the plan that has not yet been deployed to the target database.

Sqitch tracks changes in a plan file with explicit dependencies. deploy runs the deploy scripts in plan order and records each in its registry tables.

What it does

sqitch deploy runs the deploy/*.sql script for each undeployed change, in the order and with the dependencies declared in sqitch.plan, recording each in the sqitch registry. With --verify it also runs each verify script right after deploying.

Common usage

Terminal
# target defined in sqitch.conf, or pass a URI
sqitch deploy db:pg://ci:$DB_PASSWORD@db:5432/app

# deploy and verify each change as it goes
sqitch deploy --verify db:pg://ci:$DB_PASSWORD@db:5432/app

Options

Flag / argWhat it does
<target>Target URI, e.g. db:pg://user@host/db, or a named target
--verifyRun each verify script after its deploy
--to-change <name>Deploy only up to a named change
--log-onlyRecord changes as deployed without running them

In CI

Define the target in sqitch.conf or pass the URI so the deploy is non-interactive. Use --verify in CI so a change that deploys but fails its own verify script is caught immediately. Sqitch deploys in dependency order, so missing requires: entries surface as errors rather than silent misordering.

Common errors in CI

"Change ... requires change ... which has not been deployed" means a dependency is missing or out of order in the plan. "Deploy failed" prints the SQL error and, unless --no-verify, Sqitch reverts the failed change to keep the registry consistent. "Cannot find plan file" means sqitch is run outside the project directory.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →