Skip to content

Commit

Permalink
Merge pull request #142 from doelleri/docs-formatting
Browse files Browse the repository at this point in the history
Minor improvements and fixes to asciidoc formatting
  • Loading branch information
puneetbehl authored Aug 27, 2018
2 parents 75fb112 + 99c840c commit 66db7b7
Show file tree
Hide file tree
Showing 38 changed files with 96 additions and 112 deletions.
2 changes: 1 addition & 1 deletion src/docs/asciidoc/configuration.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ There are a few configuration options for the plugin. All configurations are pre
|databaseChangeLogLockTableName |'databasechangeloglock' |the Liquibase lock table name
|==================================

NOTE: All of the above configs can be used for a multiple datasources
NOTE: All of the above configs can be used for multiple datasources


*Multiple DataSource Example:*
Expand Down
2 changes: 1 addition & 1 deletion src/docs/asciidoc/generalUsage.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ To create the changelog additions, you can either manually create the changes or
You have a few options with `dbm-gorm-diff`:

* `dbm-gorm-diff` will dump to the console if no filename is specified, so you can copy/paste from there
* if you include the `--add` parameter when running the script with a filename it will register an include for the the filename in the main changelog for you
* if you include the `--add` parameter when running the script with a filename it will register an include for the filename in the main changelog for you
Regardless of which approach you use, be sure to inspect generated changes and adjust as necessary.

Expand Down
2 changes: 1 addition & 1 deletion src/docs/asciidoc/gorm.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ So a good workflow would be:
*dbm-generate-gorm-changelog*

The <<ref-rollback-scripts-dbm-generate-gorm-changelog,dbm-generate-gorm-changelog>> script is useful for when you want to switch from `create-drop` mode to doing proper migrations. It's not very useful if you already have a database that's in sync with your code, since you can just use the <<ref-rollback-scripts-dbm-generate-changelog,dbm-generate-changelog>> script that creates a changelog from your database.
The <<ref-rollback-scripts-dbm-generate-gorm-changelog,dbm-generate-gorm-changelog>> script is useful for when you want to switch from `create-drop` mode to doing proper migrations. It's not very useful if you already have a database that's in sync with your code, since you can just use the <<ref-rollback-scripts-dbm-generate-changelog,dbm-generate-changelog>> script that creates a changelog from your database.
32 changes: 13 additions & 19 deletions src/docs/asciidoc/groovyChanges.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -53,40 +53,34 @@ databaseChangeLog = {
=== Available variables

These variables are available throughout the change closure:
* `changeSet`
** the current Liquibase `ChangeSet` instance
* `resourceAccessor`
** the current Liquibase `ResourceAccessor` instance
* `ctx`
** the Spring `ApplicationContext`
* `application`
** the `GrailsApplication`

* `changeSet` - the current Liquibase `ChangeSet` instance
* `resourceAccessor` - the current Liquibase `ResourceAccessor` instance
* `ctx` - the Spring `ApplicationContext`
* `application` - the `GrailsApplication`

The `change` and `rollback` closures also have the following available:
* `database`
** the current Liquibase `Database` instance
* `databaseConnection`
** the current Liquibase `DatabaseConnection` instance, which is a wrapper around the JDBC `Connection` (but doesn't implement the `Connection` interface)
* `connection`
** the real JDBC `Connection` instance (a shortcut for `database.connection.wrappedConnection`)
* `sql`
** a `groovy.sql.Sql` instance which uses the current `connection` and can be used for arbitrary queries and updates

* `database` - the current Liquibase `Database` instance
* `databaseConnection` - the current Liquibase `DatabaseConnection` instance, which is a wrapper around the JDBC `Connection` (but doesn't implement the `Connection` interface)
* `connection` - the real JDBC `Connection` instance (a shortcut for `database.connection.wrappedConnection`)
* `sql` - a `groovy.sql.Sql` instance which uses the current `connection` and can be used for arbitrary queries and updates

*init*

This is where any optional initialization should happen. You can't access the database from this closure.

*validate*

If there are any necessary validation checks before executing changes or rollbacks they should be done here. You can log warnings by calling `warn(String message)` and stop processing by calling `error(String message)`. It may make more sense to use one or more `preCondition`s instead of directly validating here.
If there are any necessary validation checks before executing changes or rollbacks they should be done here. You can log warnings by calling `warn(String message)` and stop processing by calling `error(String message)`. It may make more sense to use one or more ++preCondition++s instead of directly validating here.

*change*

All migration changes are done in the `change` closure. You can make changes directly (using the `sql` instance or the `connection`) and/or return one or more `SqlStatement`s. You can call `sqlStatement(SqlStatement statement)` multiple times to register instances to be run. You can also call the `sqlStatements(statements)` method with an array or list of instances to be run.
All migration changes are done in the `change` closure. You can make changes directly (using the `sql` instance or the `connection`) and/or return one or more ++SqlStatement++s. You can call `sqlStatement(SqlStatement statement)` multiple times to register instances to be run. You can also call the `sqlStatements(statements)` method with an array or list of instances to be run.

*rollback*

All rollback changes are done in the `rollback` closure. You can make changes directly (using the `sql` instance or the `connection`) and/or return one or more `SqlStatement`s. You can call `sqlStatement(SqlStatement statement)` multiple times to register instances to be run. You can also call the `sqlStatements(statements)` method with an array or list of instances to be run.
All rollback changes are done in the `rollback` closure. You can make changes directly (using the `sql` instance or the `connection`) and/or return one or more ++SqlStatement++s. You can call `sqlStatement(SqlStatement statement)` multiple times to register instances to be run. You can also call the `sqlStatements(statements)` method with an array or list of instances to be run.

*confirm*

Expand Down
36 changes: 13 additions & 23 deletions src/docs/asciidoc/groovyPreconditions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ In addition to the built-in Liquibase preconditions (see http://www.liquibase.or

=== General format

This is general format of a Groovy-based precondition:
This is the general format of a Groovy-based precondition:

[source,groovy]
----
Expand Down Expand Up @@ -43,36 +43,26 @@ databaseChangeLog = {
----

As you can see there are a few ways to indicate that a precondition wasn't met:

* use a simple assertion
* use an assertion with a message
* call the `fail(String message)` method (throws a `PreconditionFailedException`)
* throw an exception (shouldn't be necessary - use `assert` or `fail()` instead)

=== Available variables

* `database`
** the current Liquibase `Database` instance
* `databaseConnection`
** the current Liquibase `DatabaseConnection` instance, which is a wrapper around the JDBC `Connection` (but doesn't implement the `Connection` interface)
* `connection`
** the real JDBC `Connection` instance (a shortcut for `database.connection.wrappedConnection`)
* `sql`
** a `groovy.sql.Sql` instance which uses the current `connection` and can be used for arbitrary queries and updates
* `resourceAccessor`
** the current Liquibase `ResourceAccessor` instance
* `ctx`
** the Spring `ApplicationContext`
* `application`
** the `GrailsApplication`
* `changeSet`
** the current Liquibase `ChangeSet` instance
* `changeLog`
** the current Liquibase `DatabaseChangeLog` instance
* `database` - the current Liquibase `Database` instance
* `databaseConnection` - the current Liquibase `DatabaseConnection` instance, which is a wrapper around the JDBC `Connection` (but doesn't implement the `Connection` interface)
* `connection` - the real JDBC `Connection` instance (a shortcut for `database.connection.wrappedConnection`)
* `sql` - a `groovy.sql.Sql` instance which uses the current `connection` and can be used for arbitrary queries and updates
* `resourceAccessor` - the current Liquibase `ResourceAccessor` instance
* `ctx` - the Spring `ApplicationContext`
* `application` - the `GrailsApplication`
* `changeSet` - the current Liquibase `ChangeSet` instance
* `changeLog` - the current Liquibase `DatabaseChangeLog` instance

=== Utility methods

* `createDatabaseSnapshotGenerator()`
** retrieves the `DatabaseSnapshotGenerator` for the current `Database`
* `createDatabaseSnapshot(String schemaName = null)`
** creates a `DatabaseSnapshot` for the current `Database` (and schema if specified)
* `createDatabaseSnapshotGenerator()` - retrieves the `DatabaseSnapshotGenerator` for the current `Database`
* `createDatabaseSnapshot(String schemaName = null)` - creates a `DatabaseSnapshot` for the current `Database` (and schema if specified)

2 changes: 1 addition & 1 deletion src/docs/asciidoc/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,4 @@ include::ref/Update Scripts/dbm-update-count.adoc[]
include::ref/Update Scripts/dbm-update-sql.adoc[]

[[ref-update-scripts-dbm-update]]
include::ref/Update Scripts/dbm-update.adoc[]
include::ref/Update Scripts/dbm-update.adoc[]
8 changes: 4 additions & 4 deletions src/docs/asciidoc/ref/Diff Scripts/dbm-diff.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Compares two databases and creates a changelog that will make the changes requir

Executes against the database configured in `application.[yml|groovy]` for the current environment (defaults to `dev`) and another configured datasource in `application.[yml|groovy]`.

If a filename parameter is specified then the output will be written to the named file, otherwise it will write to the console. If the filename ends with .groovy a Groovy DSL file will be created, otherwise a standard XML file will be created.
If a filename parameter is specified then the output will be written to the named file, otherwise it will be written to the console. If the filename ends with .groovy a Groovy DSL file will be created, otherwise a standard XML file will be created.

File are written to the migrations folder, so specify the filename relative to the migrations folder (`grails-app/migrations` by default).

Expand All @@ -26,16 +26,16 @@ Optional arguments:

* `filename` - The path to the output file to write to. If not specified output is written to the console
* `defaultSchema` - The default schema name to use
* `add` - if specified add an include in the root changelog file referencing the new file
* `dataSource` - if provided will run the script for the specified dataSource. Not needed for the default dataSource.
* `add` - If specified add an include in the root changelog file referencing the new file
* `dataSource` - If provided will run the script for the specified dataSource. Not needed for the default dataSource.

NOTE: Note that the `defaultSchema` and `dataSource` parameter name and value must be quoted if executed in Windows, e.g.
[source,groovy]
----
grails dbm-diff "--defaultSchema=<<defaultSchema>>" "--dataSource=<<dataSource>>"
----

NOTE: For the `dataSource` parameter; If the data source is configured as `reports` underneath the `dataSources` key in `application.[yml|groovy]`, the value should be `reports`.
NOTE: For the `dataSource` parameter, if the data source is configured as `reports` underneath the `dataSources` key in `application.[yml|groovy]`, the value should be `reports`.

[source,groovy]
----
Expand Down
2 changes: 1 addition & 1 deletion src/docs/asciidoc/ref/Diff Scripts/dbm-gorm-diff.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ NOTE: Note that the `defaultSchema` and `dataSource` parameter name and value mu
grails dbm-gorm-diff "--defaultSchema=<<defaultSchema>>" "--dataSource=<<dataSource>>"
----

NOTE: For the `dataSource` parameter; If the data source is configured as `reports` underneath the `dataSources` key in `application.[yml|groovy]`, the value should be `reports`.
NOTE: For the `dataSource` parameter, if the data source is configured as `reports` underneath the `dataSources` key in `application.[yml|groovy]`, the value should be `reports`.

[source,groovy]
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ NOTE: Note that the `contexts` and `dataSource` parameter name and value must be
grails dbm-db-doc "--contexts=<<contexts>>" "--dataSource=<<dataSource>>"
----

NOTE: For the `dataSource` parameter; If the data source is configured as `reports` underneath the `dataSources` key in `application.[yml|groovy]`, the value should be `reports`.
NOTE: For the `dataSource` parameter, if the data source is configured as `reports` underneath the `dataSources` key in `application.[yml|groovy]`, the value should be `reports`.

[source,groovy]
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Adds a template migration file to your project and to the changelog file.
===== Description

This script provides a template in which to place your migration behaviour code, whether
grails code or raw SQL.
Grails code or raw SQL.

Usage:
[source,java]
Expand All @@ -19,4 +19,4 @@ Required arguments:

* `migrationName` - The name of the migration - will be used as a filename and the default migration id.

NOTE: This script only supports .groovy-style migrations at the moment.
NOTE: This script only supports .groovy-style migrations at the moment.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Usage:
grails <<environment>> dbm-changelog-sync-sql <<filename>> --contexts=<<contexts>> --defaultSchema=<<defaultSchema>> --dataSource=<<dataSource>>
----

Required arguments: _none_ .
Required arguments: __none__.

Optional arguments:

Expand All @@ -29,7 +29,7 @@ NOTE: Note that the `contexts`, `defaultSchema`, and `dataSource` parameter name
grails dbm-changelog-sync "--contexts=<<contexts>>" "--defaultSchema=<<defaultSchema>>" "--dataSource=<<dataSource>>"
----

NOTE: For the `dataSource` parameter if the data source is configured as `reports` underneath the `dataSources` key` in `application.[yml|groovy]`
NOTE: For the `dataSource` parameter if the data source is configured as `reports` underneath the `dataSources` key in `application.[yml|groovy]`
the suffix of `reports` will be used as the parameter value.
[source,groovy]
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,29 @@ Mark all changes as executed in the database.

===== Description

Registers all changesets as having been run in the Liquibase control table. This is useful when then changes have already been applied, for example if you've just created a changelog from your database using the <<ref-rollback-scripts-dbm-generate-changelog,dbm-generate-changelog>> script.
Registers all changesets as having been run in the Liquibase control table. This is useful when the changes have already been applied, for example if you've just created a changelog from your database using the <<ref-rollback-scripts-dbm-generate-changelog,dbm-generate-changelog>> script.

Usage:
[source,java]
----
grails <<environment>> dbm-changelog-sync --contexts=<<contexts>> --defaultSchema=<<defaultSchema>> --dataSource=<<dataSource>>
----

Required arguments: _none_ .
Required arguments: __none__.

Optional arguments:

* `contexts` - A comma-delimited list of http://www.liquibase.org/manual/contexts[context] names. If specified, only changesets tagged with one of the context names will be included
* `defaultSchema` - The default schema name to use
* `dataSource` - if provided will run the script for the specified dataSource. Not needed for the default dataSource.
* `dataSource` - If provided will run the script for the specified dataSource. Not needed for the default dataSource.

NOTE: Note that the `contexts`, `defaultSchema`, and `dataSource` parameter name and value must be quoted if executed in Windows, e.g.
[source,groovy]
----
grails dbm-changelog-sync "--contexts=<<contexts>>" "--defaultSchema=<<defaultSchema>>" "--dataSource=<<dataSource>>"
----

NOTE: For the `dataSource` parameter; If the data source is configured as `reports` underneath the `dataSources` key in `application.[yml|groovy]`, the value should be `reports`.
NOTE: For the `dataSource` parameter, if the data source is configured as `reports` underneath the `dataSources` key in `application.[yml|groovy]`, the value should be `reports`.

[source,groovy]
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ Required arguments:

Optional arguments:

* `groovy_file_name` - The name and path of the Groovy file
* `groovy_file_name` - The name and path of the Groovy file
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Usage:
grails <<environment>> dbm-clear-checksums --dataSource=<<dataSource>>
----

Required arguments: _none_ .
Required arguments: __none__.

Optional arguments:

Expand All @@ -24,7 +24,7 @@ NOTE: Note that the `dataSource` parameter name and value must be quoted if exec
grails dbm-clear-checksums "--dataSource=<<dataSource>>"
----

NOTE: For the `dataSource` parameter; If the data source is configured as `reports` underneath the `dataSources` key in `application.[yml|groovy]`, the value should be `reports`.
NOTE: For the `dataSource` parameter, if the data source is configured as `reports` underneath the `dataSources` key in `application.[yml|groovy]`, the value should be `reports`.

[source,groovy]
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ NOTE: Note that the `dataSource` parameter name and value must be quoted if exec
grails dbm-create-changelog "--dataSource=<<dataSource>>"
----

NOTE: For the `dataSource` parameter; If the data source is configured as `reports` underneath the `dataSources` key in `application.[yml|groovy]`, the value should be `reports`.
NOTE: For the `dataSource` parameter, if the data source is configured as `reports` underneath the `dataSources` key in `application.[yml|groovy]`, the value should be `reports`.

[source,groovy]
----
Expand Down
4 changes: 2 additions & 2 deletions src/docs/asciidoc/ref/Maintenance Scripts/dbm-drop-all.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Usage:
grails <<environment>> dbm-drop-all <<schemaNames>> --defaultSchema=<<defaultSchema>> --dataSource=<<dataSource>>
----

Required arguments: _none_ .
Required arguments: __none__.

Optional arguments:

Expand All @@ -26,7 +26,7 @@ NOTE: Note that the `defaultSchema` and `dataSource` parameter name and value mu
grails dbm-drop-all "--defaultSchema=<<defaultSchema>>" "--dataSource=<<dataSource>>"
----

NOTE: For the `dataSource` parameter; If the data source is configured as `reports` underneath the `dataSources` key in `application.[yml|groovy]`, the value should be `reports`.
NOTE: For the `dataSource` parameter, if the data source is configured as `reports` underneath the `dataSources` key in `application.[yml|groovy]`, the value should be `reports`.

[source,groovy]
----
Expand Down
4 changes: 2 additions & 2 deletions src/docs/asciidoc/ref/Maintenance Scripts/dbm-list-locks.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Usage:
grails <<environment>> dbm-list-locks <<filename>> --defaultSchema=<<defaultSchema>> --dataSource=<<dataSource>>
----

Required arguments: _none_ .
Required arguments: __none__.

Optional arguments:

Expand All @@ -26,7 +26,7 @@ NOTE: Note that the `defaultSchema` and `dataSource` parameter name and value mu
grails dbm-list-locks "--defaultSchema=<<defaultSchema>>" "--dataSource=<<dataSource>>"
----

NOTE: For the `dataSource` parameter; If the data source is configured as `reports` underneath the `dataSources` key in `application.[yml|groovy]`, the value should be `reports`.
NOTE: For the `dataSource` parameter, if the data source is configured as `reports` underneath the `dataSources` key in `application.[yml|groovy]`, the value should be `reports`.

[source,groovy]
----
Expand Down
4 changes: 2 additions & 2 deletions src/docs/asciidoc/ref/Maintenance Scripts/dbm-list-tags.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ grails <<environment>> dbm-list-tags --defaultSchema=<<defaultSchema>>

Required arguments:

Required arguments: _none_ .
Required arguments: __none__.

Optional arguments:

Expand All @@ -24,4 +24,4 @@ NOTE: Note that the `defaultSchema` parameter name and value must be quoted if e
[source,groovy]
----
grails dbm-tag "--defaultSchema=<<defaultSchema>>"
----
----
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Usage:
grails <<environment>> dbm-mark-next-changeset-ran <<filename>> --contexts=<<contexts>> --defaultSchema=<<defaultSchema>> --dataSource=<<dataSource>>
----

Required arguments: _none_ .
Required arguments: __none__.

Optional arguments:

Expand All @@ -29,9 +29,9 @@ NOTE: Note that the `contexts`, `defaultSchema`, and `dataSource` parameter name
grails dbm-mark-next-changeset-ran "--contexts=<<contexts>>" "--defaultSchema=<<defaultSchema>>" "--dataSource=<<dataSource>>"
----

NOTE: For the `dataSource` parameter; If the data source is configured as `reports` underneath the `dataSources` key in `application.[yml|groovy]`, the value should be `reports`.
NOTE: For the `dataSource` parameter, if the data source is configured as `reports` underneath the `dataSources` key in `application.[yml|groovy]`, the value should be `reports`.

[source,groovy]
----
--dataSource=reports
----
----
Loading

0 comments on commit 66db7b7

Please sign in to comment.