Reference

CLI reference

Every command and option, with defaults. Options can also be set in quarry.toml; a flag on the command line wins.

Usage
quarry <command> [options]

Global options

These work with every command.

Options for every command
OptionDefaultDescription
--config <path>quarry.tomlConfiguration file to read, relative to the current directory.
--log-level <level>infoOne of error, warn, info or debug.
--jsonoffPrint machine-readable JSON instead of text.
--no-coloroffTurn off coloured output. Also set by NO_COLOR.
--help—Show help for the command and exit.
--version—Print the version and exit.

Environment variables

Passwords are read from the environment and never from quarry.toml.

Environment variables
VariableUsed for
QUARRY_SOURCE_PASSWORDPassword for the source connection.
QUARRY_TARGET_PASSWORDPassword for the target connection.
QUARRY_CONFIGSame as --config.
NO_COLORSame as --no-color when set to any value.

quarry init

Create quarry.toml in the current directory from two connection strings.

Usage
quarry init --source <url> --target <url> [options]
Options for quarry init
OptionDefaultDescription
--source <url>RequiredConnection string of the database to copy from.
--target <url>RequiredConnection string of the database to copy to.
--tables <list>all tablesComma-separated tables to include.
--forceoffOverwrite an existing quarry.toml.

quarry plan

Compare the source and target schemas and print what a run would copy. Writes nothing.

Usage
quarry plan [options]
Options for quarry plan
OptionDefaultDescription
--tables <list>from configOnly plan these tables.
--exclude <list>noneLeave these tables out.
--ranges <n>autoSplit each large table into this many ranges.
--output <file>noneAlso write the plan to a file.

quarry run

Run a migration: plan, copy and catch-up, then keep replaying changes until quarry cutover.

Usage
quarry run [options]
Options for quarry run
OptionDefaultDescription
--dry-runoffCheck permissions, schema and disk, time a sample batch per table, and stop. A dry run changes nothing.
--parallel <n>4Copy workers. Each works on one range at a time.
--batch-size <rows>5000Rows per insert batch.
--apply-workers <n>2Workers that replay changes during catch-up.
--resumeoffContinue a stopped run from its last committed batch.
--cutover <mode>manualmanual waits for quarry cutover; auto cuts over as soon as the lag is under --max-lag.
--max-lag <duration>1sLag at which an automatic cut-over may start.

quarry status

Show the phase, progress and replication lag of the migration in the current directory.

Terminal
quarry status
shop · catch-up
  copied   72,423,100 of 72,423,100 rows (100%)
  lag      340 ms
  started  12 September 2026, 14:02 UTC
Options for quarry status
OptionDefaultDescription
--watchoffRefresh every 2 seconds until interrupted.
--verboseoffAlso list workers and open transactions on the source.

quarry cutover

Switch writes from the source to the target.

Usage
quarry cutover [options]
Options for quarry cutover
OptionDefaultDescription
--timeout <duration>30sHow long to wait for the lag to reach zero before giving up.
--hook <command>from configCommand that points your application at the target.
--keep-reverse <duration>24hHow long to replicate target writes back to the source.
--yesoffSkip the confirmation prompt.

quarry rollback

Undo a migration. Before cut-over it removes what Quarry created on the target; after cut-over it switches writes back to the source, as long as reverse replication is still running.

Usage
quarry rollback [options]
Options for quarry rollback
OptionDefaultDescription
--keep-targetoffBefore cut-over: keep the copied tables on the target.
--hook <command>from configAfter cut-over: command that points your application back at the source.
--yesoffSkip the confirmation prompt.

quarry verify

Compare the source and target table by table: row counts, and checksums of a sample of rows.

Usage
quarry verify [options]
Options for quarry verify
OptionDefaultDescription
--tables <list>all plannedOnly verify these tables.
--sample <percent>1Share of rows to checksum, from 0 to 100.
--fulloffChecksum every row. Slow on large tables.

Exit codes

Every command exits with one of these codes, so scripts can tell a failed cut-over from a bad flag.

Exit codes
CodeMeaning
0Success.
1The command failed; the error is printed.
2Invalid option or configuration.
3A dry run found errors.
4Cut-over timed out; the source is writable again.
5quarry verify found differences.