db-doc
The db-doc
command generates documentation in a Javadoc format based on the existing database and changelogs.
Uses
The db-doc
command 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.
Note: See the changelogDocs.zip
file for an example of the database documentation structure with the related directories and files.
Syntax
To run the db-doc
command, specify the driver, classpath, and URL in your Liquibase properties file. For more information, see Create and Configure a liquibase.properties File. You can also specify these properties from the command line.
Then run the db-doc
command:
liquibase db-doc --output-directory=exampleDirectory --changelog-file=example-changelog.xml
Note: The --output-directory=exampleDirectory
syntax was added in Liquibase 4.4. If you use an older version, specify your output directory as a positional argument: <command> exampleDirectory
. It is best practice to specify a new empty directory because the db-doc
command creates its own directories, the CSS file, and multiple HTML files.
Command arguments
Tip: For best results, specify all commands and parameters in the --kebab-case
format in the CLI. If your preference is camelCase, it also works in the CLI.
Attribute | Definition | Requirement |
---|---|---|
--changelog-file
|
The root changelog |
Required |
--url
|
The JDBC database connection URL. See Using JDBC URL in Liquibase. |
Required |
--username
|
Username to connect to the target database |
Required |
--password
|
Password to connect to the target database |
Required |
--output-directory
|
The directory where the database documentation is generated. Specify as |
Required |
--default-catalog-name
|
Name of the default catalog to use for the database connection |
Optional |
--default-schema-name
|
Name of the default schema to use for the database connection |
Optional |
--driver
|
The JDBC driver class |
Optional |
--driver-properties-file
|
The JDBC driver properties file |
Optional |
Note: The username
and password
attributes are not required for connections and systems which use alternate means of authentication. Also, you can specify database credentials as part of the url
attribute.
Output
Liquibase Pro 4.3.0 by Liquibase Enterprise licensed to Liquibase Pro Customer until Tue Sep 22 19:00:00 CDT 2020
Liquibase command 'db-doc' was executed successfully.