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
--output-directory

The directory where the database documentation is generated. Specify as --output-directory=exampleDirectory. Positional format <command> <directory> deprecated in 4.4+.

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. If defaultSchemaName is set, then objects do not have to be fully qualified. This means you can refer to just mytable instead of myschema.mytable.

Tip: In Liquibase v4.23.0+, camelCase for defaultSchemaName works successfully. If you are on an earlier version, camelCase may not work as expected.

Note: The syntax liquibase.command.defaultSchemaName is valid for v4.19.0+. For prior versions, use defaultSchemaName.

Optional
--driver

The JDBC driver class

Optional
--driver-properties-file

The JDBC driver properties file

Optional
--password

Password to connect to the target database.

Tip: It is a best practice to store sensitive data in a Secrets Management tool with Liquibase Pro.

Optional
--username

Username to connect to the target database.

Tip: It is a best practice to store sensitive data in a Secrets Management tool with Liquibase Pro.

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.

Related links