mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-17 00:24:57 +00:00
HHH-18406 Drop and recreate UserDefinedTypes for schema update as well
This commit is contained in:
parent
6d3ee70f72
commit
09baefba40
@ -59,6 +59,8 @@
|
|||||||
import static org.hibernate.internal.util.StringHelper.isEmpty;
|
import static org.hibernate.internal.util.StringHelper.isEmpty;
|
||||||
import static org.hibernate.tool.schema.UniqueConstraintSchemaUpdateStrategy.DROP_RECREATE_QUIETLY;
|
import static org.hibernate.tool.schema.UniqueConstraintSchemaUpdateStrategy.DROP_RECREATE_QUIETLY;
|
||||||
import static org.hibernate.tool.schema.UniqueConstraintSchemaUpdateStrategy.SKIP;
|
import static org.hibernate.tool.schema.UniqueConstraintSchemaUpdateStrategy.SKIP;
|
||||||
|
import static org.hibernate.tool.schema.internal.SchemaCreatorImpl.createUserDefinedTypes;
|
||||||
|
import static org.hibernate.tool.schema.internal.SchemaDropperImpl.dropUserDefinedTypes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base implementation of {@link SchemaMigrator}.
|
* Base implementation of {@link SchemaMigrator}.
|
||||||
@ -195,6 +197,9 @@ private void performMigration(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Drop all UDTs
|
||||||
|
dropUserDefinedTypes( metadata, options, schemaFilter, dialect, formatter, sqlGenerationContext, targets );
|
||||||
|
|
||||||
// Create before-table AuxiliaryDatabaseObjects
|
// Create before-table AuxiliaryDatabaseObjects
|
||||||
for ( AuxiliaryDatabaseObject auxiliaryDatabaseObject : database.getAuxiliaryDatabaseObjects() ) {
|
for ( AuxiliaryDatabaseObject auxiliaryDatabaseObject : database.getAuxiliaryDatabaseObjects() ) {
|
||||||
if ( auxiliaryDatabaseObject.beforeTablesOnCreation()
|
if ( auxiliaryDatabaseObject.beforeTablesOnCreation()
|
||||||
@ -209,6 +214,9 @@ private void performMigration(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Recreate all UDTs
|
||||||
|
createUserDefinedTypes( metadata, options, schemaFilter, dialect, formatter, sqlGenerationContext, targets );
|
||||||
|
|
||||||
boolean tryToCreateCatalogs = false;
|
boolean tryToCreateCatalogs = false;
|
||||||
boolean tryToCreateSchemas = false;
|
boolean tryToCreateSchemas = false;
|
||||||
if ( options.shouldManageNamespaces() ) {
|
if ( options.shouldManageNamespaces() ) {
|
||||||
|
@ -497,7 +497,7 @@ private static void createAuxiliaryObjectsBeforeTables(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void createUserDefinedTypes(
|
static void createUserDefinedTypes(
|
||||||
Metadata metadata,
|
Metadata metadata,
|
||||||
ExecutionOptions options,
|
ExecutionOptions options,
|
||||||
SchemaFilter schemaFilter,
|
SchemaFilter schemaFilter,
|
||||||
|
@ -391,7 +391,7 @@ private static void dropTables(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void dropUserDefinedTypes(
|
static void dropUserDefinedTypes(
|
||||||
Metadata metadata,
|
Metadata metadata,
|
||||||
ExecutionOptions options,
|
ExecutionOptions options,
|
||||||
SchemaFilter schemaFilter,
|
SchemaFilter schemaFilter,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user