drop-all

drop-all drops all database objects owned by the user. drop-all will not drop functions, procedures, or packages for Liquibase Open Source. Functions, procedures, packages, and synonyms can only be dropped for Liquibase Pro supported objects.

Uses

drop-all is typically used when there is a need to prepare an environment schema to be identical to another environment schema. drop-all is useful in the developer and test environments to remove unwanted objects to reset the database to "empty".

The command makes it easier to standardize another schema, compared to manually deleting the objects, or dropping and recreating the desired schema.

drop-all should not be used in a production environment to prevent removal of required objects.

Running the drop-all command

To run the drop-all command, specify the driver, classpath, and URL in the Liquibase properties file. For more information, see Specifying Properties in a Connection Profile. You can also specify these properties in your command line.

Then run the drop-all command:

liquibase drop-all

drop-all global attributes

Tip: For best results, specify all commands and parameters with the --kebab-case format in the CLI. If your preference is camelCase, it will still work in the CLI.

Attribute Definition Requirement
--url

The JDBC database connection URL

Required
--username

The database username

Required
--password

The database password

Required

Note: The username and password attributes are not required for connections and systems which use alternate means of authentication.

Using the drop-all command with Liquibase Hub

If you use Liquibase Hub and want to receive drop-all operation reports, you need to specify one of the following attributes:

Attribute Definition Requirement
--hubConnectionId Identifies the specific target in which to record your data at Liquibase Hub. The attribute is available in your Project at https://hub.liquibase.com. Required only for Liquibase Hub reporting
--hubProjectId Identifies the specific Project in which to record your data at Liquibase Hub. The attribute is available in your account at https://hub.liquibase.com. Required only for Liquibase Hub reporting
--changelog-file A registered changelog file that identifies the specific Project in which to record your data at Liquibase Hub. Optional. If you specify a Liquibase Hub registered changelog, it will enable Liquibase Hub reporting.

Additionally, you need to be a Liquibase Hub user with a Liquibase Hub API Key set in one of the following ways:

Example Liquibase properties file

liquibase.hub.apiKey: <HubAPIKey>
liquibase.hub.connectionId: <targetId>
liquibase.hub.projectId: <projectId>

Example CLI

liquibase drop-all --hubProjectId=<projectId> --liquibaseHubApiKey=<addYourHubApiKeyHere>
liquibase drop-all --hubConnectionId=<targetId> --liquibaseHubApiKey=<addYourHubApiKeyHere>

You can also set your properties as Liquibase environment variables:

LIQUIBASE_HUB_API_KEY="<HubAPIKey>"
LIQUIBASE_COMMAND_HUB_PROJECT_ID="<projectId>"
LIQUIBASE_COMMAND_HUB_CONNECTION_ID="<targetId>"

Note: To retrieve or manage your API keys, go to API Keys by selecting your account in the upper-right corner of the page. To find the hubProjectId, select Projects > View Details. To find the hubConnectionId, select Project > View Details > Targets > View Status > Target ID.

drop-all example output

When successful, the drop-all command produces the following output:

Liquibase Pro 3.9.0  licensed to Liquibase Pro Customer until Tue Sep 22 19:00:00 CDT 2020
All objects dropped from MVN_UAT@jdbc:oracle:thin:@support.datical.net:1521:ORCL
Liquibase command 'drop-all' was executed successfully.