Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit bd70062

Browse files
committed
Update docs to be correctly nested and fix attribute issues
1 parent a0417fb commit bd70062

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+127
-131
lines changed

docs/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ dependencies {
3838
}
3939

4040
asciidoctor {
41+
inputs.dir layout.projectDirectory.dir('src/docs/asciidoc')
42+
outputs.dir layout.buildDirectory.dir('docs/manual')
4143
baseDirFollowsSourceDir()
4244
resources {
4345
from("${project.projectDir}/src/docs/asciidoc/images")
@@ -54,6 +56,9 @@ asciidoctor {
5456
'groupId' : project.group,
5557
'artifactId' : project.name,
5658
'sourcedir' : "${project.projectDir}/src/main/groovy",
59+
'migrationPluginExamplesDir' : rootProject.layout.projectDirectory.dir('grails-database-migration/src/integration-test/resources').asFile.absolutePath,
60+
'migrationPluginGroupId' : rootProject.findProject(':database-migration').group,
61+
'migrationPluginArtifactId' : rootProject.findProject(':database-migration').name,
5762
'liquibaseHibernate5Version': liquibaseHibernate5Version
5863
}
5964

docs/src/docs/asciidoc/databaseMigration/configuration.adoc

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
:includedir: _includes
2-
:integrationtestresources: ../../integration-test/resources
3-
4-
== Configuration
1+
=== Configuration
52

63
There are a few configuration options for the plugin. All configurations are prefixed with `grails.plugin.databasemigration`:
74

@@ -35,7 +32,7 @@ NOTE: All the above configs can be used for multiple datasources
3532
If secondary dataSource named "second" is configured in application.yml
3633
[source,yaml]
3734
----
38-
include::{integrationtestresources}/application-multiple-datasource.yml[lines=11..29]
35+
include::{migrationPluginExamplesDir}/application-multiple-datasource.yml[lines=11..29]
3936
----
4037

4138
The configuration for this data source would be:

docs/src/docs/asciidoc/databaseMigration/dbdoc.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
== DbDoc Controller
1+
=== DbDoc Controller
22

33
You can use the <<ref-documentation-scripts-dbm-db-doc,dbm-db-doc>> script to generate static HTML files to view changelog information, but another option is to use the `DbDocController` at runtime. By default this controller is mapped to `/appname/dbdoc/` but this can be customized with `UrlMappings` like any controller.
44

docs/src/docs/asciidoc/databaseMigration/generalUsage.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
== General Usage
1+
=== General Usage
22

33
After creating the initial changelog, the typical workflow will be along the lines of:
44

@@ -9,10 +9,10 @@ After creating the initial changelog, the typical workflow will be along the lin
99
* check the updated domain class(es) and changelog(s) into source control
1010
1111
[WARNING]
12-
====
12+
=====
1313
1. When running migration scripts on non-development databases, it's important that you backup the database before running the migration in case anything goes wrong. You could also make a copy of the database and run the script against that, and if there's a problem the real database will be unaffected.
1414
2. Setting the dbCreate setting to "none" is recommended when executing the dbm migration commands. Otherwise you might run into troubles and the commands could not be executed.
15-
====
15+
=====
1616

1717
To create the changelog additions, you can either manually create the changes or with the <<ref-diff-scripts-dbm-gorm-diff,dbm-gorm-diff>> script (you can also use the <<ref-diff-scripts-dbm-diff,dbm-diff>> script but it's far less convenient and requires a 2nd temporary database).
1818

@@ -24,7 +24,7 @@ You have a few options with `dbm-gorm-diff`:
2424
Regardless of which approach you use, be sure to inspect generated changes and adjust as necessary.
2525

2626

27-
=== Autorun on start
27+
==== Autorun on start
2828

2929

3030
Since Liquibase maintains a record of changes that have been applied, you can avoid manually updating the database by taking advantage of the plugin's auto-run feature. By default this is disabled, but you can enable it by adding

docs/src/docs/asciidoc/databaseMigration/gettingStarted.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
== Getting Started
1+
=== Getting Started
22

33
*The first step is to add a dependency for the plugin in `build.gradle`:*
44

@@ -7,13 +7,13 @@
77
buildscript {
88
dependencies {
99
...
10-
classpath '{groupId}:{artifactId}:{version}'
10+
classpath '{migrationPluginGroupId}:{migrationPluginArtifactId}:{version}'
1111
}
1212
}
1313
1414
dependencies {
1515
...
16-
implementation '{groupId}:{artifactId}:{version}'
16+
implementation '{migrationPluginGroupId}:{migrationPluginArtifactId}:{version}'
1717
}
1818
----
1919

docs/src/docs/asciidoc/databaseMigration/gorm.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
== GORM Support
1+
=== GORM Support
22

33
The plugin's support for GORM is one feature that differentiates it from using Liquibase directly. Typically, when using Liquibase you make changes to a database yourself, and then create changesets manually, or use a diff script to compare your updated database to one that hasn't been updated yet. This is a decent amount of work and is rather error-prone. It's easy to forget some changes that aren't required but help performance, for example creating an index on a foreign key when using MySQL.
44

docs/src/docs/asciidoc/databaseMigration/groovyChanges.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
== Groovy Changes
1+
=== Groovy Changes
22

33
In addition to the built-in Liquibase changes (see http://www.liquibase.org/manual/home[the documentation] for what's available) you can also make database changes using Groovy code (as long as you're using the Groovy DSL file format). These changes use the `grailsChange` tag name and are contained in a `changeSet` tag like standard built-in tags.
44

55
There are four supported inner tags and two callable methods (to override the default confirmation message and checksum value).
66

7-
=== General format
7+
==== General format
88

99
This is the general format of a Groovy-based change; all inner tags and methods are optional:
1010

@@ -50,7 +50,7 @@ databaseChangeLog = {
5050
}
5151
----
5252

53-
=== Available variables
53+
==== Available variables
5454

5555
These variables are available throughout the change closure:
5656

docs/src/docs/asciidoc/databaseMigration/groovyPreconditions.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
== Groovy Preconditions
1+
=== Groovy Preconditions
22

33
In addition to the built-in Liquibase preconditions (see http://www.liquibase.org/manual/preconditions[the documentation] for what's available) you can also specify preconditions using Groovy code (as long as you're using the Groovy DSL file format). These changes use the `grailsPrecondition` tag name and are contained in the `databaseChangeLog` tag or in a `changeSet` tag like standard built-in tags.
44

5-
=== General format
5+
==== General format
66

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

@@ -49,7 +49,7 @@ As you can see there are a few ways to indicate that a precondition wasn't met:
4949
* call the `fail(String message)` method (throws a `PreconditionFailedException`)
5050
* throw an exception (shouldn't be necessary - use `assert` or `fail()` instead)
5151

52-
=== Available variables
52+
==== Available variables
5353

5454
* `database` - the current Liquibase `Database` instance
5555
* `databaseConnection` - the current Liquibase `DatabaseConnection` instance, which is a wrapper around the JDBC `Connection` (but doesn't implement the `Connection` interface)
@@ -61,7 +61,7 @@ As you can see there are a few ways to indicate that a precondition wasn't met:
6161
* `changeSet` - the current Liquibase `ChangeSet` instance
6262
* `changeLog` - the current Liquibase `DatabaseChangeLog` instance
6363

64-
=== Utility methods
64+
==== Utility methods
6565

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

docs/src/docs/asciidoc/databaseMigration/index.adoc

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
:includedir: _includes
2-
3-
= Grails Database Migration Plugin
4-
:source-highlighter: coderay
5-
:numbered:
6-
71
[[introduction]]
82
include::introduction.adoc[]
93

@@ -29,10 +23,10 @@ include::gorm.adoc[]
2923
include::dbdoc.adoc[]
3024

3125
[[reference]]
32-
== Reference
26+
=== Reference
3327

3428
[[ref-diff-scripts]]
35-
=== Diff Scripts
29+
==== Diff Scripts
3630

3731
[[ref-diff-scripts-dbm-diff]]
3832
include::ref/Diff Scripts/dbm-diff.adoc[]
@@ -41,13 +35,13 @@ include::ref/Diff Scripts/dbm-diff.adoc[]
4135
include::ref/Diff Scripts/dbm-gorm-diff.adoc[]
4236

4337
[[ref-documentation-scripts]]
44-
=== Documentation Scripts
38+
==== Documentation Scripts
4539

4640
[[ref-documentation-scripts-dbm-db-doc]]
4741
include::ref/Documentation Scripts/dbm-db-doc.adoc[]
4842

4943
[[ref-maintenance-scripts]]
50-
=== Maintenance Scripts
44+
==== Maintenance Scripts
5145

5246
[[ref-maintenance-scripts-dbm-add-migration]]
5347
include::ref/Maintenance Scripts/dbm-add-migration.adoc[]
@@ -125,7 +119,7 @@ include::ref/Rollback Scripts/dbm-rollback-to-date.adoc[]
125119
include::ref/Rollback Scripts/dbm-rollback.adoc[]
126120

127121
[[ref-update-scripts]]
128-
=== Update Scripts
122+
==== Update Scripts
129123

130124
[[ref-update-scripts-dbm-previous-changeset-sql]]
131125
include::ref/Update Scripts/dbm-previous-changeset-sql.adoc[]

docs/src/docs/asciidoc/databaseMigration/introduction.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
== Introduction to the Database Migration Plugin
1+
=== Introduction
22

33
The Database Migration plugin helps you manage database changes while developing Grails applications. The plugin uses the http://www.liquibase.org/[Liquibase] library.
44

0 commit comments

Comments
 (0)