WarnOnUseDatabase

Last updated: July 14, 2025

This check warns a user when generated or raw SQL contains 'USE DATABASE' directive.

Uses

Property

Value

Liquibase version required

4.19.0+

Scope (--checks-scope)

changelog

Default status

disabled

Default severity (exit code)

0 ("INFO")

Customizable settings

No (static)

Use the check to warn when changeset's generated or raw SQL contain 'USE DATABASE' directive. Unintended or unauthorized database use can lead to security and compliance issues, especially in regulated industries. This policy check alerts users so they can exercise more control over database use privileges and permission changes, which is especially important in automated data pipelines, before these changes are deployed to your production environments.

Before you begin

  1. Ensure that you have correctly specified your Liquibase Pro license key.

  2. Ensure that the --checks-scope parameter includes the scope of this check.

Changelog checks prerequisites

--license-key=<string>
--checks-scope=<string>

Procedure

1

Enable

This check is enabled by default. To verify that it is currently enabled, run the checks show command:

liquibase checks show --check-name=<string>

2

To run the check, use the checks run command.

liquibase checks run --check-name=<string>

Note: For flow files you'll need to run liquibase flow to apply your changes.