Skip to content
Newer
Older
100644 1646 lines (1256 sloc) 54.3 KB
2111fbc @theory Start updating tutorial for new log formats, etc.
authored Aug 1, 2012
1 =encoding UTF-8
2
e5a7224 @theory Start sqitchtutorial.
authored Apr 6, 2012
3 =head1 Name
4
4fb1e1e @theory Update title.
authored Dec 30, 2013
5 sqitchtutorial - A tutorial introduction to Sqitch change management on PostgreSQL
e5a7224 @theory Start sqitchtutorial.
authored Apr 6, 2012
6
7 =head1 Synopsis
8
9 sqitch *
10
11 =head1 Description
12
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 30, 2013
13 This tutorial explains how to create a sqitch-enabled PostgreSQL project, use
14 a VCS for deployment planning, and work with other developers to make sure
15 changes remain in sync and in the proper order.
e5a7224 @theory Start sqitchtutorial.
authored Apr 6, 2012
16
9b7fdcf Minor readability improvement
Wes Cravens authored Dec 21, 2013
17 We'll start by creating a new project from scratch, a fictional antisocial
21d71c4 @theory Some tutorial tweaks.
authored May 18, 2012
18 networking site called Flipr. All examples use L<Git|http://git-scm.com/> as
19 the VCS and L<PostgreSQL|http://www.postgresql.org/> as the storage engine,
20 but for the most part you can substitute other VCSes and database engines in
973ac3a @theory Mention the MySQL support in the docs.
authored Jun 28, 2013
21 the examples as appropriate.
22
23 If you'd like to manage an SQLite database, see L<sqitchtutorial-sqlite>.
24
25 If you'd like to manage an Oracle database, see L<sqitchtutorial-oracle>.
e5a7224 @theory Start sqitchtutorial.
authored Apr 6, 2012
26
91652b8 @theory Start the MySQL tutorial.
authored Jun 28, 2013
27 If you'd like to manage an MySQL database, see L<sqitchtutorial-mysql>.
28
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
29 If you'd like to manage an Firebird database, see L<sqitchtutorial-firebird>.
30
e3f1c05 @theory All references to Vertica to all docs.
authored Sep 3, 2014
31 If you'd like to manage an Vertica database, see L<sqitchtutorial-vertica>.
32
e5a7224 @theory Start sqitchtutorial.
authored Apr 6, 2012
33 =head1 Starting a New Project
34
35 Usually the first thing to do when starting a new project is to create a
36 source code repository. So let's do that with Git:
37
38 > mkdir flipr
3eec3ab @dredozubov Replace inappropriate ROLLBACKS in tutorials.
dredozubov authored Oct 16, 2015
39 > cd flipr
e5a7224 @theory Start sqitchtutorial.
authored Apr 6, 2012
40 > git init .
41 Initialized empty Git repository in /flipr/.git/
42 > touch README.md
43 > git add .
b07325f @theory Start updating tutorial with verify examples.
authored Dec 31, 2012
44 > git commit -am 'Initialize project, add README.'
e5a7224 @theory Start sqitchtutorial.
authored Apr 6, 2012
45
46 If you're a Git user and want to follow along the history, the repository
47 used in these examples is L<on GitHub|https://github.com/theory/sqitch-intro>.
48
92a11f5 @theory Rename `add-change` to `add`.
authored Jun 27, 2012
49 Now that we have a repository, let's get started with Sqitch. Every Sqitch
980e47d @theory Update use of --uri in docs.
authored Jul 20, 2012
50 project must have a name associated with it, and, optionally, a unique URI. We
51 recommend including the URI, as it increases the uniqueness of object
52 identifiers internally, so let's specify one when we initialize Sqitch:
e5a7224 @theory Start sqitchtutorial.
authored Apr 6, 2012
53
d19a19d @theory Add missing dash to tutorials.
authored Oct 19, 2015
54 > sqitch init flipr --uri https://github.com/theory/sqitch-intro/ --engine pg
d7370f1 @theory Start work on `write_config()`.
authored Apr 25, 2012
55 Created sqitch.conf
92a11f5 @theory Rename `add-change` to `add`.
authored Jun 27, 2012
56 Created sqitch.plan
57 Created deploy/
58 Created revert/
8c7220c @theory Change "test" to "verify".
authored Nov 30, 2012
59 Created verify/
e5a7224 @theory Start sqitchtutorial.
authored Apr 6, 2012
60
8ded6d4 @theory sqitchtutorial =~ s/\Q.ini/.conf/g;
authored Apr 27, 2012
61 Let's have a look at F<sqitch.conf>:
e5a7224 @theory Start sqitchtutorial.
authored Apr 6, 2012
62
9aff088 @theory Start the Oracle tutorial.
authored May 6, 2013
63 > cat sqitch.conf
d0f4f2c @theory Start to update tutorial based on actual output.
authored May 17, 2012
64 [core]
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
65 engine = pg
66 # plan_file = sqitch.plan
67 # top_dir = .
d0c01b0 @theory Replace `[core "$engine"]` with `[engine "$engine"]` in docs.
authored Oct 26, 2014
68 # [engine "pg"]
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
69 # target = db:pg:
70 # registry = sqitch
71 # client = /usr/local/pgsql/bin/psql
e5a7224 @theory Start sqitchtutorial.
authored Apr 6, 2012
72
980e47d @theory Update use of --uri in docs.
authored Jul 20, 2012
73 Good, it picked up on the fact that we're creating changes for the PostgreSQL
9af5a06 @theory Replace wayward --set options.
authored Aug 13, 2015
74 engine, thanks to the C<-engine pg> option, and saved it to the file.
d0c01b0 @theory Replace `[core "$engine"]` with `[engine "$engine"]` in docs.
authored Oct 26, 2014
75 Furthermore, it wrote a commented-out C<[engine "pg"]> section with all the
980e47d @theory Update use of --uri in docs.
authored Jul 20, 2012
76 available PostgreSQL engine-specific settings commented out and ready to be
77 edited as appropriate.
f5a1c8a @theory Show commented-out engine config in tutorial.
authored Apr 27, 2012
78
79 By default, Sqitch will read F<sqitch.conf> in the current directory for
9aff088 @theory Start the Oracle tutorial.
authored May 7, 2013
80 settings. But it will also read F<~/.sqitch/sqitch.conf> for user-specific
81 settings. Since PostgreSQL's C<psql> client is not in the path on my system,
82 let's go ahead an tell it where to find the client on our computer:
e5a7224 @theory Start sqitchtutorial.
authored Apr 6, 2012
83
145da93 @theory Update tutorials to use engine.$engine.
authored Oct 26, 2014
84 > sqitch config --user engine.pg.client /opt/local/pgsql/bin/psql
e5a7224 @theory Start sqitchtutorial.
authored Apr 6, 2012
85
2111fbc @theory Start updating tutorial for new log formats, etc.
authored Aug 1, 2012
86 And let's also tell it who we are, since this data will be used in all
87 of our projects:
88
89 > sqitch config --user user.name 'Marge N. O’Vera'
90 > sqitch config --user user.email 'marge@example.com'
91
8ded6d4 @theory sqitchtutorial =~ s/\Q.ini/.conf/g;
authored Apr 27, 2012
92 Have a look at F<~/.sqitch/sqitch.conf> and you'll see this:
e5a7224 @theory Start sqitchtutorial.
authored Apr 6, 2012
93
9aff088 @theory Start the Oracle tutorial.
authored May 7, 2013
94 > cat ~/.sqitch/sqitch.conf
d0c01b0 @theory Replace `[core "$engine"]` with `[engine "$engine"]` in docs.
authored Oct 26, 2014
95 [engine "pg"]
bb9a7bf @theory Proof and modify first few tutorial sections.
authored Jan 3, 2013
96 client = /opt/local/pgsql/bin/psql
2111fbc @theory Start updating tutorial for new log formats, etc.
authored Aug 1, 2012
97 [user]
98 name = Marge N. O’Vera
99 email = marge@example.com
100
101 Which means that Sqitch should be able to find C<psql> for any project, and
102 that it will always properly identify us when planning and committing changes.
92a11f5 @theory Rename `add-change` to `add`.
authored Jun 27, 2012
103
2111fbc @theory Start updating tutorial for new log formats, etc.
authored Aug 1, 2012
104 Back to the repository. Have a look at the plan file, F<sqitch.plan>:
e5a7224 @theory Start sqitchtutorial.
authored Apr 6, 2012
105
9aff088 @theory Start the Oracle tutorial.
authored May 7, 2013
106 > cat sqitch.plan
387b22c @theory Update the plan version in the tutorials.
authored Nov 12, 2014
107 %syntax-version=1.0.0
2111fbc @theory Start updating tutorial for new log formats, etc.
authored Aug 1, 2012
108 %project=flipr
109 %uri=https://github.com/theory/sqitch-intro/
110
111
bb9a7bf @theory Proof and modify first few tutorial sections.
authored Jan 3, 2013
112 Note that it has picked up on the name and URI of the app we're building.
113 Sqitch uses this data to manage cross-project dependencies. The
114 C<%syntax-version> pragma is always set by Sqitch, so that it always knows how
115 to parse the plan, even if the format changes in the future.
2111fbc @theory Start updating tutorial for new log formats, etc.
authored Aug 1, 2012
116
117 Let's commit these changes and start creating the database changes.
e5a7224 @theory Start sqitchtutorial.
authored Apr 6, 2012
118
e41bc5e @theory Add example of first deployment to tutorial.
authored Apr 9, 2012
119 > git add .
120 > git commit -am 'Initialize Sqitch configuration.'
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
121 [master 85e8d7c] Initialize Sqitch configuration.
122 2 files changed, 19 insertions(+)
d0f4f2c @theory Start to update tutorial based on actual output.
authored May 17, 2012
123 create mode 100644 sqitch.conf
92a11f5 @theory Rename `add-change` to `add`.
authored Jun 27, 2012
124 create mode 100644 sqitch.plan
e41bc5e @theory Add example of first deployment to tutorial.
authored Apr 9, 2012
125
2111fbc @theory Start updating tutorial for new log formats, etc.
authored Aug 1, 2012
126 =head1 Our First Change
e41bc5e @theory Add example of first deployment to tutorial.
authored Apr 9, 2012
127
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 16, 2012
128 First, our project will need a schema. This creates a nice namespace for all
129 of the objects that will be part of the flipr app. Run this command:
e41bc5e @theory Add example of first deployment to tutorial.
authored Apr 9, 2012
130
9aff088 @theory Start the Oracle tutorial.
authored May 7, 2013
131 > sqitch add appschema -n 'Add schema for all flipr objects.'
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
132 Created deploy/appschema.sql
133 Created revert/appschema.sql
8c7220c @theory Change "test" to "verify".
authored Nov 30, 2012
134 Created verify/appschema.sql
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
135 Added "appschema" to sqitch.plan
5cdba33 @theory Make sure that `add` writes the added change to the plan file.
authored Jun 27, 2012
136
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
137 The L<C<add>|sqitch-add> command adds a database change to the plan and writes
138 deploy, revert, and verify scripts that represent the change. Now we edit
139 these files. The C<deploy> script's job is to create the schema. So we add
140 this to F<deploy/appschema.sql>:
e41bc5e @theory Add example of first deployment to tutorial.
authored Apr 9, 2012
141
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
142 CREATE SCHEMA flipr;
e41bc5e @theory Add example of first deployment to tutorial.
authored Apr 9, 2012
143
bb9a7bf @theory Proof and modify first few tutorial sections.
authored Jan 3, 2013
144 The C<revert> script's job is to precisely revert the change to the deploy
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
145 script, so we add this to F<revert/appschema.sql>:
e41bc5e @theory Add example of first deployment to tutorial.
authored Apr 9, 2012
146
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
147 DROP SCHEMA flipr;
e41bc5e @theory Add example of first deployment to tutorial.
authored Apr 9, 2012
148
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
149 Now we can try deploying this change. We tell Sqitch where to send the change
150 via a L<database URI|https://github.com/theory/uri-db/>:
e41bc5e @theory Add example of first deployment to tutorial.
authored Apr 9, 2012
151
d0f4f2c @theory Start to update tutorial based on actual output.
authored May 17, 2012
152 > createdb flipr_test
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
153 > sqitch deploy db:pg:flipr_test
154 Adding registry tables to db:pg:flipr_test
155 Deploying to db:pg:flipr_test
efeb29d @theory Add dots and "ok"s to the tutorial.
authored Jan 2, 2013
156 + appschema .. ok
e41bc5e @theory Add example of first deployment to tutorial.
authored Apr 9, 2012
157
f8d7879 @theory Replace the term "metadata" with "registry".
authored Dec 6, 2013
158 First Sqitch created registry tables used to track database changes. The
159 structure and name of the registry varies between databases (PostgreSQL uses a
160 schema to namespace its registry, while SQLite and MySQL use separate
973ac3a @theory Mention the MySQL support in the docs.
authored Jun 28, 2013
161 databases). Next, Sqitch deploys changes. We only have one so far; the C<+>
bd315eb @theory Start the SQLite tutorial.
authored Apr 4, 2013
162 reinforces the idea that the change is being C<added> to the database.
b67fb66 @theory Use `status` and `log` commands instead of table output.
authored Apr 9, 2012
163
164 With this change deployed, if you connect to the database, you'll be able to
b07325f @theory Start updating tutorial with verify examples.
authored Dec 31, 2012
165 see the schema:
e41bc5e @theory Add example of first deployment to tutorial.
authored Apr 9, 2012
166
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
167 > psql -d flipr_test -c '\dn flipr'
168 List of schemas
169 Name | Owner
170 -------+-------
1cd8ca6 @theory s/david/marge/g
authored Sep 19, 2012
171 flipr | marge
60680a4 @guedes fixing a typo
guedes authored Aug 30, 2012
172
bb9a7bf @theory Proof and modify first few tutorial sections.
authored Jan 3, 2013
173 =head2 Trust, But Verify
174
bd315eb @theory Start the SQLite tutorial.
authored Apr 5, 2013
175 But that's too much work. Do you really want to do something like that after
b07325f @theory Start updating tutorial with verify examples.
authored Dec 31, 2012
176 every deploy?
177
178 Here's where the C<verify> script comes in. Its job is to test that the deploy
179 did was it was supposed to. It should do so without regard to any data that
bb9a7bf @theory Proof and modify first few tutorial sections.
authored Jan 3, 2013
180 might be in the database, and should throw an error if the deploy was not
3fba1dc @theory Use privilege functions instead of divide-by-zero for verify.
authored Dec 31, 2012
181 successful. In PostgreSQL, the simplest way to do so for non-queryable objects
182 such as schemas is to take advantage the
183 L<access privilege inquiry functions|http://www.postgresql.org/docs/current/static/functions-info.html#FUNCTIONS-INFO-ACCESS-TABLE>.
184 These functions conveniently throw exceptions if the object being inquired
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
185 does not exist. For our new schema, C<has_schema_privilege()> will do very
186 nicely. Put this query into F<verify/appschema.sql>:
b07325f @theory Start updating tutorial with verify examples.
authored Dec 31, 2012
187
3fba1dc @theory Use privilege functions instead of divide-by-zero for verify.
authored Dec 31, 2012
188 SELECT pg_catalog.has_schema_privilege('flipr', 'usage');
b07325f @theory Start updating tutorial with verify examples.
authored Dec 31, 2012
189
bb9a7bf @theory Proof and modify first few tutorial sections.
authored Jan 3, 2013
190 Such functionality may not be available to other databases, but you can use
191 I<any> query that will throw an exception if the schema doesn't exist. One
192 handy way to do that is to divide by zero if an object doesn't exist. So for
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
193 other databases, assuming division by zero is fatal, you could do something
194 like this:
bb9a7bf @theory Proof and modify first few tutorial sections.
authored Jan 3, 2013
195
196 SELECT 1/COUNT(*) FROM information_schema.schemata WHERE schema_name = 'flipr';
197
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
198 Either way, run the C<verify> script with the L<C<verify>|sqitch-verify>
199 command:
b07325f @theory Start updating tutorial with verify examples.
authored Dec 31, 2012
200
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
201 > sqitch verify db:pg:flipr_test
202 Verifying db:pg:flipr_test
4ffb962 @theory Show verify status "ok" or "not ok" for each script.
authored Dec 31, 2012
203 * appschema .. ok
b07325f @theory Start updating tutorial with verify examples.
authored Dec 31, 2012
204 Verify successful
205
3fba1dc @theory Use privilege functions instead of divide-by-zero for verify.
authored Dec 31, 2012
206 Looks good! If you want to make sure that the verify script correctly dies if
207 the schema doesn't exist, temporarily change the schema name in the script to
208 something that doesn't exist, something like:
209
bb9a7bf @theory Proof and modify first few tutorial sections.
authored Jan 3, 2013
210 SELECT pg_catalog.has_schema_privilege('nonesuch', 'usage');
3fba1dc @theory Use privilege functions instead of divide-by-zero for verify.
authored Dec 31, 2012
211
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
212 Then L<C<verify>|sqitch-verify> again:
3fba1dc @theory Use privilege functions instead of divide-by-zero for verify.
authored Dec 31, 2012
213
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
214 > sqitch verify db:pg:flipr_test
215 Verifying db:pg:flipr_test
bb9a7bf @theory Proof and modify first few tutorial sections.
authored Jan 3, 2013
216 * appschema .. psql:verify/appschema.sql:5: ERROR: schema "nonesuch" does not exist
3fba1dc @theory Use privilege functions instead of divide-by-zero for verify.
authored Dec 31, 2012
217 # Verify script "verify/appschema.sql" failed.
4ffb962 @theory Show verify status "ok" or "not ok" for each script.
authored Jan 1, 2013
218 not ok
3fba1dc @theory Use privilege functions instead of divide-by-zero for verify.
authored Dec 31, 2012
219
220 Verify Summary Report
221 ---------------------
222 Changes: 1
223 Errors: 1
224 Verify failed
225
bb9a7bf @theory Proof and modify first few tutorial sections.
authored Jan 3, 2013
226 It's even nice enough to tell us what the problem is. Or, for the
227 divide-by-zero example, change the schema name:
228
229 SELECT 1/COUNT(*) FROM information_schema.schemata WHERE schema_name = 'nonesuch';
230
231 Then the verify will look something like:
232
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
233 > sqitch verify db:pg:flipr_test
234 Verifying db:pg:flipr_test
bb9a7bf @theory Proof and modify first few tutorial sections.
authored Jan 3, 2013
235 * appschema .. psql:verify/appschema.sql:5: ERROR: division by zero
236 # Verify script "verify/appschema.sql" failed.
237 not ok
238
239 Verify Summary Report
240 ---------------------
241 Changes: 1
242 Errors: 1
243 Verify failed
244
245 Less useful error output, but enough to alert us that something has gone
246 wrong.
247
248 Don't forget to change the schema name back before continuing!
249
250 =head2 Status, Revert, Log, Repeat
3fba1dc @theory Use privilege functions instead of divide-by-zero for verify.
authored Dec 31, 2012
251
252 For purely informational purposes, we can always see how a deployment was
f8d7879 @theory Replace the term "metadata" with "registry".
authored Dec 7, 2013
253 recorded via the L<C<status>|sqitch-status> command, which reads the registry
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
254 tables from the database:
54bf216 @theory Better empty tags; show status and log.
authored Apr 9, 2012
255
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
256 > sqitch status db:pg:flipr_test
257 # On database db:pg:flipr_test
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
258 # Project: flipr
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
259 # Change: c7981df861183412b01be706889e508a63d445ca
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
260 # Name: appschema
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
261 # Deployed: 2013-12-30 15:27:15 -0800
2111fbc @theory Start updating tutorial for new log formats, etc.
authored Aug 1, 2012
262 # By: Marge N. O’Vera <marge@example.com>
8c6ef74 @theory Update tutorial with real live `status` output.
authored Jul 6, 2012
263 #
54bf216 @theory Better empty tags; show status and log.
authored Apr 9, 2012
264 Nothing to deploy (up-to-date)
e41bc5e @theory Add example of first deployment to tutorial.
authored Apr 9, 2012
265
abfa9e7 @theory Use `sqitch status` throughout.
authored Apr 10, 2012
266 Let's make sure that we can revert the change:
e41bc5e @theory Add example of first deployment to tutorial.
authored Apr 9, 2012
267
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
268 > sqitch revert db:pg:flipr_test
269 Revert all changes from db:pg:flipr_test? [Yes]
efeb29d @theory Add dots and "ok"s to the tutorial.
authored Jan 3, 2013
270 - appschema .. ok
e41bc5e @theory Add example of first deployment to tutorial.
authored Apr 9, 2012
271
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
272 The L<C<revert>|sqitch-revert> command first prompts to make sure that we
273 really do want to revert. This is to prevent unnecessary accidents. You can
274 pass the C<-y> option to disable the prompt. Also, notice the C<-> before the
bd315eb @theory Start the SQLite tutorial.
authored Apr 5, 2013
275 change name in the output, which reinforces that the change is being
276 I<removed> from the database. And now the schema should be gone:
e41bc5e @theory Add example of first deployment to tutorial.
authored Apr 9, 2012
277
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
278 > psql -d flipr_test -c '\dn flipr'
279 List of schemas
280 Name | Owner
281 ------+-------
e41bc5e @theory Add example of first deployment to tutorial.
authored Apr 9, 2012
282
b67fb66 @theory Use `status` and `log` commands instead of table output.
authored Apr 10, 2012
283 And the status message should reflect as much:
e41bc5e @theory Add example of first deployment to tutorial.
authored Apr 9, 2012
284
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
285 > sqitch status db:pg:flipr_test
286 # On database db:pg:flipr_test
8c6ef74 @theory Update tutorial with real live `status` output.
authored Jul 6, 2012
287 No changes deployed
54bf216 @theory Better empty tags; show status and log.
authored Apr 9, 2012
288
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
289 Of course, since nothing is deployed, the L<C<verify>|sqitch-verify> command
290 has nothing to verify:
b07325f @theory Start updating tutorial with verify examples.
authored Dec 31, 2012
291
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
292 > sqitch verify db:pg:flipr_test
293 Verifying db:pg:flipr_test
b07325f @theory Start updating tutorial with verify examples.
authored Dec 31, 2012
294 No changes deployed
295
296 However, we still have a record that the change happened, visible via the
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
297 L<C<log>|sqitch-log> command:
54bf216 @theory Better empty tags; show status and log.
authored Apr 9, 2012
298
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
299 > sqitch log db:pg:flipr_test
300 On database db:pg:flipr_test
301 Revert c7981df861183412b01be706889e508a63d445ca
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
302 Name: appschema
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
303 Committer: Marge N. O’Vera <marge@example.com>
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
304 Date: 2013-12-30 15:38:17 -0800
00e0c96 @theory Update example `sqitch log` output in `sqitchtutorial`.
authored Jul 12, 2012
305
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
306 Add schema for all flipr objects.
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
307
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
308 Deploy c7981df861183412b01be706889e508a63d445ca
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
309 Name: appschema
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
310 Committer: Marge N. O’Vera <marge@example.com>
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
311 Date: 2013-12-30 15:27:15 -0800
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
312
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
313 Add schema for all flipr objects.
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
314
59837ac @theory Finish updating `sqitchtutorial.pod`.
authored Aug 1, 2012
315 Note that the actions we took are shown in reverse chronological order, with
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
316 the revert first and then the deploy.
b72f83a @theory Add a second deployment.
authored Apr 9, 2012
317
54bf216 @theory Better empty tags; show status and log.
authored Apr 9, 2012
318 Cool. Now let's commit it.
b72f83a @theory Add a second deployment.
authored Apr 9, 2012
319
320 > git add .
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
321 > git commit -m 'Add flipr schema.'
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
322 [master d812132] Add flipr schema.
b07325f @theory Start updating tutorial with verify examples.
authored Dec 31, 2012
323 4 files changed, 22 insertions(+)
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
324 create mode 100644 deploy/appschema.sql
325 create mode 100644 revert/appschema.sql
8c7220c @theory Change "test" to "verify".
authored Nov 30, 2012
326 create mode 100644 verify/appschema.sql
b72f83a @theory Add a second deployment.
authored Apr 9, 2012
327
b07325f @theory Start updating tutorial with verify examples.
authored Dec 31, 2012
328 And then deploy again. This time, let's use the C<--verify> option, so that
329 the C<verify> script is applied when the change is deployed:
b72f83a @theory Add a second deployment.
authored Apr 9, 2012
330
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
331 > sqitch deploy --verify db:pg:flipr_test
332 Deploying changes to db:pg:flipr_test
efeb29d @theory Add dots and "ok"s to the tutorial.
authored Jan 3, 2013
333 + appschema .. ok
b72f83a @theory Add a second deployment.
authored Apr 9, 2012
334
bd315eb @theory Start the SQLite tutorial.
authored Apr 5, 2013
335 And now the schema should be back:
b72f83a @theory Add a second deployment.
authored Apr 9, 2012
336
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
337 > psql -d flipr_test -c '\dn flipr'
338 List of schemas
339 Name | Owner
340 -------+-------
1cd8ca6 @theory s/david/marge/g
authored Sep 19, 2012
341 flipr | marge
b72f83a @theory Add a second deployment.
authored Apr 9, 2012
342
12b190d @theory Show dependencies in `add` info message.
authored Jun 27, 2012
343 When we look at the status, the deployment will be there:
b72f83a @theory Add a second deployment.
authored Apr 9, 2012
344
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
345 > sqitch status db:pg:flipr_test
346 # On database db:pg:flipr_test
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
347 # Project: flipr
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
348 # Change: c7981df861183412b01be706889e508a63d445ca
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
349 # Name: appschema
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
350 # Deployed: 2013-12-30 15:40:53 -0800
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
351 # By: Marge N. O’Vera <marge@example.com>
352 #
353 Nothing to deploy (up-to-date)
b72f83a @theory Add a second deployment.
authored Apr 9, 2012
354
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
355 =head1 On Target
abfa9e7 @theory Use `sqitch status` throughout.
authored Apr 10, 2012
356
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
357 I'm getting a little tired of always having to type C<db:pg:flipr_test>,
358 aren't you? This L<database connection URI|https://github.com/theory/uri-db/>
359 tells Sqitch how to connect to the deployment target, but we don't have
360 to keep using the URI. We can name the target:
abfa9e7 @theory Use `sqitch status` throughout.
authored Apr 10, 2012
361
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
362 > sqitch target add flipr_test db:pg:flipr_test
abfa9e7 @theory Use `sqitch status` throughout.
authored Apr 10, 2012
363
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
364 The L<C<target>|sqitch-target> command, inspired by
365 L<C<git-remote>|http://git-scm.com/docs/git-remote>, allows management of one
366 or more named deployment targets. We've just added a target named
367 C<flipr_test>, which means we can use the string C<flipr_test> for the target,
a263e75 @theory Use `sqitch engine` in the tutorials.
authored Oct 26, 2014
368 rather than the URI. But since we're doing so much testing, we can also use
369 the The L<C<engine>|sqitch-engine> command to tell Sqitch to deploy to the
370 C<flipr_test> target by default:
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
371
a263e75 @theory Use `sqitch engine` in the tutorials.
authored Oct 26, 2014
372 > sqitch engine add pg flipr_test
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
373
6133d33 @theory I kant spel.
authored Dec 30, 2013
374 Now we can omit the target argument altogether, unless we need to deploy to
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
375 another database. Which we will, eventually, but at least our examples will be
376 simpler from here on in, e.g.:
abfa9e7 @theory Use `sqitch status` throughout.
authored Apr 10, 2012
377
378 > sqitch status
379 # On database flipr_test
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
380 # Project: flipr
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
381 # Change: c7981df861183412b01be706889e508a63d445ca
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
382 # Name: appschema
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
383 # Deployed: 2013-12-30 15:40:53 -0800
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
384 # By: Marge N. O’Vera <marge@example.com>
385 #
386 Nothing to deploy (up-to-date)
abfa9e7 @theory Use `sqitch status` throughout.
authored Apr 10, 2012
387
ed0983b @theory Update next section of tutorial with verify examples.
authored Dec 31, 2012
388 Yay, that allows things to be a little more concise. Let's also make sure that
bb9a7bf @theory Proof and modify first few tutorial sections.
authored Jan 3, 2013
389 changes are verified after deploying them:
ed0983b @theory Update next section of tutorial with verify examples.
authored Dec 31, 2012
390
391 > sqitch config --bool deploy.verify true
392 > sqitch config --bool rebase.verify true
393
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
394 We'll see the L<C<rebase>|sqitch-rebase> command a bit later. In the meantime,
395 let's commit the new configuration and and make some more changes!
ed0983b @theory Update next section of tutorial with verify examples.
authored Dec 31, 2012
396
3eec3ab @dredozubov Replace inappropriate ROLLBACKS in tutorials.
dredozubov authored Oct 16, 2015
397 > git commit -am 'Set default deployment target and always verify.'
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
398 [master a6267d3] Set default deployment target and always verify.
399 1 file changed, 8 insertions(+)
ed0983b @theory Update next section of tutorial with verify examples.
authored Dec 31, 2012
400
54bf216 @theory Better empty tags; show status and log.
authored Apr 9, 2012
401 =head1 Deploy with Dependency
b72f83a @theory Add a second deployment.
authored Apr 9, 2012
402
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
403 Let's add another change, this time to create a table. Our app will need
fbc8a1d @theory Replace the term "step" with "change".
authored Jun 26, 2012
404 users, of course, so we'll create a table for them. First, add the new change:
b72f83a @theory Add a second deployment.
authored Apr 9, 2012
405
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
406 > sqitch add users --requires appschema -n 'Creates table to track our users.'
12b190d @theory Show dependencies in `add` info message.
authored Jun 27, 2012
407 Created deploy/users.sql
408 Created revert/users.sql
8c7220c @theory Change "test" to "verify".
authored Nov 30, 2012
409 Created verify/users.sql
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
410 Added "users [appschema]" to sqitch.plan
b72f83a @theory Add a second deployment.
authored Apr 9, 2012
411
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
412 Note that we're requiring the C<appschema> change as a dependency of the new
d17cbad @theory More tutorial updates.
authored Jun 27, 2012
413 C<users> change. Although that change has already been added to the plan and
414 therefore should always be applied before the C<users> change, it's a good
415 idea to be explicit about dependencies.
b72f83a @theory Add a second deployment.
authored Apr 9, 2012
416
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
417 Now edit the scripts. When you're done, F<deploy/users.sql> should look like
d17cbad @theory More tutorial updates.
authored Jun 27, 2012
418 this:
419
3703ffd @theory Add project name to tutorial scripts.
authored Mar 30, 2015
420 -- Deploy flipr:users to pg
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
421 -- requires: appschema
ed0983b @theory Update next section of tutorial with verify examples.
authored Dec 31, 2012
422
b72f83a @theory Add a second deployment.
authored Apr 9, 2012
423 BEGIN;
ed0983b @theory Update next section of tutorial with verify examples.
authored Dec 31, 2012
424
b72f83a @theory Add a second deployment.
authored Apr 9, 2012
425 SET client_min_messages = 'warning';
426
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
427 CREATE TABLE flipr.users (
b72f83a @theory Add a second deployment.
authored Apr 9, 2012
428 nickname TEXT PRIMARY KEY,
429 password TEXT NOT NULL,
430 timestamp TIMESTAMPTZ NOT NULL DEFAULT NOW()
431 );
432
433 COMMIT;
434
d17cbad @theory More tutorial updates.
authored Jun 27, 2012
435 A few things to notice here. On the second line, the dependence on the
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
436 C<appschema> change has been listed. This doesn't do anything, but the default
b8673ab @theory Document the new --template option and locations.
authored Aug 27, 2013
437 C<deploy> PostgreSQL template lists it here for your reference while editing
438 the file. Useful, right?
b72f83a @theory Add a second deployment.
authored Apr 9, 2012
439
440 Notice that all of the SQL code is wrapped in a transaction. This is handy for
d17cbad @theory More tutorial updates.
authored Jun 27, 2012
441 PostgreSQL deployments, because PostgreSQL DDLs are transactional. The upshot
ed0983b @theory Update next section of tutorial with verify examples.
authored Dec 31, 2012
442 is that if any part of this deploy script fails, the whole change fails. Such
443 may work less-well for database engines that don't support transactional DDLs.
b72f83a @theory Add a second deployment.
authored Apr 9, 2012
444
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
445 The table itself will be created in the C<flipr> schema. This is why we need
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
446 to require the C<appschema> change.
b72f83a @theory Add a second deployment.
authored Apr 9, 2012
447
ed0983b @theory Update next section of tutorial with verify examples.
authored Dec 31, 2012
448 Now for the verify script. The simplest way to check that the table was
449 created and has the expected columns without touching the data? Just select
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
450 from the table with a false C<WHERE> clause. Add this to F<verify/users.sql>:
ed0983b @theory Update next section of tutorial with verify examples.
authored Dec 31, 2012
451
452 SELECT nickname, password, timestamp
453 FROM flipr.users
454 WHERE FALSE;
455
456 Now for the revert script: all we have to do is drop the table. Add this to
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
457 F<revert/users.sql>:
b72f83a @theory Add a second deployment.
authored Apr 9, 2012
458
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
459 DROP TABLE flipr.users;
b72f83a @theory Add a second deployment.
authored Apr 9, 2012
460
461 Couldn't be much simpler, right? Let's deploy this bad boy:
462
d17cbad @theory More tutorial updates.
authored Jun 27, 2012
463 > sqitch deploy
464 Deploying changes to flipr_test
efeb29d @theory Add dots and "ok"s to the tutorial.
authored Jan 3, 2013
465 + users .. ok
b72f83a @theory Add a second deployment.
authored Apr 9, 2012
466
ed0983b @theory Update next section of tutorial with verify examples.
authored Dec 31, 2012
467 We know, since verification is enabled, that the table must have been created.
bb9a7bf @theory Proof and modify first few tutorial sections.
authored Jan 3, 2013
468 But for the purposes of visibility, let's have a quick look:
b72f83a @theory Add a second deployment.
authored Apr 9, 2012
469
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
470 > psql -d flipr_test -c '\d flipr.users'
471 Table "flipr.users"
b72f83a @theory Add a second deployment.
authored Apr 9, 2012
472 Column | Type | Modifiers
473 -----------+--------------------------+------------------------
474 nickname | text | not null
475 password | text | not null
476 timestamp | timestamp with time zone | not null default now()
477 Indexes:
478 "users_pkey" PRIMARY KEY, btree (nickname)
479
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
480 We can also verify all currently deployed changes with the
481 L<C<verify>|sqitch-verify> command:
ed0983b @theory Update next section of tutorial with verify examples.
authored Dec 31, 2012
482
483 > sqitch verify
484 Verifying flipr_test
4ffb962 @theory Show verify status "ok" or "not ok" for each script.
authored Jan 1, 2013
485 * appschema .. ok
486 * users ...... ok
ed0983b @theory Update next section of tutorial with verify examples.
authored Dec 31, 2012
487 Verify successful
488
b67fb66 @theory Use `status` and `log` commands instead of table output.
authored Apr 10, 2012
489 Now have a look at the status:
b72f83a @theory Add a second deployment.
authored Apr 9, 2012
490
21d71c4 @theory Some tutorial tweaks.
authored May 18, 2012
491 > sqitch status
abfa9e7 @theory Use `sqitch status` throughout.
authored Apr 10, 2012
492 # On database flipr_test
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
493 # Project: flipr
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
494 # Change: 77398e1dbc5fbce58b05eb67d201f15774718727
8c6ef74 @theory Update tutorial with real live `status` output.
authored Jul 6, 2012
495 # Name: users
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
496 # Deployed: 2013-12-30 15:51:09 -0800
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
497 # By: Marge N. O’Vera <marge@example.com>
8c6ef74 @theory Update tutorial with real live `status` output.
authored Jul 6, 2012
498 #
b67fb66 @theory Use `status` and `log` commands instead of table output.
authored Apr 10, 2012
499 Nothing to deploy (up-to-date)
b72f83a @theory Add a second deployment.
authored Apr 9, 2012
500
d17cbad @theory More tutorial updates.
authored Jun 27, 2012
501 Success! Let's make sure we can revert the change, as well:
b72f83a @theory Add a second deployment.
authored Apr 9, 2012
502
bb9a7bf @theory Proof and modify first few tutorial sections.
authored Jan 3, 2013
503 > sqitch revert --to @HEAD^ -y
73ad7bf @theory Tweak revert message a bit more.
authored Aug 30, 2012
504 Reverting changes to appschema from flipr_test
efeb29d @theory Add dots and "ok"s to the tutorial.
authored Jan 3, 2013
505 - users .. ok
b72f83a @theory Add a second deployment.
authored Apr 9, 2012
506
78c10b1 @theory Use `@LAST` in reverts in the tutorial.
authored Aug 30, 2012
507 Note that we've used the C<--to> option to specify the change to revert to.
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
508 And what do we revert to? The symbolic tag C<@HEAD>, when passed to
509 L<C<revert>|sqitch-revert>, always refers to the last change deployed to the
510 database. (For other commands, it refers to the last change in the plan.)
511 Appending the caret (C<^>) tells Sqitch to select the change I<prior> to the
512 last deployed change. So we revert to C<appschema>, the penultimate change.
513 The other potentially useful symbolic tag is C<@ROOT>, which refers to the
514 first change deployed to the database (or in the plan, depending on the
515 command).
82a5185 @theory Mention the other symbolic tags in the tutorial.
authored Aug 30, 2012
516
ed0983b @theory Update next section of tutorial with verify examples.
authored Dec 31, 2012
517 Back to the database. The C<users> table should be gone but the C<flipr> schema
82a5185 @theory Mention the other symbolic tags in the tutorial.
authored Aug 30, 2012
518 should still be around:
d17cbad @theory More tutorial updates.
authored Jun 27, 2012
519
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
520 > psql -d flipr_test -c '\d flipr.users'
521 Did not find any relation named "flipr.users".
d17cbad @theory More tutorial updates.
authored Jun 27, 2012
522
09a5142 @theory Typo.
authored Jan 10, 2013
523 The L<C<status>|sqitch-status> command politely informs us that we have
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
524 undeployed changes:
3fba1dc @theory Use privilege functions instead of divide-by-zero for verify.
authored Dec 31, 2012
525
526 > sqitch status
527 # On database flipr_test
528 # Project: flipr
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
529 # Change: c7981df861183412b01be706889e508a63d445ca
3fba1dc @theory Use privilege functions instead of divide-by-zero for verify.
authored Dec 31, 2012
530 # Name: appschema
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
531 # Deployed: 2013-12-30 15:40:53 -0800
3fba1dc @theory Use privilege functions instead of divide-by-zero for verify.
authored Dec 31, 2012
532 # By: Marge N. O’Vera <marge@example.com>
533 #
534 Undeployed change:
535 * users
536
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
537 As does the L<C<verify>|sqitch-verify> command:
3fba1dc @theory Use privilege functions instead of divide-by-zero for verify.
authored Dec 31, 2012
538
539 > sqitch verify
540 Verifying flipr_test
4ffb962 @theory Show verify status "ok" or "not ok" for each script.
authored Jan 1, 2013
541 * appschema .. ok
3fba1dc @theory Use privilege functions instead of divide-by-zero for verify.
authored Dec 31, 2012
542 Undeployed change:
543 * users
544 Verify successful
545
bb9a7bf @theory Proof and modify first few tutorial sections.
authored Jan 3, 2013
546 Note that the verify is successful, because all currently-deployed changes are
547 verified. The list of undeployed changes (just "users" here) reminds us about
548 the current state.
3fba1dc @theory Use privilege functions instead of divide-by-zero for verify.
authored Dec 31, 2012
549
550 Okay, let's commit and deploy again:
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
551
b72f83a @theory Add a second deployment.
authored Apr 9, 2012
552 > git add .
553 > git commit -am 'Add users table.'
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
554 [master d58ea2f] Add users table.
ed0983b @theory Update next section of tutorial with verify examples.
authored Dec 31, 2012
555 4 files changed, 31 insertions(+)
d17cbad @theory More tutorial updates.
authored Jun 27, 2012
556 create mode 100644 deploy/users.sql
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
557 create mode 100644 revert/users.sql
8c7220c @theory Change "test" to "verify".
authored Nov 30, 2012
558 create mode 100644 verify/users.sql
abfa9e7 @theory Use `sqitch status` throughout.
authored Apr 10, 2012
559 > sqitch deploy
d17cbad @theory More tutorial updates.
authored Jun 27, 2012
560 Deploying changes to flipr_test
efeb29d @theory Add dots and "ok"s to the tutorial.
authored Jan 3, 2013
561 + users .. ok
b72f83a @theory Add a second deployment.
authored Apr 9, 2012
562
b67fb66 @theory Use `status` and `log` commands instead of table output.
authored Apr 10, 2012
563 Looks good. Check the status:
564
d17cbad @theory More tutorial updates.
authored Jun 27, 2012
565 > sqitch status
abfa9e7 @theory Use `sqitch status` throughout.
authored Apr 10, 2012
566 # On database flipr_test
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
567 # Project: flipr
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
568 # Change: 77398e1dbc5fbce58b05eb67d201f15774718727
8c6ef74 @theory Update tutorial with real live `status` output.
authored Jul 6, 2012
569 # Name: users
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
570 # Deployed: 2013-12-30 15:57:14 -0800
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
571 # By: Marge N. O’Vera <marge@example.com>
8c6ef74 @theory Update tutorial with real live `status` output.
authored Jul 6, 2012
572 #
b67fb66 @theory Use `status` and `log` commands instead of table output.
authored Apr 10, 2012
573 Nothing to deploy (up-to-date)
b72f83a @theory Add a second deployment.
authored Apr 9, 2012
574
d17cbad @theory More tutorial updates.
authored Jun 27, 2012
575 Excellent. Let's do some more!
54bf216 @theory Better empty tags; show status and log.
authored Apr 9, 2012
576
577 =head1 Add Two at Once
578
fbc8a1d @theory Replace the term "step" with "change".
authored Jun 26, 2012
579 Let's add a couple more changes to add functions for managing users.
b72f83a @theory Add a second deployment.
authored Apr 9, 2012
580
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
581 > sqitch add insert_user --requires users --requires appschema \
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
582 -n 'Creates a function to insert a user.'
d17cbad @theory More tutorial updates.
authored Jun 27, 2012
583 Created deploy/insert_user.sql
584 Created revert/insert_user.sql
8c7220c @theory Change "test" to "verify".
authored Nov 30, 2012
585 Created verify/insert_user.sql
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
586 Added "insert_user [users appschema]" to sqitch.plan
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
587
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
588 > sqitch add change_pass --requires users --requires appschema \
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
589 -n 'Creates a function to change a user password.'
d17cbad @theory More tutorial updates.
authored Jun 27, 2012
590 Created deploy/change_pass.sql
591 Created revert/change_pass.sql
8c7220c @theory Change "test" to "verify".
authored Nov 30, 2012
592 Created verify/change_pass.sql
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
593 Added "change_pass [users appschema]" to sqitch.plan
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
594
d17cbad @theory More tutorial updates.
authored Jun 27, 2012
595 Now might be a good time to have a look at the deployment plan:
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
596
d17cbad @theory More tutorial updates.
authored Jun 27, 2012
597 > cat sqitch.plan
387b22c @theory Update the plan version in the tutorials.
authored Nov 13, 2014
598 %syntax-version=1.0.0
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
599 %project=flipr
600 %uri=https://github.com/theory/sqitch-intro/
601
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
602 appschema 2013-12-30T23:19:45Z Marge N. O’Vera <marge@example.com> # Add schema for all flipr objects.
603 users [appschema] 2013-12-30T23:49:00Z Marge N. O’Vera <marge@example.com> # Creates table to track our users.
604 insert_user [users appschema] 2013-12-30T23:57:36Z Marge N. O’Vera <marge@example.com> # Creates a function to insert a user.
605 change_pass [users appschema] 2013-12-30T23:57:45Z Marge N. O’Vera <marge@example.com> # Creates a function to change a user password.
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
606
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
607 Each change appears on a single line with the name of the change, a bracketed
59837ac @theory Finish updating `sqitchtutorial.pod`.
authored Aug 1, 2012
608 list of dependencies, a timestamp, the name and email address of the user who
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
609 planned the change, and a note.
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
610
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
611 Let's write the code for the new changes. Here's what
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
612 F<deploy/insert_user.sql> should look like:
d17cbad @theory More tutorial updates.
authored Jun 27, 2012
613
3703ffd @theory Add project name to tutorial scripts.
authored Mar 30, 2015
614 -- Deploy flipr:insert_user to pg
d17cbad @theory More tutorial updates.
authored Jun 27, 2012
615 -- requires: users
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
616 -- requires: appschema
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
617
54bf216 @theory Better empty tags; show status and log.
authored Apr 9, 2012
618 BEGIN;
619
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
620 CREATE OR REPLACE FUNCTION flipr.insert_user(
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
621 nickname TEXT,
622 password TEXT
54bf216 @theory Better empty tags; show status and log.
authored Apr 9, 2012
623 ) RETURNS VOID LANGUAGE SQL SECURITY DEFINER AS $$
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
624 INSERT INTO flipr.users VALUES($1, md5($2));
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
625 $$;
626
54bf216 @theory Better empty tags; show status and log.
authored Apr 9, 2012
627 COMMIT;
628
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
629 Here's what F<verify/insert_user.sql> might look like:
3fba1dc @theory Use privilege functions instead of divide-by-zero for verify.
authored Dec 31, 2012
630
631 BEGIN;
632 SELECT has_function_privilege('flipr.insert_user(text, text)', 'execute');
68775bf @theory Rollback verifies in tutorial.
authored Jan 13, 2016
633 ROLLBACK;
3fba1dc @theory Use privilege functions instead of divide-by-zero for verify.
authored Dec 31, 2012
634
635 We simply take advantage of the fact that C<has_function_privilege()> throws
636 an exception if the specified function does not exist.
637
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
638 And F<revert/insert_user.sql> should look something like this:
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
639
3703ffd @theory Add project name to tutorial scripts.
authored Mar 30, 2015
640 -- Revert flipr:insert_user from pg
d17cbad @theory More tutorial updates.
authored Jun 27, 2012
641 BEGIN;
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
642 DROP FUNCTION flipr.insert_user(TEXT, TEXT);
d17cbad @theory More tutorial updates.
authored Jun 27, 2012
643 COMMIT;
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
644
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
645 Now for C<change_pass>; F<deploy/change_pass.sql> might look like this:
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
646
3703ffd @theory Add project name to tutorial scripts.
authored Mar 30, 2015
647 -- Deploy flipr:change_pass to pg
d17cbad @theory More tutorial updates.
authored Jun 27, 2012
648 -- requires: users
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
649 -- requires: appschema
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
650
54bf216 @theory Better empty tags; show status and log.
authored Apr 9, 2012
651 BEGIN;
652
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
653 CREATE OR REPLACE FUNCTION flipr.change_pass(
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
654 nick TEXT,
655 oldpass TEXT,
656 newpass TEXT
abfa9e7 @theory Use `sqitch status` throughout.
authored Apr 10, 2012
657 ) RETURNS BOOLEAN LANGUAGE plpgsql SECURITY DEFINER AS $$
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
658 BEGIN
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
659 UPDATE flipr.users
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
660 SET password = md5($3)
661 WHERE nickname = $1
662 AND password = md5($2);
663 RETURN FOUND;
664 END;
665 $$;
666
54bf216 @theory Better empty tags; show status and log.
authored Apr 9, 2012
667 COMMIT;
668
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
669 Use C<has_function_privilege()> in F<verify/change_pass.sql> again:
3fba1dc @theory Use privilege functions instead of divide-by-zero for verify.
authored Dec 31, 2012
670
671 BEGIN;
672 SELECT has_function_privilege('flipr.change_pass(text, text, text)', 'execute');
68775bf @theory Rollback verifies in tutorial.
authored Jan 13, 2016
673 ROLLBACK;
3fba1dc @theory Use privilege functions instead of divide-by-zero for verify.
authored Dec 31, 2012
674
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
675 And of course, its C<revert> script, F<revert/change_pass.sql>, should look
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
676 something like:
677
3703ffd @theory Add project name to tutorial scripts.
authored Mar 30, 2015
678 -- Revert flipr:change_pass from pg
d17cbad @theory More tutorial updates.
authored Jun 27, 2012
679 BEGIN;
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
680 DROP FUNCTION flipr.change_pass(TEXT, TEXT, TEXT);
3eec3ab @dredozubov Replace inappropriate ROLLBACKS in tutorials.
dredozubov authored Oct 16, 2015
681 COMMIT;
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
682
8c7220c @theory Change "test" to "verify".
authored Nov 30, 2012
683 Try em out!
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
684
d17cbad @theory More tutorial updates.
authored Jun 27, 2012
685 > sqitch deploy
686 Deploying changes to flipr_test
efeb29d @theory Add dots and "ok"s to the tutorial.
authored Jan 3, 2013
687 + insert_user .. ok
688 + change_pass .. ok
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
689
bb9a7bf @theory Proof and modify first few tutorial sections.
authored Jan 3, 2013
690 Do we have the functions? Of course we do, they were verified. Still, have a
691 look:
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
692
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
693 > psql -d flipr_test -c '\df flipr.*'
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
694 List of functions
695 Schema | Name | Result data type | Argument data types | Type
696 --------+-------------+------------------+---------------------------------------+--------
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
697 flipr | change_pass | boolean | nick text, oldpass text, newpass text | normal
698 flipr | insert_user | void | nickname text, password text | normal
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
699
abfa9e7 @theory Use `sqitch status` throughout.
authored Apr 10, 2012
700 And what's the status?
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
701
3eec3ab @dredozubov Replace inappropriate ROLLBACKS in tutorials.
dredozubov authored Oct 16, 2015
702 > sqitch status
abfa9e7 @theory Use `sqitch status` throughout.
authored Apr 10, 2012
703 # On database flipr_test
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
704 # Project: flipr
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
705 # Change: 01a4f6964b89284525cb5877d222df8be70d1647
8c6ef74 @theory Update tutorial with real live `status` output.
authored Jul 6, 2012
706 # Name: change_pass
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
707 # Deployed: 2013-12-30 15:59:44 -0800
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
708 # By: Marge N. O’Vera <marge@example.com>
8c6ef74 @theory Update tutorial with real live `status` output.
authored Jul 6, 2012
709 #
abfa9e7 @theory Use `sqitch status` throughout.
authored Apr 10, 2012
710 Nothing to deploy (up-to-date)
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
711
d17cbad @theory More tutorial updates.
authored Jun 27, 2012
712 Looks good. Let's make sure revert works:
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
713
2e367a6 @theory Show off the revert prompt, -y, and rebase in tht tutorial.
authored Dec 3, 2012
714 > sqitch revert -y --to @HEAD^^
73ad7bf @theory Tweak revert message a bit more.
authored Aug 31, 2012
715 Reverting changes to users from flipr_test
efeb29d @theory Add dots and "ok"s to the tutorial.
authored Jan 3, 2013
716 - change_pass .. ok
717 - insert_user .. ok
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
718 > psql -d flipr_test -c '\df flipr.*'
d17cbad @theory More tutorial updates.
authored Jun 27, 2012
719 List of functions
720 Schema | Name | Result data type | Argument data types | Type
721 --------+------+------------------+---------------------+------
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
722
ff6da34 @theory Deprecated @FIRST and @LAST.
authored Nov 30, 2012
723 Note the use of C<@HEAD^^> to specify that the revert be to two changes prior
78c10b1 @theory Use `@LAST` in reverts in the tutorial.
authored Aug 30, 2012
724 the last deployed change. Looks good. Let's do the commit and re-deploy dance:
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
725
726 > git add .
21d71c4 @theory Some tutorial tweaks.
authored May 18, 2012
727 > git commit -m 'Add `insert_user()` and `change_pass()`.'
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
728 [master c9b4d68] Add `insert_user()` and `change_pass()`.
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
729 7 files changed, 65 insertions(+)
d17cbad @theory More tutorial updates.
authored Jun 27, 2012
730 create mode 100644 deploy/change_pass.sql
731 create mode 100644 deploy/insert_user.sql
732 create mode 100644 revert/change_pass.sql
733 create mode 100644 revert/insert_user.sql
8c7220c @theory Change "test" to "verify".
authored Nov 30, 2012
734 create mode 100644 verify/change_pass.sql
735 create mode 100644 verify/insert_user.sql
d17cbad @theory More tutorial updates.
authored Jun 27, 2012
736
abfa9e7 @theory Use `sqitch status` throughout.
authored Apr 10, 2012
737 > sqitch deploy
d17cbad @theory More tutorial updates.
authored Jun 27, 2012
738 Deploying changes to flipr_test
efeb29d @theory Add dots and "ok"s to the tutorial.
authored Jan 3, 2013
739 + insert_user .. ok
740 + change_pass .. ok
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
741
d17cbad @theory More tutorial updates.
authored Jun 27, 2012
742 > sqitch status
abfa9e7 @theory Use `sqitch status` throughout.
authored Apr 10, 2012
743 # On database flipr_test
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
744 # Project: flipr
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
745 # Change: 01a4f6964b89284525cb5877d222df8be70d1647
8c6ef74 @theory Update tutorial with real live `status` output.
authored Jul 6, 2012
746 # Name: change_pass
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
747 # Deployed: 2013-12-30 16:00:50 -0800
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
748 # By: Marge N. O’Vera <marge@example.com>
8c6ef74 @theory Update tutorial with real live `status` output.
authored Jul 6, 2012
749 #
abfa9e7 @theory Use `sqitch status` throughout.
authored Apr 10, 2012
750 Nothing to deploy (up-to-date)
bb9a7bf @theory Proof and modify first few tutorial sections.
authored Jan 3, 2013
751
752 > sqitch verify
753 Verifying flipr_test
754 * appschema .... ok
755 * users ........ ok
756 * insert_user .. ok
757 * change_pass .. ok
758 Verify successful
abfa9e7 @theory Use `sqitch status` throughout.
authored Apr 10, 2012
759
760 Great, we're fully up-to-date!
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
761
762 =head1 Ship It!
763
764 Let's do a first release of our app. Let's call it C<1.0.0-dev1> Since we want
765 to have it go out with deployments tied to the release, let's tag it:
766
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
767 > sqitch tag v1.0.0-dev1 -n 'Tag v1.0.0-dev1.'
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
768 Tagged "change_pass" with @v1.0.0-dev1
769 > git commit -am 'Tag the database with v1.0.0-dev1.'
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
770 [master 0acef3e] Tag the database with v1.0.0-dev1.
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
771 1 file changed, 1 insertion(+)
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
772 > git tag v1.0.0-dev1 -am 'Tag v1.0.0-dev1'
773
8c7220c @theory Change "test" to "verify".
authored Nov 30, 2012
774 We can try deploying to make sure the tag gets picked up like so:
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
775
776 > createdb flipr_dev
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
777 > sqitch deploy db:pg:flipr_dev
778 Adding registry tables to db:pg:flipr_dev
779 Deploying changes to db:pg:flipr_dev
efeb29d @theory Add dots and "ok"s to the tutorial.
authored Jan 3, 2013
780 + appschema ................. ok
781 + users ..................... ok
782 + insert_user ............... ok
783 + change_pass @v1.0.0-dev1 .. ok
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
784
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
785 Great, all four changes were deployed and C<change_pass> was tagged with
b150ae5 @theory Add the "Ship It!" section to the SQLite tutorial.
authored Apr 4, 2013
786 C<@v1.0.0-dev1>. Let's have a look at the status:
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
787
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
788 > sqitch status db:pg:flipr_dev
789 # On database db:pg:flipr_dev
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
790 # Project: flipr
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
791 # Change: 01a4f6964b89284525cb5877d222df8be70d1647
8c6ef74 @theory Update tutorial with real live `status` output.
authored Jul 6, 2012
792 # Name: change_pass
793 # Tag: @v1.0.0-dev1
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
794 # Deployed: 2013-12-30 16:02:19 -0800
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
795 # By: Marge N. O’Vera <marge@example.com>
8c6ef74 @theory Update tutorial with real live `status` output.
authored Jul 6, 2012
796 #
abfa9e7 @theory Use `sqitch status` throughout.
authored Apr 10, 2012
797 Nothing to deploy (up-to-date)
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
798
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
799
b150ae5 @theory Add the "Ship It!" section to the SQLite tutorial.
authored Apr 5, 2013
800 Note the listing of the tag as part of the status message. Now let's bundle
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
801 everything up for release:
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
802
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
803 > sqitch bundle
1ece977 @theory Update `bundle` output in tutorial.
authored Aug 27, 2012
804 Bundling into bundle/
805 Writing config
806 Writing plan
807 Writing scripts
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
808 + appschema
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
809 + users
810 + insert_user
811 + change_pass @v1.0.0-dev1
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
812
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
813 Now we can package the F<bundle> directory and distribute it. When it gets
8c7220c @theory Change "test" to "verify".
authored Nov 30, 2012
814 installed somewhere, users can use Sqitch to deploy to the database. Let's try
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
815 deploying it:
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
816
817 > cd bundle
818 > createdb flipr_prod
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
819 > sqitch deploy db:pg:flipr_prod
820 Adding registry tables to db:pg:flipr_prod
821 Deploying changes to db:pg:flipr_prod
efeb29d @theory Add dots and "ok"s to the tutorial.
authored Jan 3, 2013
822 + appschema ................. ok
823 + users ..................... ok
824 + insert_user ............... ok
825 + change_pass @v1.0.0-dev1 .. ok
0ef5586 @theory Add more deploys and bundle.
authored Apr 9, 2012
826
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
827 Looks much the same as before, eh? Package it up and ship it!
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
828
829 =head1 Flip Out
830
831 Now that we've got the basics of user management done, let's get to work on
832 the core of our product, the "flip." Since other folks are working on other
833 tasks in the repository, we'll work on a branch, so we can all stay out of
834 each other's way. So let's branch:
835
836 > git checkout -b flips
837 Switched to a new branch 'flips'
838
fbc8a1d @theory Replace the term "step" with "change".
authored Jun 26, 2012
839 Now we can add a new change to create a table for our flips.
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
840
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
841 > sqitch add flips -r appschema -r users -n 'Adds table for storing flips.'
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
842 Created deploy/flips.sql
843 Created revert/flips.sql
8c7220c @theory Change "test" to "verify".
authored Nov 30, 2012
844 Created verify/flips.sql
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
845 Added "flips [appschema users]" to sqitch.plan
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
846
d17cbad @theory More tutorial updates.
authored Jun 27, 2012
847 You know the drill by now. Edit F<deploy/flips.sql>:
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
848
3703ffd @theory Add project name to tutorial scripts.
authored Mar 30, 2015
849 -- Deploy flipr:flips to pg
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
850 -- requires: appschema
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
851 -- requires: users
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
852
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
853 BEGIN;
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
854
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
855 SET client_min_messages = 'warning';
856
2763a89 @theory Update tutorial through merge conflict.
authored Aug 17, 2012
857 CREATE TABLE flipr.flips (
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
858 id BIGSERIAL PRIMARY KEY,
2763a89 @theory Update tutorial through merge conflict.
authored Aug 17, 2012
859 nickname TEXT NOT NULL REFERENCES flipr.users(nickname),
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
860 body TEXT NOT NULL DEFAULT '' CHECK ( length(body) <= 180 ),
861 timestamp TIMESTAMPTZ NOT NULL DEFAULT clock_timestamp()
862 );
863
864 COMMIT;
865
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
866 Edit F<verify/flips.sql>:
867
3703ffd @theory Add project name to tutorial scripts.
authored Mar 30, 2015
868 -- Verify flipr:flips on pg
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
869
870 BEGIN;
871
872 SELECT id
873 , nickname
874 , body
875 , timestamp
876 FROM flipr.flips
877 WHERE FALSE;
878
879 COMMIT;
880
d17cbad @theory More tutorial updates.
authored Jun 27, 2012
881 And edit F<revert/flips.sql>:
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
882
3703ffd @theory Add project name to tutorial scripts.
authored Mar 30, 2015
883 -- Revert flipr:flips from pg
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
884
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
885 BEGIN;
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
886
2763a89 @theory Update tutorial through merge conflict.
authored Aug 17, 2012
887 DROP TABLE flipr.flips;
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
888
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
889 COMMIT;
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
890
891 And give it a whirl:
892
21b6e31 @theory Remove example use of `rebase` to apply a tag.
authored Jan 3, 2013
893 > sqitch deploy
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
894 Deploying changes to flipr_test
21b6e31 @theory Remove example use of `rebase` to apply a tag.
authored Jan 3, 2013
895 + flips .. ok
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
896
21b6e31 @theory Remove example use of `rebase` to apply a tag.
authored Jan 3, 2013
897 Look good?
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
898
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
899 > sqitch status --show-tags
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
900 # On database flipr_test
2763a89 @theory Update tutorial through merge conflict.
authored Aug 17, 2012
901 # Project: flipr
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
902 # Change: 4d164ef5986450f00a565735518b1d126f8ee69d
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
903 # Name: flips
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
904 # Deployed: 2013-12-30 16:34:38 -0800
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
905 # By: Marge N. O’Vera <marge@example.com>
8c6ef74 @theory Update tutorial with real live `status` output.
authored Jul 6, 2012
906 #
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
907 # Tag:
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
908 # @v1.0.0-dev1 - 2013-12-30 16:34:38 -0800 - Marge N. O’Vera <marge@example.com>
8c6ef74 @theory Update tutorial with real live `status` output.
authored Jul 6, 2012
909 #
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
910 Nothing to deploy (up-to-date)
911
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
912 Note the use of C<--show tags> to show all the deployed tags. Now make it so:
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
913
914 > git add .
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
915 [flips e8f4655] Add flips table.
d9407bf @theory Add missing tutorial line.
authored Oct 24, 2014
916 > git commit -am 'Add flips table.'
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
917 4 files changed, 37 insertions(+)
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
918 create mode 100644 deploy/flips.sql
919 create mode 100644 revert/flips.sql
8c7220c @theory Change "test" to "verify".
authored Nov 30, 2012
920 create mode 100644 verify/flips.sql
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
921
922 =head1 Wash, Rinse, Repeat
923
924 Now comes the time to add functions to manage flips. I'm sure you have things
fbc8a1d @theory Replace the term "step" with "change".
authored Jun 26, 2012
925 nailed down now. Go ahead and add C<insert_flip> and C<delete_flip> changes
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
926 and commit them. The C<insert_flip> deploy script might look something like:
927
3703ffd @theory Add project name to tutorial scripts.
authored Mar 30, 2015
928 -- Deploy flipr:insert_flip to pg
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
929 -- requires: flips
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
930 -- requires: appschema
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
931 -- requires: users
932
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
933 BEGIN;
2763a89 @theory Update tutorial through merge conflict.
authored Aug 17, 2012
934
935 CREATE OR REPLACE FUNCTION flipr.insert_flip(
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
936 nickname TEXT,
937 body TEXT
938 ) RETURNS BIGINT LANGUAGE sql SECURITY DEFINER AS $$
1214294 @theory Update Oracle tutorial through the merge section.
authored May 8, 2013
939 INSERT INTO flipr.flips (nickname, body)
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
940 VALUES ($1, $2)
941 RETURNING id;
942 $$;
2763a89 @theory Update tutorial through merge conflict.
authored Aug 17, 2012
943
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
944 COMMIT;
945
946 And the C<delete_flip> deploy script might look something like:
947
3703ffd @theory Add project name to tutorial scripts.
authored Mar 30, 2015
948 -- Deploy flipr:delete_flip to pg
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
949 -- requires: flips
6a4a416 @theory Start updating tutorial with project and schema.
authored Aug 17, 2012
950 -- requires: appschema
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
951 -- requires: users
952
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
953 BEGIN;
2763a89 @theory Update tutorial through merge conflict.
authored Aug 17, 2012
954
955 CREATE OR REPLACE FUNCTION flipr.delete_flip(
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
956 flip_id BIGINT
957 ) RETURNS BOOLEAN LANGUAGE plpgsql SECURITY DEFINER AS $$
958 BEGIN
2763a89 @theory Update tutorial through merge conflict.
authored Aug 17, 2012
959 DELETE FROM flipe.flips WHERE id = flip_id;
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
960 RETURN FOUND;
961 END;
962 $$;
2763a89 @theory Update tutorial through merge conflict.
authored Aug 17, 2012
963
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
964 COMMIT;
965
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
966 The C<verify> scripts are:
967
3703ffd @theory Add project name to tutorial scripts.
authored Mar 30, 2015
968 -- Verify flipr:insert_flip on pg
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
969
970 BEGIN;
971
972 SELECT has_function_privilege('flipr.insert_flip(text, text)', 'execute');
973
974 COMMIT;
975
976 And:
977
3703ffd @theory Add project name to tutorial scripts.
authored Mar 30, 2015
978 -- Verify flipr:delete_flip on pg
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
979
980 BEGIN;
981
982 SELECT has_function_privilege('flipr.delete_flip(bigint)', 'execute');
983
984 COMMIT;
985
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
986 The C<revert> scripts are:
987
3703ffd @theory Add project name to tutorial scripts.
authored Mar 30, 2015
988 -- Revert flipr:insert_flip from pg
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
989
990 BEGIN;
991
2763a89 @theory Update tutorial through merge conflict.
authored Aug 17, 2012
992 DROP FUNCTION flipr.insert_flip(TEXT, TEXT);
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
993
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
994 COMMIT;
995
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
996 And:
997
3703ffd @theory Add project name to tutorial scripts.
authored Mar 30, 2015
998 -- Revert flipr:delete_flip from pg
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
999
1000 BEGIN;
1001
2763a89 @theory Update tutorial through merge conflict.
authored Aug 17, 2012
1002 DROP FUNCTION flipr.delete_flip(BIGINT);
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
1003
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
1004 COMMIT;
1005
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
1006 Check the L<example git repository|https://github.com/theory/sqitch-intro> for
52e4458 @theory Link commands and work through flips section.
authored Jan 3, 2013
1007 the complete details. Test L<C<deploy>|sqitch-deploy> and
1008 L<C<revert>|sqitch-revert>, then commit it to the repository. The status
1009 should end up looking something like this:
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
1010
2763a89 @theory Update tutorial through merge conflict.
authored Aug 17, 2012
1011 > sqitch status --show-tags
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
1012 # On database flipr_test
2763a89 @theory Update tutorial through merge conflict.
authored Aug 17, 2012
1013 # Project: flipr
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
1014 # Change: 9a645034b35fa46df37a3725c480982628cc64ec
8c6ef74 @theory Update tutorial with real live `status` output.
authored Jul 6, 2012
1015 # Name: delete_flip
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
1016 # Deployed: 2013-12-30 16:37:51 -0800
2763a89 @theory Update tutorial through merge conflict.
authored Aug 17, 2012
1017 # By: Marge N. O’Vera <marge@example.com>
8c6ef74 @theory Update tutorial with real live `status` output.
authored Jul 6, 2012
1018 #
1019 # Tag:
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
1020 # @v1.0.0-dev1 - 2013-12-30 16:34:38 -0800 - Marge N. O’Vera <marge@example.com>
8c6ef74 @theory Update tutorial with real live `status` output.
authored Jul 6, 2012
1021 #
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
1022 Nothing to deploy (up-to-date)
1023
1024 Good, we've finished this feature. Time to merge back into C<master>.
1025
3f66ce0 @theory Handle merge ordering issue.
authored Apr 11, 2012
1026 =head2 Emergency
d987aa2 @theory Add a branch, some more changes.
authored Apr 10, 2012
1027
4d27feb @theory Add merge conflict example.
authored Apr 10, 2012
1028 Let's do it:
1029
1030 > git checkout master
1031 Switched to branch 'master'
1032 > git pull
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
1033 Updating 0acef3e..d4cbd7d
4d27feb @theory Add merge conflict example.
authored Apr 11, 2012
1034 Fast-forward
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
1035 deploy/delete_list.sql | 20 ++++++++++++++++++++
1036 deploy/insert_list.sql | 17 +++++++++++++++++
1037 deploy/lists.sql | 16 ++++++++++++++++
1038 revert/delete_list.sql | 7 +++++++
1039 revert/insert_list.sql | 7 +++++++
1040 revert/lists.sql | 7 +++++++
1041 sqitch.plan | 4 ++++
1042 verify/delete_list.sql | 7 +++++++
1043 verify/insert_list.sql | 7 +++++++
1044 verify/lists.sql | 9 +++++++++
d3844fc @theory Finish updating the tutorial.
authored Jan 3, 2013
1045 10 files changed, 101 insertions(+)
d17cbad @theory More tutorial updates.
authored Jun 27, 2012
1046 create mode 100644 deploy/delete_list.sql
1047 create mode 100644 deploy/insert_list.sql
1048 create mode 100644 deploy/lists.sql
1049 create mode 100644 revert/delete_list.sql
1050 create mode 100644 revert/insert_list.sql
1051 create mode 100644 revert/lists.sql
8c7220c @theory Change "test" to "verify".
authored Nov 30, 2012
1052 create mode 100644 verify/delete_list.sql
1053 create mode 100644 verify/insert_list.sql
1054 create mode 100644 verify/lists.sql
4d27feb @theory Add merge conflict example.
authored Apr 11, 2012
1055
1056 Hrm, that's interesting. Looks like someone made some changes to C<master>.
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
1057 They added list support. Well, let's see what happens when we merge our
1058 changes.
4d27feb @theory Add merge conflict example.
authored Apr 11, 2012
1059
1060 > git merge --no-ff flips
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
1061 Auto-merging sqitch.plan
1062 CONFLICT (content): Merge conflict in sqitch.plan
1063 Automatic merge failed; fix conflicts and then commit the result.
1064
1065 Oh, a conflict in F<sqitch.plan>. Not too surprising, since both the merged
1066 C<lists> branch and our C<flips> branch added changes to the plan. Let's try a
1067 different approach.
4d27feb @theory Add merge conflict example.
authored Apr 11, 2012
1068
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
1069 The truth is, we got lazy. Those changes when we pulled master from the origin
d3844fc @theory Finish updating the tutorial.
authored Jan 3, 2013
1070 should have raised a red flag. It's considered a bad practice not to look at
1071 what's changed in C<master> before merging in a branch. What one I<should> do
1072 is either:
4d27feb @theory Add merge conflict example.
authored Apr 11, 2012
1073
1074 =over
1075
1076 =item *
1077
d3844fc @theory Finish updating the tutorial.
authored Jan 3, 2013
1078 Rebase the F<flips> branch from master before merging. This "rewinds" the
1079 branch changes, pulls from C<master>, and then replays the changes back on top
991012f @theory I kant spel.
authored Jan 3, 2013
1080 of the pulled changes.
4d27feb @theory Add merge conflict example.
authored Apr 11, 2012
1081
1082 =item *
1083
1084 Create a patch and apply I<that> to master. This is the sort of thing you
1085 might have to do if you're sending changes to another user, especially if the
1086 VCS is not Git.
1087
1088 =back
1089
1090 So let's restore things to how they were at master:
1091
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
1092 > git reset --hard HEAD
d3844fc @theory Finish updating the tutorial.
authored Jan 3, 2013
1093 HEAD is now at ff60b9b Merge branch 'lists'
4d27feb @theory Add merge conflict example.
authored Apr 11, 2012
1094
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
1095 That throws out our botched merge. Now let's go back to our branch and rebase
1096 it on C<master>:
4d27feb @theory Add merge conflict example.
authored Apr 11, 2012
1097
1098 > git checkout flips
fc65ed2 @theory Add branch merging sections to the SQLite tutorial.
authored Apr 5, 2013
1099 Switched to branch 'flips'
4d27feb @theory Add merge conflict example.
authored Apr 11, 2012
1100 > git rebase master
1101 First, rewinding head to replay your work on top of it...
2763a89 @theory Update tutorial through merge conflict.
authored Aug 17, 2012
1102 Applying: Add flips table.
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
1103 Using index info to reconstruct a base tree...
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
1104 M sqitch.plan
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
1105 Falling back to patching base and 3-way merge...
1106 Auto-merging sqitch.plan
1107 CONFLICT (content): Merge conflict in sqitch.plan
1108 Failed to merge in the changes.
2763a89 @theory Update tutorial through merge conflict.
authored Aug 17, 2012
1109 Patch failed at 0001 Add flips table.
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
1110 The copy of the patch that failed is found in:
1111 .git/rebase-apply/patch
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
1112
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
1113 When you have resolved this problem, run "git rebase --continue".
1114 If you prefer to skip this patch, run "git rebase --skip" instead.
1115 To check out the original branch and stop rebasing, run "git rebase --abort".
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
1116
1117 Oy, that's kind of a pain. It seems like no matter what we do, we'll need to
d3844fc @theory Finish updating the tutorial.
authored Jan 3, 2013
1118 resolve conflicts in that file. Except in Git. Fortunately for us, we can tell
1119 Git to resolve conflicts in F<sqitch.plan> differently. Because we only ever
1120 append lines to the file, we can have it use the "union" merge driver, which,
1121 according to L<its
1122 docs|http://git-scm.com/docs/gitattributes#_built-in_merge_drivers>:
4d27feb @theory Add merge conflict example.
authored Apr 11, 2012
1123
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
1124 =over
4d27feb @theory Add merge conflict example.
authored Apr 11, 2012
1125
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
1126 Run 3-way file level merge for text files, but take lines from both versions,
1127 instead of leaving conflict markers. This tends to leave the added lines in
1128 the resulting file in random order and the user should verify the result. Do
1129 not use this if you do not understand the implications.
3f66ce0 @theory Handle merge ordering issue.
authored Apr 11, 2012
1130
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
1131 =back
3f66ce0 @theory Handle merge ordering issue.
authored Apr 11, 2012
1132
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
1133 This has the effect of appending lines from all the merging files, which is
1134 exactly what we need. So let's give it a try. First, back out the botched
1135 rebase:
3f66ce0 @theory Handle merge ordering issue.
authored Apr 11, 2012
1136
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
1137 > git rebase --abort
3f66ce0 @theory Handle merge ordering issue.
authored Apr 11, 2012
1138
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
1139 Now add the union merge driver to F<.gitattributes> for F<sqitch.plan>
1140 and rebase again:
3f66ce0 @theory Handle merge ordering issue.
authored Apr 11, 2012
1141
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
1142 > echo sqitch.plan merge=union > .gitattributes
1143 > git rebase master
1144 First, rewinding head to replay your work on top of it...
2763a89 @theory Update tutorial through merge conflict.
authored Aug 17, 2012
1145 Applying: Add flips table.
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
1146 Using index info to reconstruct a base tree...
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
1147 M sqitch.plan
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
1148 Falling back to patching base and 3-way merge...
1149 Auto-merging sqitch.plan
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
1150 Applying: Add functions to insert and delete flips.
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
1151 Using index info to reconstruct a base tree...
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
1152 M sqitch.plan
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
1153 Falling back to patching base and 3-way merge...
1154 Auto-merging sqitch.plan
3f66ce0 @theory Handle merge ordering issue.
authored Apr 11, 2012
1155
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
1156 Ah, that looks a bit better. Let's have a look at the plan:
1157
3eec3ab @dredozubov Replace inappropriate ROLLBACKS in tutorials.
dredozubov authored Oct 16, 2015
1158 > cat sqitch.plan
387b22c @theory Update the plan version in the tutorials.
authored Nov 13, 2014
1159 %syntax-version=1.0.0
ac4145b @theory More updates to `sqitchtutorial.pod`.
authored Aug 1, 2012
1160 %project=flipr
1161 %uri=https://github.com/theory/sqitch-intro/
3f66ce0 @theory Handle merge ordering issue.
authored Apr 11, 2012
1162
387b22c @theory Update the plan version in the tutorials.
authored Nov 13, 2014
1163 %syntax-version=1.0.0
26d4c87 @theory Update the PostgreSQL tutorial with targets.
authored Dec 31, 2013
1164 %project=flipr
1165 %uri=https://github.com/theory/sqitch-intro/
1166
1167 appschema 2013-12-30T23:19:45Z Marge N. O’Vera <marge@example.com> # Add schema for all flipr objects.
1168 users [appschema] 2013-12-30T23:49:00Z Marge N. O’Vera <marge@example.com> # Creates table to track our users.
1169 insert_user [users appschema] 2013-12-30T23:57:36Z Marge N. O’Vera <marge@example.com> # Creates a function to insert a user.
1170 change_pass [users appschema] 2013-12-30T23:57:45Z Marge N. O’Vera <marge@example.com> # Creates a function to change a user password.
1171 @v1.0.0-dev1 2013-12-31T00:01:22Z Marge N. O’Vera <marge@example.com> # Tag v1.0.0-dev1.
fc0ae52 @theory Add `rework` docs and rework `sqitchtutorial`.
authored Jun 29, 2012
1172
26d4c87 @theory Update the PostgreSQL tutorial with targets.