use of org.flywaydb.core.internal.database.oracle.OracleSchema.ObjectType in project flyway by flyway.
the class OracleSchema method doClean.
@Override
protected void doClean() throws SQLException {
if (isSystem()) {
throw new FlywayException("Clean not supported on Oracle for system schema " + database.quote(name) + "! " + "It must not be changed in any way except by running an Oracle-supplied script!");
}
// Disable FBA for schema tables.
if (database.isFlashbackDataArchiveAvailable()) {
disableFlashbackArchiveForFbaTrackedTables();
}
// Clean Oracle Locator metadata.
if (database.isLocatorAvailable()) {
cleanLocatorMetadata();
}
// Get existing object types in the schema.
Set<String> objectTypeNames = getObjectTypeNames(jdbcTemplate, database, this);
// Define the list of types to process, order is important.
List<ObjectType> objectTypesToClean = Arrays.asList(// Types to drop.
TRIGGER, QUEUE_TABLE, FILE_WATCHER, SCHEDULER_CHAIN, SCHEDULER_JOB, SCHEDULER_PROGRAM, SCHEDULE, RULE_SET, RULE, EVALUATION_CONTEXT, FILE_GROUP, XML_SCHEMA, MINING_MODEL, REWRITE_EQUIVALENCE, SQL_TRANSLATION_PROFILE, MATERIALIZED_VIEW, MATERIALIZED_VIEW_LOG, DIMENSION, VIEW, DOMAIN_INDEX, DOMAIN_INDEX_TYPE, TABLE, INDEX, CLUSTER, SEQUENCE, OPERATOR, FUNCTION, PROCEDURE, PACKAGE, CONTEXT, LIBRARY, TYPE, SYNONYM, JAVA_SOURCE, JAVA_CLASS, JAVA_RESOURCE, // Object types with sensitive information (passwords), skip intentionally, print warning if found.
DATABASE_LINK, CREDENTIAL, // Unsupported types, print warning if found
DATABASE_DESTINATION, SCHEDULER_GROUP, CUBE, CUBE_DIMENSION, CUBE_BUILD_PROCESS, MEASURE_FOLDER, // Undocumented types, print warning if found
ASSEMBLY, JAVA_DATA);
for (ObjectType objectType : objectTypesToClean) {
if (objectTypeNames.contains(objectType.getName())) {
LOG.debug("Cleaning objects of type " + objectType + " ...");
objectType.dropObjects(jdbcTemplate, database, this);
}
}
if (isDefaultSchemaForUser()) {
jdbcTemplate.execute("PURGE RECYCLEBIN");
}
}
Aggregations