.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "sqitch-revert 3pm" .TH sqitch-revert 3pm 2024-02-08 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH Name .IX Header "Name" sqitch-revert \- Revert changes to a database .SH Synopsis .IX Header "Synopsis" .Vb 4 \& sqitch revert [options] [] \& sqitch revert [options] [] \& sqitch revert [options] [] \-\-to\-change \& sqitch revert [options] [] \-\-modified .Ve .SH Description .IX Header "Description" Revert changes to the database. Starting from the current deployment state, changes will be reverted in reverse the order of application. All changes will be reverted unless a change is specified, either via \f(CW\*(C`\-\-to\*(C'\fR or with no option flag, in which case changes will be reverted back to that change. .PP If the database has not been deployed to, or its state already matches the specified change, no changes will be made. If the change appears later in the plan than the currently-deployed state, an error will be returned, along with a suggestion to instead use sqitch-deploy. .PP The \f(CW\*(C`\*(C'\fR parameter specifies the database to which to connect, and may also be specified as the \f(CW\*(C`\-\-target\*(C'\fR option. It can be target name, a URI, an engine name, or plan file path. .PP \fIAttention Git Users\fR .IX Subsection "Attention Git Users" .PP If you're a git user thinking this is like \f(CW\*(C`git revert\*(C'\fR, it's not. \&\f(CW\*(C`sqitch revert\*(C'\fR is more like time travel. It takes your database back to the state it had just after applying the target change. It feels like magic, but it's actually all the time you spent writing revert scripts that finally pays off. Starting from the last change currently deployed, \f(CW\*(C`sqitch revert\*(C'\fR runs each revert script in turn until the target change is reached and becomes the last change deployed. .SH Options .IX Header "Options" .ie n .IP """\-t""" 4 .el .IP \f(CW\-t\fR 4 .IX Item "-t" .PD 0 .ie n .IP """\-\-target""" 4 .el .IP \f(CW\-\-target\fR 4 .IX Item "--target" .PD The target database to which to connect. This option can be either a URI or the name of a target in the configuration. .ie n .IP """\-\-to\-change""" 4 .el .IP \f(CW\-\-to\-change\fR 4 .IX Item "--to-change" .PD 0 .ie n .IP """\-\-change""" 4 .el .IP \f(CW\-\-change\fR 4 .IX Item "--change" .ie n .IP """\-\-to""" 4 .el .IP \f(CW\-\-to\fR 4 .IX Item "--to" .PD Specify the reversion change. Defaults to reverting all changes. See sqitchchanges for the various ways in which changes can be specified. .ie n .IP """\-m""" 4 .el .IP \f(CW\-m\fR 4 .IX Item "-m" .PD 0 .ie n .IP """\-\-modified""" 4 .el .IP \f(CW\-\-modified\fR 4 .IX Item "--modified" .PD Finds the change to revert onto based on modifications to deploy scripts. Reverts the change prior to earliest change with a revised deploy script. .ie n .IP """\-s""" 4 .el .IP \f(CW\-s\fR 4 .IX Item "-s" .PD 0 .ie n .IP """\-\-set""" 4 .el .IP \f(CW\-\-set\fR 4 .IX Item "--set" .PD Set a variable name and value for use by the database engine client, if it supports variables. The format must be \f(CW\*(C`name=value\*(C'\fR, e.g., \&\f(CW\*(C`\-\-set defuser=\*(AqHomer Simpson\*(Aq\*(C'\fR. Overrides any values loaded from "configuration Variables". .ie n .IP """\-\-log\-only""" 4 .el .IP \f(CW\-\-log\-only\fR 4 .IX Item "--log-only" Log the changes as if they were reverted, but without actually running the revert scripts. .ie n .IP """\-\-lock\-timeout""" 4 .el .IP \f(CW\-\-lock\-timeout\fR 4 .IX Item "--lock-timeout" .Vb 1 \& sqitch deploy \-\-lock\-timeout 600 .Ve .Sp Set the number of seconds for Sqitch to wait to get an exclusive advisory lock on the target database, for engines that support such a lock. This lock prevents other instances of Sqitch from deploying to the target at the same time, but prevents no other database activity. Defaults to 60. .ie n .IP """\-y""" 4 .el .IP \f(CW\-y\fR 4 .IX Item "-y" Disable the prompt that normally asks whether or not to execute the revert. .ie n .IP """\-\-registry""" 4 .el .IP \f(CW\-\-registry\fR 4 .IX Item "--registry" .Vb 1 \& sqitch revert \-\-registry registry .Ve .Sp The name of the Sqitch registry schema or database in which sqitch stores its own data. .ie n .IP """\-\-db\-client""" 4 .el .IP \f(CW\-\-db\-client\fR 4 .IX Item "--db-client" .PD 0 .ie n .IP """\-\-client""" 4 .el .IP \f(CW\-\-client\fR 4 .IX Item "--client" .PD .Vb 1 \& sqitch revert \-\-client /usr/local/pgsql/bin/psql .Ve .Sp Path to the command-line client for the database engine. Defaults to a client in the current path named appropriately for the database engine. .ie n .IP """\-d""" 4 .el .IP \f(CW\-d\fR 4 .IX Item "-d" .PD 0 .ie n .IP """\-\-db\-name""" 4 .el .IP \f(CW\-\-db\-name\fR 4 .IX Item "--db-name" .PD .Vb 2 \& sqitch revert \-\-db\-name widgets \& sqitch revert \-d bricolage .Ve .Sp Name of the database. In general, targets and URIs are preferred, but this option can be used to override the database name in a target. .ie n .IP """\-u""" 4 .el .IP \f(CW\-u\fR 4 .IX Item "-u" .PD 0 .ie n .IP """\-\-db\-user""" 4 .el .IP \f(CW\-\-db\-user\fR 4 .IX Item "--db-user" .ie n .IP """\-\-db\-username""" 4 .el .IP \f(CW\-\-db\-username\fR 4 .IX Item "--db-username" .PD .Vb 3 \& sqitch revert \-\-db\-username root \& sqitch revert \-\-db\-user postgres \& sqitch revert \-u Mom .Ve .Sp User name to use when connecting to the database. Does not apply to all engines. In general, targets and URIs are preferred, but this option can be used to override the user name in a target. .ie n .IP """\-h""" 4 .el .IP \f(CW\-h\fR 4 .IX Item "-h" .PD 0 .ie n .IP """\-\-db\-host""" 4 .el .IP \f(CW\-\-db\-host\fR 4 .IX Item "--db-host" .PD .Vb 2 \& sqitch revert \-\-db\-host db.example.com \& sqitch revert \-h appdb.example.net .Ve .Sp Host name to use when connecting to the database. Does not apply to all engines. In general, targets and URIs are preferred, but this option can be used to override the host name in a target. .ie n .IP """\-p""" 4 .el .IP \f(CW\-p\fR 4 .IX Item "-p" .PD 0 .ie n .IP """\-\-db\-port""" 4 .el .IP \f(CW\-\-db\-port\fR 4 .IX Item "--db-port" .PD .Vb 2 \& sqitch revert \-\-db\-port 7654 \& sqitch revert \-p 5431 .Ve .Sp Port number to connect to. Does not apply to all engines. In general, targets and URIs are preferred, but this option can be used to override the port in a target. .ie n .IP """\-\-plan\-file""" 4 .el .IP \f(CW\-\-plan\-file\fR 4 .IX Item "--plan-file" .PD 0 .ie n .IP """\-f""" 4 .el .IP \f(CW\-f\fR 4 .IX Item "-f" .PD .Vb 1 \& sqitch revert \-\-plan\-file my.plan .Ve .Sp Path to the deployment plan file. Overrides target, engine, and core configuration values. Defaults to \fR\f(CI$top_dir\fR\fI/sqitch.plan\fR. .SH "Configuration Variables" .IX Header "Configuration Variables" .ie n .IP """[deploy.variables]""" 4 .el .IP \f(CW[deploy.variables]\fR 4 .IX Item "[deploy.variables]" .PD 0 .ie n .IP """[revert.variables]""" 4 .el .IP \f(CW[revert.variables]\fR 4 .IX Item "[revert.variables]" .PD A section defining database client variables. The \f(CW\*(C`deploy.variables\*(C'\fR configuration is read from the \f(CW\*(C`deploy\*(C'\fR command configuration, on the assumption that the values will generally be the same on revert. If they're not, use \f(CW\*(C`revert.variables\*(C'\fR to override \f(CW\*(C`deploy.variables\*(C'\fR. .Sp These variables are useful if your database engine supports variables in scripts, such as PostgreSQL's \&\f(CW\*(C`psql\*(C'\fR variables , Vertica's \&\f(CW\*(C`vsql\*(C'\fR variables , MySQL's user variables , SQL*Plus's \&\f(CW\*(C`DEFINE\*(C'\fR variables , and Snowflake's SnowSQL variables . .Sp May be overridden by \f(CW\*(C`\-\-set\*(C'\fR or target and engine configuration. Variables are merged in the following priority order: .RS 4 .ie n .IP """\-\-set""" 4 .el .IP \f(CW\-\-set\fR 4 .IX Item "--set" .PD 0 .ie n .IP """target.$target.variables""" 4 .el .IP \f(CWtarget.$target.variables\fR 4 .IX Item "target.$target.variables" .ie n .IP """engine.$engine.variables""" 4 .el .IP \f(CWengine.$engine.variables\fR 4 .IX Item "engine.$engine.variables" .ie n .IP """revert.variables""" 4 .el .IP \f(CWrevert.variables\fR 4 .IX Item "revert.variables" .ie n .IP """deploy.variables""" 4 .el .IP \f(CWdeploy.variables\fR 4 .IX Item "deploy.variables" .ie n .IP """core.variables""" 4 .el .IP \f(CWcore.variables\fR 4 .IX Item "core.variables" .RE .RS 4 .RE .ie n .IP """revert.strict""" 4 .el .IP \f(CWrevert.strict\fR 4 .IX Item "revert.strict" .PD A boolean value indicating whether or not the change to revert to must be specified. .ie n .IP """[revert.no_prompt]""" 4 .el .IP \f(CW[revert.no_prompt]\fR 4 .IX Item "[revert.no_prompt]" A boolean value indicating whether or not to disable the prompt before executing the revert. May be overridden by \f(CW\*(C`\-y\*(C'\fR. .ie n .IP """[revert.prompt_accept]""" 4 .el .IP \f(CW[revert.prompt_accept]\fR 4 .IX Item "[revert.prompt_accept]" A boolean value indicating whether default reply to the prompt before executing the revert should be "yes" or "no". Defaults to true, meaning to accept the revert. .SH Sqitch .IX Header "Sqitch" Part of the sqitch suite.