Maven dbDoc
dbDoc
generates documentation based on the existing database and changelogs.
Uses
dbDoc
is typically used to generate database documentation with the change information stored in the changelogs and the existing database. It captures the current state of your database including everything that has been performed against it.
The image below shows an example of the database documentation structure with the related directories and files.
Maven configuration
You can configure Liquibase Maven in multiple ways. You can pass arguments like <changeLogFile>
in Maven directly in your pom.xml
file, in a liquibase.properties
file referenced in your POM, as environment variables, or as JVM system properties.
Tip: For more information about the Maven configuration, see Configuring Maven.
Running the dbDoc
Maven goal
Running the dbDoc
goal requires a Maven project to be implemented.
To run the goal, type the following in your command prompt:
mvn liquibase:dbDoc -Dliquibase.outputDirectory=target/docs
Note: By default, the dbDoc
Maven goal puts the generated documentation in the target/liquibase/dbDoc
directory. To change it, enter the name of the output directory that you want to use in place of target/doc
.
When successful, the dbDoc
Maven goal produces the following output:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building liquibase-app 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- liquibase-maven-plugin:3.9.0:dbDoc (default-cli) @ liquibase-app ---
[INFO] ------------------------------------------------------------------------
[INFO] Parsing Liquibase Properties File
[INFO] File: liquibase.properties
[INFO] 'referencePassword' in properties file is not being used by this task.
[INFO] 'referenceUrl' in properties file is not being used by this task.
[INFO] 'referenceUsername' in properties file is not being used by this task.
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO]
[INFO] Liquibase Community 3.9.0 by Liquibase
[INFO] Starting Liquibase at Thu, 09 Jul 2020 07:57:01 CDT (version 3.9.0 #11 built at Thu May 14 04:03:56 UTC 2020)
[INFO] Parsing Liquibase Properties File liquibase.properties for changeLog parameters
[INFO] Executing on Database: jdbc:oracle:thin:@//win-20e107kb4tn:1521/ORCL
[INFO] Generating Database Documentation
[INFO] SELECT COUNT(*) FROM DATABASECHANGELOGLOCK
[INFO] SELECT COUNT(*) FROM DATABASECHANGELOGLOCK
[INFO] SELECT LOCKED FROM DATABASECHANGELOGLOCK WHERE ID=1 FOR UPDATE
[INFO] Successfully acquired change log lock
[INFO] SELECT MD5SUM FROM DATABASECHANGELOG WHERE MD5SUM IS NOT NULL AND ROWNUM=1
[INFO] SELECT COUNT(*) FROM DATABASECHANGELOG
[INFO] Reading from DATABASECHANGELOG
[INFO] SELECT * FROM DATABASECHANGELOG ORDER BY DATEEXECUTED ASC, ORDEREXECUTED ASC
[INFO] SELECT sequence_name,
CASE WHEN increment_by > 0
THEN CASE WHEN min_value=1 THEN NULL ELSE min_value END
ELSE CASE WHEN min_value=(-999999999999999999999999999) THEN NULL else min_value END
END AS min_value,
CASE WHEN increment_by > 0
THEN CASE WHEN max_value=999999999999999999999999999 THEN NULL ELSE max_value END
ELSE CASE WHEN max_value=last_number THEN NULL else max_value END
END AS max_value,
CASE WHEN increment_by = 1 THEN NULL ELSE increment_by END AS increment_by,
CASE WHEN cycle_flag = 'N' THEN NULL ELSE cycle_flag END AS will_cycle,
CASE WHEN order_flag = 'N' THEN NULL ELSE order_flag END AS is_ordered,
LAST_NUMBER as START_VALUE,
CASE WHEN cache_size = 20 THEN NULL ELSE cache_size END AS cache_size
FROM ALL_SEQUENCES WHERE SEQUENCE_OWNER = 'GAMBITCARD_DEV'
[INFO] select ucc.owner as constraint_container, ucc.constraint_name as constraint_name, ucc.column_name, f.validated as constraint_validate from all_cons_columns ucc INNER JOIN al
l_constraints f ON ucc.owner = f.owner AND ucc.constraint_name = f.constraint_name where ucc.constraint_name='AK_EXEMPLAR_PPD' and ucc.owner='GAMBITCARD_DEV' and ucc.table_name not
like 'BIN$%' order by ucc.position
[INFO] select ucc.owner as constraint_container, ucc.constraint_name as constraint_name, ucc.column_name, f.validated as constraint_validate from all_cons_columns ucc INNER JOIN al
l_constraints f ON ucc.owner = f.owner AND ucc.constraint_name = f.constraint_name where ucc.constraint_name='AK_TITLE_DIRECTOR' and ucc.owner='GAMBITCARD_DEV' and ucc.table_name n
ot like 'BIN$%' order by ucc.position
[INFO] Table person created
[INFO] ChangeSet changelog.xml::1::MikeOlivas ran successfully in 6ms
[INFO] Table company created
[INFO] ChangeSet changelog.xml::2::MikeOlivas ran successfully in 2ms
[INFO] Columns country(varchar(2)) added to person
[INFO] ChangeSet changelog.xml::3::MikeOlivas ran successfully in 1ms
[INFO] Successfully released change log lock
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.066 s
[INFO] Finished at: 2020-07-09T07:57:14-05:00
[INFO] Final Memory: 23M/453M
[INFO] ------------------------------------------------------------------------
dbDoc
optional Maven configuration attributes
Attribute | Definition |
---|---|
liquibase.changeLogDirectory
|
Specifies the path to the directory where Liquibase can find your changelog file. |
liquibase.changeLogFile
|
The changelog file for Liquibase to use. |
liquibase.changelogCatalogName
|
Specifies the catalog Liquibase will use to create your changelog tables. |
liquibase.changelogSchemaName
|
Specifies the schema Liquibase will use to create your changelog tables. |
liquibase.clearCheckSums
|
Boolean. Forces checksums to be cleared from the DATABASECHANGELOG table. Default value is: false. |
liquibase.contexts
|
Specifies which contexts Liquibase will execute, which can be separated by a comma if multiple contexts are required. If a context is not specified, then all contexts will be executed. |
liquibase.databaseChangeLogLockTableName
|
Specifies the table name to use for the DATABASECHANGELOGLOCK table. |
liquibase.databaseChangeLogTableName
|
Specifies the table name to use for the DATABASECHANGELOG table. |
liquibase.databaseClass
|
Specifies the database object class. |
liquibase.defaultCatalogName
|
Specifies the default catalog name to use for the database connection. |
liquibase.defaultSchemaName
|
Specifies the default schema name to use for the database connection. |
liquibase.driver
|
Specifies the driver class name to use for the database connection. |
driverPropertiesFile
|
Specifies the location of a JDBC connection properties file which contains properties the driver will use. |
liquibase.emptyPassword
|
Deprecated. Boolean. Use an empty or null value for the password instead. Default value is: false. |
expressionVariables
|
Specifies a map-based collection of changelog properties to apply. |
expressionVars
|
Specifies a property-based collection of changelog properties to apply. |
liquibase.includeArtifact
|
Boolean. Includes a Maven project artifact in the class loader, which obtains the Liquibase properties file and changelog files. Default value is |
liquibase.includeTestOutputDirectory
|
Boolean. Includes the Maven test output directory in the class loader which obtains the Liquibase properties file and changelog files. Default value is |
liquibase.labels
|
Specifies which labels Liquibase runs, and which can be separated by a comma if multiple labels are required or you need to designate a more complex expression. If no label is specified, then all labels are run. |
liquibase.licenseKey
|
Specifies your Liquibase Pro license key. |
liquibase.outputDefaultCatalog
|
Boolean. Specifies whether to ignore the catalog or database name. Default value is: false. |
liquibase.outputDefaultSchema
|
Boolean. Specifies whether to ignore the schema name. Default value is: false. |
liquibase.outputFileEncoding
|
Indicates that you want to set the character encoding of the output file during the |
liquibase.password
|
Specifies the database password for the database connection. |
liquibase.promptOnNonLocalDatabase
|
Deprecated. Boolean. Controls whether users are prompted before executing changesets to a non-local database. Default value is: true. |
liquibase.propertyFile
|
Specifies the Liquibase properties file to use for configuration, like |
liquibase.propertyFileWillOverride
|
Boolean. Indicates that you want the |
liquibase.propertyProviderClass
|
Specifies the property provider, which must be a |
liquibase.server
|
Specifies the server ID in the Maven |
liquibase.skip
|
Boolean. Specifies whether to skip running Liquibase. The use of this attribute is not recommended but can be used when needed. Default value is: false. |
systemProperties
|
Specifies a list of system properties you want to pass to the database. |
liquibase.url
|
Specifies the database URL you want to use to execute Liquibase. |
liquibase.username
|
Specifies the database username for the database connection. |
liquibase.verbose
|
Boolean. Controls the amount of output detail when you call the plugin. Default value is: false. |