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.

Syntax

To run the drop-all command, specify the driver, classpath, and URL in the Liquibase properties file. For more information, see Create and Configure a liquibase.properties File. You can also specify these properties in your command line.

Then run the drop-all command:

liquibase drop-all

If you use Liquibase 4.27.0 and later, it is a best practice to specify liquibase.dropAllRequireForce or LIQUIBASE_DROP_ALL_REQUIRE_FORCE in your liquibase.properties file or as an environment variable. This makes it mandatory for developers to specify --force whenever they run drop-all in the CLI:

liquibase drop-all --force

Impact

Using the drop-all command comes with risks of unintended consequences. Because of this, in Liquibase 4.27.0 and later, the command lets you use --drop-all-require-force to require developers to specify a --force flag to indicate that they intend to run it.

Warning: Look for potential unintended consequences before using this command.

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

A required parameter which indicates you intend to use this feature. If you specify --force or --force=true, the command executes. If you omit the parameter or specify --force=false, the command does not execute. Default: false.

Liquibase 4.27.0+ only. If you use an earlier version, this flag is optional.

Note: In Liquibase 4.27.0 and later, if you specify --drop-all-require-force to false, then setting --force to false does not prevent --drop-all from executing.

Required
--url

The JDBC database connection URL. See Using JDBC URL in Liquibase.

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
--drop-all-require-force

Specifies whether Liquibase requires the user to specify the --force parameter to use the drop-all command. Liquibase 4.27.0+. Default: false.

Optional
--drop-dbclhistory

If true, Liquibase drops the DATABASECHANGELOGHISTORY table along with other database objects owned by the user. Available in Liquibase 4.27.0+. Default: false.

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

Schemas to include in drop

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

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.

Output in Liquibase 4.27.0 and later

Value of --drop-all-require-force Value of --force Command executes? Output message
true true Yes Standard success message
true false or not specified No ERROR: The drop-all command may result in unrecoverable destructive changes to objects at <jdbc connection info>. This message can be suppressed and the drop-all executed by adding the --force flag.
false or not specified true Yes Standard success message
false or not specified false or not specified Yes

Standard success message as well as the following message: INFO: The drop-all command may result in unrecoverable destructive changes to objects at <jdbc connection info>. To protect against unwanted drops, set 'LIQUIBASE_COMMAND_DROPALL_REQUIRE_FORCE=true' which will require a --force=true flag on the command. Learn more at https://docs.liquibase.com/dropall

Related links