db-doc

Last published July 28, 2025

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. 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.

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.

Command parameters

Attribute

Definition

Requirement

--changelog-file=<string>

The root changelog

Required

--output-directory=<string>

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

Required

--url=<string>

The JDBC database connection URL.

Required

--context-filter=<string>

Specifies the changeset contexts to match. Contexts are tags you can add to changesets to control which changesets are executed in any particular migration run.

Note: If you use Liquibase 4.23.0 or earlier, use the syntax --contexts instead of --context-filter.

Optional

--default-catalog-name=<string>

Name of the default catalog to use for the database connection

Optional

--default-schema-name=<string>

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.

Note: In the properties file and JAVA_OPTS only: in 4.18.0 and earlier, specify this parameter using the syntax defaultSchemaName. In 4.19.0 and later, use the syntax liquibase.command.defaultSchemaName.

Note: In Liquibase 4.12.0 and later, you can use mixed-case schema names if you set --preserve-schema-case to true. However, in Liquibase 4.12.0–4.22.0, the Liquibase validator still throws a DatabaseException error if you specify a mixed-case value of defaultSchemaName. In 4.23.0 and later, the Liquibase validator accepts any casing.

Optional

--driver=<string>

The JDBC driver class

Optional

--driver-properties-file=<string>

The JDBC driver properties file

Optional

--label-filter=<string>

Specifies the changeset labels to match. Labels are tags you can add to changesets to control which changesets will be executed in any migration run.

Optional

--password=<string>

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

--schemas=<string>

Database schemas to include objects from in reporting

Optional

--username=<string>

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

Output

Liquibase command 'db-doc' was executed successfully.