Want to deploy your JVM, Node.js and Go apps effortlessly to AWS? Try our service Boxfuse

Gradle Task: flywayClean

Drops all objects (tables, views, procedures, triggers, …) in the configured schemas.

clean

Usage

> gradle flywayClean

Configuration

Parameter Required Default Description
url YES The jdbc url to use to connect to the database
driver NO Auto-detected based on url The fully qualified classname of the jdbc driver to use to connect to the database
user NO The user to use to connect to the database
password NO The password to use to connect to the database
connectRetries NO 0 The maximum number of retries when attempting to connect to the database. After each failed attempt, Flyway will wait 1 second before attempting to connect again, up to the maximum number of times specified by connectRetries.
initSql NO none The SQL statements to run to initialize a new database connection immediately after opening it.
schemas NO The default schema for the database connection The schemas managed by Flyway. These schema names are case-sensitive.

Consequences:

  • Flyway will automatically attempt to create all these schemas, unless the first one already exists.
  • The first schema in the list will be automatically set as the default one during the migration.
  • The first schema in the list will also be the one containing the schema history table.
  • The schemas will be cleaned in the order of this list.
  • If Flyway created them, the schemas themselves will as be dropped when cleaning.
callbacks NO Fully qualified class names of Callback implementations to use to hook into the Flyway lifecycle.
skipDefaultCallbacks NO false Whether default built-in callbacks (sql) should be skipped. If true, only custom callbacks are used.
cleanDisabled NO false Whether to disable clean. This is especially useful for production environments where running clean can be quite a career limiting move.
licenseKey Flyway Pro NO none Your Flyway license key (FL01...). Not yet a Flyway Pro or Enterprise Edition customer? Request your Flyway trial license key to try out Flyway Pro and Enterprise Edition features free for 30 days.

Sample configuration

flyway {
    driver = 'org.hsqldb.jdbcDriver'
    url = 'jdbc:hsqldb:file:/db/flyway_sample;shutdown=true'
    user = 'SA'
    password = 'mySecretPwd'
    connectRetries = 10
    initSql = 'SET ROLE \'myuser\''
    schemas = ['schema1', 'schema2', 'schema3']
    callbacks = ['com.mycompany.proj.CustomCallback', 'com.mycompany.proj.AnotherCallback']
    skipDefaultCallbacks = false
    cleanDisabled = false
}

Sample output

> gradle flywayClean -i

Cleaned database schema 'PUBLIC' (execution time 00:00.016s)

Gradle: info