summaryrefslogtreecommitdiff
path: root/lib/sqitch-target.pod
blob: 3bf9e6dab795e54cc1cabc37cd2b76af7e4c2f35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
=head1 Name

sqitch-target - Manage target database configuration

=head1 Synopsis

  sqitch target
  sqitch target [-v | --verbose]
  sqitch target add <name> <uri> [-s <property>=<value> ...]
  sqitch target alter <name> [-s <property>=<value> ...]
  sqitch target remove <name>
  sqitch target rename <old> <new>
  sqitch target show <name> [...]

=head1 Description

Manage the set of databases ("targets") you deploy to. Each target may have a
number of properties:

=over

=item C<uri>

The L<database connection URI|URI::db> for the target. Required. Its format is:

  db:engine:[dbname]
  db:engine:[//[user[:password]@][host][:port]/][dbname][?params][#fragment]

Some examples:

=over

=item C<db:sqlite:widgets.db>

=item C<db:pg://dba@example.net/blanket>

=item C<db:mysql://db.example.com/>

=item C<db:firebird://localhost//tmp/test.fdb>

=back

See the L<DB URI Draft|https://github.com/libwww-perl/uri-db> for details.

=item C<registry>

The name of the registry schema or database. The default is C<sqitch>.

=item C<client>

The command-line client to use. If not specified, each engine looks in the OS
Path for an appropriate client.

=item C<top_dir>

The path to the top directory for the target. This directory generally
contains the plan file and subdirectories for deploy, revert, and verify
scripts, as well as reworked instances of those scripts. The default is F<.>,
the current directory.

=item C<plan_file>

The plan file to use for this target. The default is C<$top_dir/sqitch.plan>.

=item C<deploy_dir>

The path to the deploy directory for the target. This directory contains all
of the deploy scripts referenced by changes in the C<plan_file>. The default
is C<$top_dir/deploy>.

=item C<revert_dir>

The path to the revert directory for the target. This directory contains all
of the revert scripts referenced by changes in the C<plan_file>. The default
is C<$top_dir/revert>.

=item C<verify_dir>

The path to the verify directory for the target. This directory contains all
of the verify scripts referenced by changes in the C<plan_file>. The default
is C<$top_dir/verify>.

=item C<reworked_dir>

The path to the reworked directory for the target. This directory contains all
subdirectories for all reworked scripts referenced by changes in the
C<plan_file>. The default is C<$top_dir>.

=item C<reworked_deploy_dir>

The path to the reworked deploy directory for the target. This directory
contains all of the reworked deploy scripts referenced by changes in the
C<plan_file>. The default is C<$reworked_dir/deploy>.

=item C<reworked_revert_dir>

The path to the reworked revert directory for the target. This directory
contains all of the reworked revert scripts referenced by changes in the
C<plan_file>. The default is C<$reworked_dir/revert>.

=item C<reworked_verify_dir>

The path to the reworked verify directory for the target. This directory
contains all of the reworked verify scripts referenced by changes in the
C<plan_file>. The default is C<$reworked_dir/verify>.

=item C<extension>

The file name extension to append to change names to create script file names.
The default is C<sql>.

=back

Each of these overrides the corresponding engine-specific configuration
managed by L<engine|sqitch-engine>.

=head1 Options

=over

=item List Option

=over

=item C<-v>

=item C<--verbose>

  sqitch target --verbose

Be more verbose when listing targets.

=back

=item Add and Alter Options

=over

=item C<--uri>

  sqitch target add devwidgets --uri db:pg:widgets

Specifies the L<URI|https://github.com/libwww-perl/uri-db/> of the target database.

=item C<--top-dir>

  sqitch target add devwidgets --top-dir sql

Specifies the top directory to use for the target. Typically contains the
deployment plan file and the change script directories.

=item C<--plan-file>

=item C<-f>

  sqitch target add devwidgets --plan-file my.plan

Specifies the path to the deployment plan file. Defaults to
C<$top_dir/sqitch.plan>.

=item C<--extension>

  sqitch target add devwidgets --extension ddl

Specifies the file name extension to use for change script file names.
Defaults to C<sql>.

=item C<--dir>

  sqitch target add devwidgets --dir deploy=dep --dir revert=rev --dir verify=tst

Sets the path to a script directory. May be specified multiple times.
Supported keys are:

=over

=item * C<deploy>

=item * C<revert>

=item * C<verify>

=item * C<reworked>

=item * C<reworked_deploy>

=item * C<reworked_revert>

=item * C<reworked_verify>

=back

=item C<--registry>

  sqitch target add devwidgets --registry meta
  
Specifies the name of the database object where Sqitch's state and history
data is stored. Typically a schema name (as in PostgreSQL and Oracle) or a
database name (as in SQLite and MySQL). Defaults to C<sqitch>.

=item C<--client>

  sqitch target add devwidgets --client /usr/local/pgsql/bin/psql

Specifies the path to the command-line client for the target. Defaults to a
client in the current path named appropriately for the engine specified by the
URI.

=item C<-s>

=item C<--set>

Set a variable name and value for use by the database engine client, if it
supports variables. The format must be C<name=value>, e.g.,
C<--set defuser='Homer Simpson'>.

=back

=back

=head1 Actions

With no arguments, shows a list of existing targets. Several actions are
available to perform operations on the targets.

=head2 C<add>

Add a target named C<< <name> >> for the database at C<< <uri> >>. The
C<--set> option specifies target-specific properties. A new plan file and new
script script directories will be created if they don't already exist.

=head2 C<alter>

Alter target named C<< <name> >>. The C<--set> option specifies
engine-specific properties to set. New script script directories will be
created if they don't already exist.

=head2 C<remove>, C<rm>

Remove the target named C<< <name> >>. The plan file and script directories
will not be affected.

=head2 C<rename>

Rename the target named C<< <old> >> to C<< <new> >>.

=head2 C<show>

Gives some information about the target C<< <name> >>, including the
associated properties. Specify multiple target names to see information for
each.

=head1 Configuration Variables

The targets are stored in the configuration file, but the command itself
currently relies on no configuration variables.

=head1 Sqitch

Part of the L<sqitch> suite.