Skip to content

Commit

Permalink
Add target section
Browse files Browse the repository at this point in the history
And quote URIs with question marks in shell examples.
  • Loading branch information
theory committed Jul 25, 2018
1 parent f137c66 commit 7c95830
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 37 deletions.
26 changes: 13 additions & 13 deletions lib/sqitchtutorial-exasol.pod
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ via a L<database URI|https://github.com/libwww-perl/uri-db/>, assuming the defau
C<sys> user and an ODBC driver named C<Exasol> (see
L</Connection Configuration> for details):

> sqitch deploy db:exasol://sys:exasol@localhost:8563/?Driver=Exasol
> sqitch deploy 'db:exasol://sys:exasol@localhost:8563/?Driver=Exasol'
Adding registry tables to db:exasol://sys:@localhost:8563/?Driver=Exasol
Deploying changes to db:exasol://sys:@localhost:8563/?Driver=Exasol
+ appschema .. ok
Expand Down Expand Up @@ -254,7 +254,7 @@ not exist, you could do something like this:
Either way, run the C<verify> script with the L<C<verify>|sqitch-verify>
command:

> sqitch verify db:exasol://sys:exasol@localhost:8563/?Driver=Exasol
> sqitch verify 'db:exasol://sys:exasol@localhost:8563/?Driver=Exasol'
Verifying db:exasol://sys:@localhost:8563/?Driver=Exasol
* appschema .. ok
Verify successful
Expand All @@ -267,7 +267,7 @@ something that doesn't exist, something like:

Then L<C<verify>|sqitch-verify> again:

> sqitch verify db:exasol://sys:exasol@localhost:8563/?Driver=Exasol
> sqitch verify 'db:exasol://sys:exasol@localhost:8563/?Driver=Exasol'
Verifying db:exasol://sys:@localhost:8563/?Driver=Exasol
* appschema .. Error: [42000] schema NONESUCH not found [line 1, column 40] (Session: 1582884049218108749)

Expand All @@ -287,7 +287,7 @@ divide-by-zero example, change the schema name:

Then the verify will look something like:

> sqitch verify db:exasol://sys:exasol@localhost:8563/?Driver=Exasol
> sqitch verify 'db:exasol://sys:exasol@localhost:8563/?Driver=Exasol'
Verifying db:exasol://sys:@localhost:8563/?Driver=Exasol
* appschema .. Error: [22012] data exception - division by zero (Session: 1582884446489810101)

Expand All @@ -311,7 +311,7 @@ For purely informational purposes, we can always see how a deployment was
recorded via the L<C<status>|sqitch-status> command, which reads the registry
tables from the database:

> sqitch status db:exasol://sys:exasol@localhost:8563/?Driver=Exasol
> sqitch status 'db:exasol://sys:exasol@localhost:8563/?Driver=Exasol'
# On database db:exasol://sys:@localhost:8563/?Driver=Exasol
# Project: flipr
# Change: f9759f0ed77964b6a3b6c7aa3b6058b4bb7db764
Expand All @@ -323,7 +323,7 @@ tables from the database:

Let's make sure that we can revert the change:

> sqitch revert db:exasol://sys:exasol@localhost:8563/?Driver=Exasol
> sqitch revert 'db:exasol://sys:exasol@localhost:8563/?Driver=Exasol'
Revert all changes from db:exasol://sys:@localhost:8563/?Driver=Exasol? [Yes]
- appschema .. ok

Expand All @@ -341,21 +341,21 @@ I<removed> from the database. And now the schema should be gone:

And the status message should reflect as much:

> sqitch status db:exasol://sys:exasol@localhost:8563/?Driver=Exasol
> sqitch status 'db:exasol://sys:exasol@localhost:8563/?Driver=Exasol'
# On database db:exasol://sys:@localhost:8563/?Driver=Exasol
No changes deployed

Of course, since nothing is deployed, the L<C<verify>|sqitch-verify> command
has nothing to verify:

> sqitch verify db:exasol://sys:exasol@localhost:8563/?Driver=Exasol
> sqitch verify 'db:exasol://sys:exasol@localhost:8563/?Driver=Exasol'
Verifying db:exasol://sys:@localhost:8563/?Driver=Exasol
No changes deployed

However, we still have a record that the change happened, visible via the
L<C<log>|sqitch-log> command:

> sqitch log db:exasol://sys:exasol@localhost:8563/?Driver=Exasol
> sqitch log 'db:exasol://sys:exasol@localhost:8563/?Driver=Exasol'
On database db:exasol://sys:@localhost:8563/?Driver=Exasol
Revert f9759f0ed77964b6a3b6c7aa3b6058b4bb7db764
Name: appschema
Expand Down Expand Up @@ -388,7 +388,7 @@ Cool. Now let's commit it.
And then deploy again. This time, let's use the C<--verify> option, so that
the C<verify> script is applied when the change is deployed:

> sqitch deploy --verify db:exasol://sys:exasol@localhost:8563/?Driver=Exasol
> sqitch deploy --verify 'db:exasol://sys:exasol@localhost:8563/?Driver=Exasol'
Deploying changes to db:exasol://sys:@localhost:8563/?Driver=Exasol
+ appschema .. ok

Expand All @@ -403,7 +403,7 @@ And now the schema should be back:

When we look at the status, the deployment will be there:

> sqitch status db:exasol://sys:exasol@localhost:8563/?Driver=Exasol
> sqitch status 'db:exasol://sys:exasol@localhost:8563/?Driver=Exasol'
# On database db:exasol://sys:@localhost:8563/?Driver=Exasol
# Project: flipr
# Change: fef4c2911ae68aee8f6ea164293a32923dc13b67
Expand All @@ -421,7 +421,7 @@ you? This L<database connection URI|https://github.com/libwww-perl/uri-db/> tell
Sqitch how to connect to the deployment target, but we don't have to keep
using the URI. We can name the target:

> sqitch target add flipr_test db:exasol://sys:exasol@localhost:8563/?Driver=Exasol
> sqitch target add flipr_test 'db:exasol://sys:exasol@localhost:8563/?Driver=Exasol'

The L<C<target>|sqitch-target> command, inspired by
L<C<git-remote>|http://git-scm.com/docs/git-remote>, allows management of one
Expand Down Expand Up @@ -871,7 +871,7 @@ different port:
Now you should be able to deploy to the new database:

> cd bundle
> sqitch deploy db:exasol://sys:exasol@localhost:9999/?Driver=Exasol
> sqitch deploy 'db:exasol://sys:exasol@localhost:9999/?Driver=Exasol'
Adding registry tables to db:exasol://sys:@localhost:9999/?Driver=Exasol
Deploying changes to db:exasol://sys:@localhost:9999/?Driver=Exasol
+ appschema ............... ok
Expand Down
68 changes: 57 additions & 11 deletions lib/sqitchtutorial-snowflake.pod
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ L<F<.snowsql/config> file|https://docs.snowflake.net/manuals/user-guide/snowsql-

We just tell Sqitch to use that URI to deploy the change:

> sqitch deploy db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch
> sqitch deploy 'db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch'
Adding registry tables to db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch
Deploying changes to db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch
+ appschema .. ok
Expand Down Expand Up @@ -252,7 +252,7 @@ variable for all deploy, revert, and verify script executions.

Now run the C<verify> script with the L<C<verify>|sqitch-verify> command:

> sqitch verify db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch
> sqitch verify 'db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch'
Verifying db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch
* appschema .. ok
Verify successful
Expand All @@ -265,7 +265,7 @@ something that doesn't exist, something like:

Then L<C<verify>|sqitch-verify> again:

> sqitch verify db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch
> sqitch verify 'db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch'
Verifying db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch
* appschema ..
002003 (02000): SQL compilation error:
Expand All @@ -287,7 +287,7 @@ divide-by-zero example, change the schema name:

Then the verify will look something like:

> sqitch verify db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch
> sqitch verify 'db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch'
Verifying db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch
* appschema ..
100051 (22012): Division by zero
Expand All @@ -311,7 +311,7 @@ For purely informational purposes, we can always see how a deployment was
recorded via the L<C<status>|sqitch-status> command, which reads the registry
tables from the database:

> sqitch status db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch
> sqitch status 'db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch'
# On database db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch
# Project: flipr
# Change: 72ff6480c94724d772dae4136420e807688badb8
Expand All @@ -323,7 +323,7 @@ tables from the database:

Let's make sure that we can revert the change:

> sqitch revert db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch
> sqitch revert 'db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch'
Revert all changes from db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch? [Yes]
- appschema .. ok

Expand All @@ -345,21 +345,21 @@ I<removed> from the database. And now the schema should be gone:

And the status message should reflect as much:

> sqitch status db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch
> sqitch status 'db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch'
# On database db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch
No changes deployed

Of course, since nothing is deployed, the L<C<verify>|sqitch-verify> command
has nothing to verify:

> sqitch verify db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch
> sqitch verify 'db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch'
Verifying db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch
No changes deployed

However, we still have a record that the change happened, visible via the
L<C<log>|sqitch-log> command:

> sqitch log db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch
> sqitch log 'db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch'
On database db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch
Revert 72ff6480c94724d772dae4136420e807688badb8
Name: appschema
Expand Down Expand Up @@ -391,7 +391,7 @@ Cool. Now let's commit it.
And then deploy again. This time, let's use the C<--verify> option, so that
the C<verify> script is applied when the change is deployed:

> sqitch deploy --verify db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch
> sqitch deploy --verify 'db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch'
Deploying changes to db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch
+ appschema .. ok

Expand All @@ -410,7 +410,7 @@ And now the schema should be back:

When we look at the status, the deployment will be there:

> sqitch status db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch
> sqitch status 'db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch'
# On database db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch
# Project: flipr
# Change: 72ff6480c94724d772dae4136420e807688badb8
Expand All @@ -420,6 +420,52 @@ When we look at the status, the deployment will be there:
#
Nothing to deploy (up-to-date)

=head1 On Target

I'm getting a little tired of always having to type
C<db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch>, aren't you?
This L<database connection URI|https://github.com/libwww-perl/uri-db/> tells
Sqitch how to connect to the deployment target, but we don't have to keep
using the URI. We can name the target:

> sqitch target add flipr_test 'db:snowflake://movera@example/flipr?Driver=Snowflake;warehouse=sqitch'

The L<C<target>|sqitch-target> command, inspired by
L<C<git-remote>|http://git-scm.com/docs/git-remote>, allows management of one
or more named deployment targets. We've just added a target named
C<flipr_test>, which means we can use the string C<flipr_test> for the target,
rather than the URI. But since we're doing so much testing, we can also tell
Sqitch to deploy to the C<flipr_test> target by default:

> sqitch engine add snowflake flipr_test

Now we can omit the target argument altogether, unless we need to deploy to
another database. Which we will, eventually, but at least our examples will be
simpler from here on in, e.g.:

> sqitch status
# On database flipr_test
# Project: flipr
# Change: 72ff6480c94724d772dae4136420e807688badb8
# Name: appschema
# Deployed: 2018-07-25 17:35:46 -0400
# By: Marge N. O’Vera <marge@example.com>
#
Nothing to deploy (up-to-date)

Yay, that allows things to be a little more concise. Let's also make sure that
changes are verified after deploying them:

> sqitch config --bool deploy.verify true
> sqitch config --bool rebase.verify true

We'll see the L<C<rebase>|sqitch-rebase> command a bit later. In the meantime,
let's commit the new configuration and and make some more changes!

> git commit -am 'Set default deployment target and always verify.'
[master 09f7f5c] Set default deployment target and always verify.
1 files changed, 8 insertions(+), 0 deletions(-)

=head1 More to Come

Sqitch is a work in progress. Better integration with version control systems
Expand Down
26 changes: 13 additions & 13 deletions lib/sqitchtutorial-vertica.pod
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ via a L<database URI|https://github.com/libwww-perl/uri-db/>, assuming the defau
C<dbadmin> database and user and an ODBC driver named C<Vertica> (see
L</Connection Configuration> for details):

> sqitch deploy db:vertica://dbadmin:password@localhost:5433/dbadmin?Driver=Vertica
> sqitch deploy 'db:vertica://dbadmin:password@localhost:5433/dbadmin?Driver=Vertica'
Adding registry tables to db:vertica://dbadmin:@localhost:5433/dbadmin?Driver=Vertica
Deploying changes to db:vertica://dbadmin:@localhost:5433/dbadmin?Driver=Vertica
+ appschema .. ok
Expand Down Expand Up @@ -250,7 +250,7 @@ not exist, you could do something like this:
Either way, run the C<verify> script with the L<C<verify>|sqitch-verify>
command:

> sqitch verify db:vertica://dbadmin:password@localhost:5433/dbadmin?Driver=Vertica
> sqitch verify 'db:vertica://dbadmin:password@localhost:5433/dbadmin?Driver=Vertica'
Verifying db:vertica://dbadmin:@localhost:5433/dbadmin?Driver=Vertica
* appschema .. ok
Verify successful
Expand All @@ -263,7 +263,7 @@ something that doesn't exist, something like:

Then L<C<verify>|sqitch-verify> again:

> sqitch verify db:vertica://dbadmin:password@localhost:5433/dbadmin?Driver=Vertica
> sqitch verify 'db:vertica://dbadmin:password@localhost:5433/dbadmin?Driver=Vertica'
Verifying db:vertica://dbadmin:@localhost:5433/dbadmin?Driver=Vertica
* appschema .. vsql:verify/appschema.sql:5: ROLLBACK 4650: Schema "nonesuch" does not exist
# Verify script "verify/appschema.sql" failed.
Expand All @@ -282,7 +282,7 @@ divide-by-zero example, change the schema name:

Then the verify will look something like:

> sqitch verify db:vertica://dbadmin:password@localhost:5433/dbadmin?Driver=Vertica
> sqitch verify 'db:vertica://dbadmin:password@localhost:5433/dbadmin?Driver=Vertica'
Verifying db:vertica://dbadmin:@localhost:5433/dbadmin?Driver=Vertica
* appschema .. vsql:verify/appschema.sql:5: ERROR 2005: division by zero
# Verify script "verify/appschema.sql" failed.
Expand All @@ -305,7 +305,7 @@ For purely informational purposes, we can always see how a deployment was
recorded via the L<C<status>|sqitch-status> command, which reads the registry
tables from the database:

> sqitch status db:vertica://dbadmin:password@localhost:5433/dbadmin?Driver=Vertica
> sqitch status 'db:vertica://dbadmin:password@localhost:5433/dbadmin?Driver=Vertica'
# On database db:vertica://dbadmin:@localhost:5433/dbadmin?Driver=Vertica
# Project: flipr
# Change: f9759f0ed77964b6a3b6c7aa3b6058b4bb7db764
Expand All @@ -317,7 +317,7 @@ tables from the database:

Let's make sure that we can revert the change:

> sqitch revert db:vertica://dbadmin:password@localhost:5433/dbadmin?Driver=Vertica
> sqitch revert 'db:vertica://dbadmin:password@localhost:5433/dbadmin?Driver=Vertica'
Revert all changes from db:vertica://dbadmin:@localhost:5433/dbadmin?Driver=Vertica? [Yes]
- appschema .. ok

Expand All @@ -335,21 +335,21 @@ I<removed> from the database. And now the schema should be gone:

And the status message should reflect as much:

> sqitch status db:vertica://dbadmin:password@localhost:5433/dbadmin?Driver=Vertica
> sqitch status 'db:vertica://dbadmin:password@localhost:5433/dbadmin?Driver=Vertica'
# On database db:vertica://dbadmin:@localhost:5433/dbadmin?Driver=Vertica
No changes deployed

Of course, since nothing is deployed, the L<C<verify>|sqitch-verify> command
has nothing to verify:

> sqitch verify db:vertica://dbadmin:password@localhost:5433/dbadmin?Driver=Vertica
> sqitch verify 'db:vertica://dbadmin:password@localhost:5433/dbadmin?Driver=Vertica'
Verifying db:vertica://dbadmin:@localhost:5433/dbadmin?Driver=Vertica
No changes deployed

However, we still have a record that the change happened, visible via the
L<C<log>|sqitch-log> command:

> sqitch log db:vertica://dbadmin:password@localhost:5433/dbadmin?Driver=Vertica
> sqitch log 'db:vertica://dbadmin:password@localhost:5433/dbadmin?Driver=Vertica'
On database db:vertica://dbadmin:@localhost:5433/dbadmin?Driver=Vertica
Revert f9759f0ed77964b6a3b6c7aa3b6058b4bb7db764
Name: appschema
Expand Down Expand Up @@ -382,7 +382,7 @@ Cool. Now let's commit it.
And then deploy again. This time, let's use the C<--verify> option, so that
the C<verify> script is applied when the change is deployed:

> sqitch deploy --verify db:vertica://dbadmin:password@localhost:5433/dbadmin?Driver=Vertica
> sqitch deploy --verify 'db:vertica://dbadmin:password@localhost:5433/dbadmin?Driver=Vertica'
Deploying changes to db:vertica://dbadmin:@localhost:5433/dbadmin?Driver=Vertica
+ appschema .. ok

Expand All @@ -396,7 +396,7 @@ And now the schema should be back:

When we look at the status, the deployment will be there:

> sqitch status db:vertica://dbadmin:password@localhost:5433/dbadmin?Driver=Vertica
> sqitch status 'db:vertica://dbadmin:password@localhost:5433/dbadmin?Driver=Vertica'
# On database db:vertica://dbadmin:@localhost:5433/dbadmin?Driver=Vertica
# Project: flipr
# Change: f9759f0ed77964b6a3b6c7aa3b6058b4bb7db764
Expand All @@ -409,12 +409,12 @@ When we look at the status, the deployment will be there:
=head1 On Target

I'm getting a little tired of always having to type
C<db:vertica://dbadmin:password@localhost:5433/dbadmin?Driver=Vertica>, aren't
C<'db:vertica://dbadmin:password@localhost:5433/dbadmin?Driver=Vertica'>, aren't
you? This L<database connection URI|https://github.com/libwww-perl/uri-db/> tells
Sqitch how to connect to the deployment target, but we don't have to keep
using the URI. We can name the target:

> sqitch target add flipr_test db:vertica://dbadmin:password@localhost:5433/dbadmin?Driver=Vertica
> sqitch target add flipr_test 'db:vertica://dbadmin:password@localhost:5433/dbadmin?Driver=Vertica'

The L<C<target>|sqitch-target> command, inspired by
L<C<git-remote>|http://git-scm.com/docs/git-remote>, allows management of one
Expand Down

0 comments on commit 7c95830

Please sign in to comment.