sqitch-add - Add a database change to the plan
sqitch [options] add [<dependency-options>] [<template-options>] name
Add a database change to the plan. This will result in the creation of a new script files with the
--extension extension in the
--verify-dir directories. The content of these files is determined by the evaluation of templates. By default, system templates in $(etc_path)/templates are used. These can be overridden by a single user by creating templates in ~/.sqitch/templates/ See "Templates" for details.
Note that the name of the new change must adhere to the rules as defined in sqitchchanges.
Name of a change that is required by the new change. May be specified multiple times. See sqitchchanges for the various ways in which change targets can be specified.
Name of a change that conflicts with the new change. May be specified multiple times. See sqitchchanges for the various ways in which change targets can be specified.
A brief note describing the purpose of the change. The note will be attached to the change as a comment. Multiple invocations will be concatenated together as separate paragraphs.
Set a variable name and value for use in the templates. The format must be
--set comment='This one is for you, babe.'.
Location to look for the templates. If none is specified,
add will first look in ~/.sqitch/templates/ for each template, and fall back on $($etc_prefix)/templates.
Path to the template for the given change script. Defaults to the individual templates found in
Do not generate the named script.
Generate the named script. These are not mutually exclusive.
Sqitch contains a very simple set of templates for generating the deploy, revert, and verify scripts. By default, it uses system-wide templates installed in ($etc_path)/templates; call
sqitch --etc-path to find out where, exactly. Individual templates may be overridden on a user bases by copying templates to ~/.sqitch/tempates and making modifications. They may also be overridden by using the
--tmplaet-directory option, as well as the template-specific options.
The syntax of the templates is the very simple but limited language provided by Template::Tiny, which is limited to:
This is the directive syntax. By default, the return value of the expression is output:
-- Deploy [% change %]
You can add
- to the immediate start or end of a directive tag to control the whitespace chomping options:
[% IF foo -%] # remove trailing newline We have foo! [%- END %] # remove leading newline
[% IF %]
[% IF %] / [% ELSE %]
[% UNLESS %]
[% IF transactions %] BEGIN; [% ELSE %] -- No transaction, beware! [% END %]
[% FOREACH item IN list %]
Loop over a list of values:
[% FOREACH item IN requires -%] -- requires: [% item %] [% END -%]
Sqitch defines three variables for all templates. Any number of additional variables can be added via the
--set option, like so:
sqitch add --set transations=1 --set schema=foo
Any number of variables may be specified in this manner. You may then use those variables in custom templates. Variables that appear multiple times will be passed to the templates as lists of values for which you will likely want to use
[% FOREACH %]. If the templates do not reference your variables, they will be ignored. Variables may also be specified in a
[add "variables] config section (see "Configuration Variables"). Variables specified via
--set will override configuration variables.
The three core variables are:
The name of the change being added.
A list of required changes as passed via one or more instances of the
A list of conflicting changes as passed via one or more instances of the
Directory in which to find the templates which should be named deploy.tmpl, revert.tmpl, and verify.tmpl. This will override looking for user- or system-specific templates, and may in turn be overridden by the
Boolean variable indicating whether or not to generate the specified script when adding a change. They are all enabled by default. If you've disabled them but wish to create them for a given call to
add, use the appropriate option:
Location of individual templates. My be overridden by the appropriate option:
A section defining template variables. Useful if you've customized templates with your own variables and want project-, user-, or system-specific defaults for them.
Unless explicitly told where to find templates via
--template-directory or, as appropriate,
--verify-template, Sqitch looks in two locations for templates: A system-wide location and a user-specific location:
The system-wide templates for creating deploy, revert, and verify scripts.
User-specific templates to override the system-wide templates.
Part of the sqitch suite.