HHH-9966 - Improve schema tooling support for creating catalogs and schemas

This commit is contained in:
Andrea Boriero 2015-07-22 12:25:08 +01:00
parent e98f220b08
commit d885f249d9
14 changed files with 251 additions and 79 deletions

View File

@ -168,7 +168,6 @@ public class SessionFactoryOptionsImpl implements SessionFactoryOptions {
this.autoEvictCollectionCache = state.isAutoEvictCollectionCache();
this.schemaAutoTooling = state.getSchemaAutoTooling();
this.connectionReleaseMode = state.getConnectionReleaseMode();
this.getGeneratedKeysEnabled = state.isGetGeneratedKeysEnabled();
this.jdbcBatchSize = state.getJdbcBatchSize();

View File

@ -403,6 +403,14 @@ public interface AvailableSettings {
*/
String HBM2DDL_IMPORT_FILES_SQL_EXTRACTOR = "hibernate.hbm2ddl.import_files_sql_extractor";
/**
* Specifies whether to automatically create also the database schema/catalog.
* The default is false.
*
* @since 5.0
*/
String HBM2DLL_CREATE_NAMESPACES = "hibernate.hbm2dll.create_namespaces";
/**
* The {@link org.hibernate.exception.spi.SQLExceptionConverter} to use for converting SQLExceptions
* to Hibernate's JDBCException hierarchy. The default is to use the configured

View File

@ -1979,15 +1979,55 @@ public abstract class Dialect implements ConversionContext {
return auxiliaryObjectExporter;
}
/**
* Does this dialect support catalog creation?
*
* @return True if the dialect supports catalog creation; false otherwise.
*/
public boolean canCreateCatalog() {
return false;
}
/**
* Get the SQL command used to create the named catalog
*
* @param catalogName The name of the catalog to be created.
*
* @return The creation commands
*/
public String[] getCreateCatalogCommand(String catalogName) {
throw new UnsupportedOperationException( "No create catalog syntax supported by " + getClass().getName() );
}
/**
* Get the SQL command used to drop the named catalog
*
* @param catalogName The name of the catalog to be dropped.
*
* @return The drop commands
*/
public String[] getDropCatalogCommand(String catalogName) {
throw new UnsupportedOperationException( "No drop catalog syntax supported by " + getClass().getName() );
}
/**
* Does this dialect support schema creation?
*
* @return True if the dialect supports schema creation; false otherwise.
*/
public boolean canCreateSchema() {
return true;
}
/**
* Get the SQL command used to create the named schema
*
* @param schemaName The name of the schema to be created.
*
* @return The creation command
* @return The creation commands
*/
public String getCreateSchemaCommand(String schemaName) {
return "create schema " + schemaName;
public String[] getCreateSchemaCommand(String schemaName) {
return new String[] {"create schema " + schemaName};
}
/**
@ -1995,10 +2035,10 @@ public abstract class Dialect implements ConversionContext {
*
* @param schemaName The name of the schema to be dropped.
*
* @return The drop command
* @return The drop commands
*/
public String getDropSchemaCommand(String schemaName) {
return "drop schema " + schemaName;
public String[] getDropSchemaCommand(String schemaName) {
return new String[] {"drop schema " + schemaName};
}
/**

View File

@ -112,6 +112,7 @@ import org.hibernate.integrator.spi.Integrator;
import org.hibernate.integrator.spi.IntegratorService;
import org.hibernate.internal.util.collections.CollectionHelper;
import org.hibernate.internal.util.config.ConfigurationException;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.RootClass;
@ -142,6 +143,7 @@ import org.hibernate.tuple.entity.EntityTuplizer;
import org.hibernate.type.AssociationType;
import org.hibernate.type.Type;
import org.hibernate.type.TypeResolver;
import static org.hibernate.cfg.AvailableSettings.HBM2DLL_CREATE_NAMESPACES;
/**
@ -467,8 +469,11 @@ public final class SessionFactoryImpl implements SessionFactoryImplementor {
);
boolean createDropNamespaces = ConfigurationHelper.getBoolean( HBM2DLL_CREATE_NAMESPACES, properties, false );
if ( settings.isAutoCreateSchema() ) {
new SchemaExport( serviceRegistry, metadata )
new SchemaExport( serviceRegistry, metadata, createDropNamespaces )
.setImportSqlCommandExtractor( serviceRegistry.getService( ImportSqlCommandExtractor.class ) )
.create( false, true );
}
@ -479,7 +484,7 @@ public final class SessionFactoryImpl implements SessionFactoryImplementor {
new SchemaValidator( serviceRegistry, metadata ).validate();
}
if ( settings.isAutoDropSchema() ) {
schemaExport = new SchemaExport( serviceRegistry, metadata )
schemaExport = new SchemaExport( serviceRegistry, metadata, createDropNamespaces )
.setImportSqlCommandExtractor( serviceRegistry.getService( ImportSqlCommandExtractor.class ) );
}

View File

@ -107,8 +107,8 @@ public class SchemaExport {
*
* @param metadata The metadata object holding the mapping info to be exported
*/
public SchemaExport(MetadataImplementor metadata, boolean exportSchemas) {
this( metadata.getMetadataBuildingOptions().getServiceRegistry(), metadata, exportSchemas );
public SchemaExport(MetadataImplementor metadata, boolean createNamespaces) {
this( metadata.getMetadataBuildingOptions().getServiceRegistry(), metadata, createNamespaces );
}
/**
@ -136,14 +136,14 @@ public class SchemaExport {
* the JdbcServices service.
* @param metadata The metadata object holding the mapping info to be exported
*/
public SchemaExport(ServiceRegistry serviceRegistry, MetadataImplementor metadata, boolean exportSchemas) {
public SchemaExport(ServiceRegistry serviceRegistry, MetadataImplementor metadata, boolean createNamespaces) {
this(
new SuppliedConnectionProviderConnectionHelper(
serviceRegistry.getService( ConnectionProvider.class )
),
serviceRegistry,
metadata,
exportSchemas
createNamespaces
);
}
@ -151,7 +151,7 @@ public class SchemaExport {
ConnectionHelper connectionHelper,
ServiceRegistry serviceRegistry,
MetadataImplementor metadata,
boolean exportSchemas) {
boolean createNamespaces) {
this.connectionHelper = connectionHelper;
this.sqlStatementLogger = serviceRegistry.getService( JdbcServices.class ).getSqlStatementLogger();
this.formatter = ( sqlStatementLogger.isFormat() ? FormatStyle.DDL : FormatStyle.NONE ).getFormatter();
@ -193,10 +193,10 @@ public class SchemaExport {
final Map settings = serviceRegistry.getService( ConfigurationService.class ).getSettings();
schemaManagementTool.getSchemaDropper( settings ).doDrop( metadata, exportSchemas, target );
schemaManagementTool.getSchemaDropper( settings ).doDrop( metadata, createNamespaces, target );
this.dropSQL = commands.toArray( new String[commands.size()] );
schemaManagementTool.getSchemaCreator( settings ).doCreation( metadata, exportSchemas, target );
schemaManagementTool.getSchemaCreator( settings ).doCreation( metadata, createNamespaces, target );
this.createSQL = commands.toArray( new String[commands.size()] );
}

View File

@ -66,6 +66,11 @@ public class DatabaseInformationImpl implements DatabaseInformation, ExtractionC
return locateSequenceInformation( sequenceName );
}
@Override
public boolean catalogExists(Identifier catalog) {
return false;
}
// RegisteredObjectAccess implementation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -141,6 +141,11 @@ public class DatabaseInformationImpl implements DatabaseInformation, ExtractionC
return locateSequenceInformation( qualifiedSequenceName );
}
@Override
public boolean catalogExists(Identifier catalog) {
return extractor.catalogExists( catalog );
}
@Override
public TableInformation locateTableInformation(QualifiedTableName tableName) {
return getTableInformation( tableName );

View File

@ -92,4 +92,13 @@ public interface DatabaseInformation {
* @return The sequence information. May return {@code null} if not found.
*/
public SequenceInformation getSequenceInformation(QualifiedSequenceName sequenceName);
/**
* Check to see if the given catalog already exists.
*
* @param catalog The catalog name
*
* @return {@code true} indicates a catalog with the given name already exists
*/
boolean catalogExists(Identifier catalog);
}

View File

@ -13,6 +13,7 @@ import java.util.List;
import java.util.Set;
import org.hibernate.boot.Metadata;
import org.hibernate.boot.model.naming.Identifier;
import org.hibernate.boot.model.relational.AuxiliaryDatabaseObject;
import org.hibernate.boot.model.relational.Database;
import org.hibernate.boot.model.relational.Exportable;
@ -38,13 +39,13 @@ import org.hibernate.tool.schema.spi.Target;
public class SchemaCreatorImpl implements SchemaCreator {
@Override
public void doCreation(Metadata metadata, boolean createSchemas, List<Target> targets) throws SchemaManagementException {
doCreation( metadata, createSchemas, targets.toArray( new Target[ targets.size() ] ) );
public void doCreation(Metadata metadata, boolean createNamespaces, List<Target> targets) throws SchemaManagementException {
doCreation( metadata, createNamespaces, targets.toArray( new Target[ targets.size() ] ) );
}
@Override
public void doCreation(Metadata metadata, boolean createSchemas, Dialect dialect, List<Target> targets) throws SchemaManagementException {
doCreation( metadata, createSchemas, dialect, targets.toArray( new Target[ targets.size() ] ) );
public void doCreation(Metadata metadata, boolean createNamespaces, Dialect dialect, List<Target> targets) throws SchemaManagementException {
doCreation( metadata, createNamespaces, dialect, targets.toArray( new Target[ targets.size() ] ) );
}
/**
@ -54,11 +55,11 @@ public class SchemaCreatorImpl implements SchemaCreator {
*
* @return The generation commands
*/
public List<String> generateCreationCommands(Metadata metadata, boolean createSchemas) {
public List<String> generateCreationCommands(Metadata metadata, boolean createNamespaces) {
final ArrayList<String> commands = new ArrayList<String>();
doCreation(
metadata,
createSchemas,
createNamespaces,
new Target() {
@Override
public boolean acceptsImportScriptActions() {
@ -86,16 +87,16 @@ public class SchemaCreatorImpl implements SchemaCreator {
* For temporary use from JPA schema generation
*
* @param metadata The metadata for which to generate the creation commands.
* @param createSchemas Should the schema(s) actually be created as well ({@code CREATE SCHEMA})?
* @param createNamespaces Should the schema(s)/catalog(s) actually be created as well ({@code CREATE SCHEMA})?
* @param dialect Allow explicitly passing the Dialect to use.
*
* @return The generation commands
*/
public List<String> generateCreationCommands(Metadata metadata, boolean createSchemas, Dialect dialect) {
public List<String> generateCreationCommands(Metadata metadata, boolean createNamespaces, Dialect dialect) {
final ArrayList<String> commands = new ArrayList<String>();
doCreation(
metadata,
createSchemas,
createNamespaces,
dialect,
new Target() {
@ -122,19 +123,30 @@ public class SchemaCreatorImpl implements SchemaCreator {
}
@Override
public void doCreation(Metadata metadata, boolean createSchemas, Target... targets)
public void doCreation(Metadata metadata, boolean createNamespaces, Target... targets)
throws SchemaManagementException {
doCreation(
metadata,
createSchemas,
createNamespaces,
metadata.getDatabase().getJdbcEnvironment().getDialect(),
targets
);
}
@Override
public void doCreation(Metadata metadata, boolean createSchemas, Dialect dialect, Target... targets)
public void doCreation(Metadata metadata, boolean createNamespaces, Dialect dialect, Target... targets)
throws SchemaManagementException {
boolean tryToCreateCatalogs = false;
boolean tryToCreateSchemas = false;
if ( createNamespaces ) {
if ( dialect.canCreateSchema() ) {
tryToCreateSchemas = true;
}
if ( dialect.canCreateCatalog() ) {
tryToCreateCatalogs = true;
}
}
final Database database = metadata.getDatabase();
final JdbcEnvironment jdbcEnvironment = database.getJdbcEnvironment();
@ -144,13 +156,32 @@ public class SchemaCreatorImpl implements SchemaCreator {
final Set<String> exportIdentifiers = new HashSet<String>( 50 );
// first, create each schema
for ( Namespace namespace : database.getNamespaces() ) {
if ( createSchemas ) {
if ( namespace.getName().getSchema() == null ) {
continue;
// first, create each catalog/schema
if ( tryToCreateCatalogs || tryToCreateSchemas ) {
Set<Identifier> exportedCatalogs = new HashSet<Identifier>();
for ( Namespace namespace : database.getNamespaces() ) {
if ( tryToCreateCatalogs ) {
final Identifier catalogLogicalName = namespace.getName().getCatalog();
final Identifier catalogPhysicalName = namespace.getPhysicalName().getCatalog();
if ( catalogPhysicalName != null && !exportedCatalogs.contains( catalogLogicalName ) ) {
applySqlStrings(
targets,
dialect.getCreateCatalogCommand( catalogPhysicalName.render( dialect ) )
);
exportedCatalogs.add( catalogLogicalName );
}
}
if ( tryToCreateSchemas && namespace.getPhysicalName().getSchema() != null ) {
applySqlStrings(
targets,
dialect.getCreateSchemaCommand(
namespace.getPhysicalName().getSchema().render( dialect )
)
);
}
applySqlStrings( targets, dialect.getCreateSchemaCommand( namespace.getName().getSchema().render( dialect ) ) );
}
}

View File

@ -13,6 +13,7 @@ import java.util.List;
import java.util.Set;
import org.hibernate.boot.Metadata;
import org.hibernate.boot.model.naming.Identifier;
import org.hibernate.boot.model.relational.AuxiliaryDatabaseObject;
import org.hibernate.boot.model.relational.Database;
import org.hibernate.boot.model.relational.Exportable;
@ -39,16 +40,19 @@ public class SchemaDropperImpl implements SchemaDropper {
* Intended for use from JPA schema export code.
*
* @param metadata The metadata for which to generate drop commands
* @param dropSchemas Should {@code DROP SCHEMA} command be generated?
* @param dropNamespaces Should drop schema/catalog command be generated?
* @param dialect Allow explicitly specifying the dialect.
*
* @return The commands
*/
public Iterable<String> generateDropCommands(MetadataImplementor metadata, boolean dropSchemas, Dialect dialect) {
public Iterable<String> generateDropCommands(
MetadataImplementor metadata,
boolean dropNamespaces,
Dialect dialect) {
final ArrayList<String> commands = new ArrayList<String>();
doDrop(
metadata,
dropSchemas,
dropNamespaces,
dialect,
new Target() {
@ -75,20 +79,22 @@ public class SchemaDropperImpl implements SchemaDropper {
}
@Override
public void doDrop(Metadata metadata, boolean dropSchemas, List<Target> targets) throws SchemaManagementException {
doDrop( metadata, dropSchemas, targets.toArray( new Target[ targets.size() ] ) );
public void doDrop(Metadata metadata, boolean dropNamespaces, List<Target> targets)
throws SchemaManagementException {
doDrop( metadata, dropNamespaces, targets.toArray( new Target[targets.size()] ) );
}
@Override
public void doDrop(Metadata metadata, boolean dropSchemas, Dialect dialect, List<Target> targets) throws SchemaManagementException {
doDrop( metadata, dropSchemas, dialect, targets.toArray( new Target[ targets.size() ] ) );
public void doDrop(Metadata metadata, boolean dropNamespaces, Dialect dialect, List<Target> targets)
throws SchemaManagementException {
doDrop( metadata, dropNamespaces, dialect, targets.toArray( new Target[targets.size()] ) );
}
@Override
public void doDrop(Metadata metadata, boolean dropSchemas, Target... targets) throws SchemaManagementException {
public void doDrop(Metadata metadata, boolean dropNamespaces, Target... targets) throws SchemaManagementException {
doDrop(
metadata,
dropSchemas,
dropNamespaces,
metadata.getDatabase().getJdbcEnvironment().getDialect(),
targets
);
@ -96,10 +102,22 @@ public class SchemaDropperImpl implements SchemaDropper {
@Override
public void doDrop(Metadata metadata, boolean dropSchemas, Dialect dialect, Target... targets) throws SchemaManagementException {
public void doDrop(Metadata metadata, boolean dropNamespaces, Dialect dialect, Target... targets)
throws SchemaManagementException {
final Database database = metadata.getDatabase();
final JdbcEnvironment jdbcEnvironment = database.getJdbcEnvironment();
boolean tryToDropCatalogs = false;
boolean tryToDropSchemas = false;
if ( dropNamespaces ) {
if ( dialect.canCreateSchema() ) {
tryToDropSchemas = true;
}
if ( dialect.canCreateCatalog() ) {
tryToDropCatalogs = true;
}
}
for ( Target target : targets ) {
target.prepare();
}
@ -155,12 +173,31 @@ public class SchemaDropperImpl implements SchemaDropper {
);
}
for ( Namespace namespace : database.getNamespaces() ) {
if ( dropSchemas ) {
if ( namespace.getName().getSchema() == null ) {
continue;
if ( tryToDropCatalogs || tryToDropSchemas ) {
Set<Identifier> exportedCatalogs = new HashSet<Identifier>();
for ( Namespace namespace : database.getNamespaces() ) {
if ( tryToDropSchemas && namespace.getPhysicalName().getSchema() != null ) {
applySqlStrings(
targets, dialect.getDropSchemaCommand(
namespace.getPhysicalName().getSchema().render( dialect )
)
);
}
if ( tryToDropCatalogs ) {
final Identifier catalogLogicalName = namespace.getName().getCatalog();
final Identifier catalogPhysicalName = namespace.getPhysicalName().getCatalog();
if ( catalogPhysicalName != null && !exportedCatalogs.contains( catalogLogicalName ) ) {
applySqlStrings(
targets,
dialect.getDropCatalogCommand(
catalogPhysicalName.render( dialect )
)
);
exportedCatalogs.add( catalogLogicalName );
}
}
applySqlStrings( targets, dialect.getDropSchemaCommand( namespace.getName().getSchema().render( dialect ) ) );
}
}

View File

@ -49,14 +49,14 @@ public class SchemaMigratorImpl implements SchemaMigrator {
public void doMigration(
Metadata metadata,
DatabaseInformation existingDatabase,
boolean createSchemas,
boolean createNamespaces,
List<Target> targets) throws SchemaManagementException {
for ( Target target : targets ) {
target.prepare();
}
doMigrationToTargets( metadata, existingDatabase, createSchemas, targets );
doMigrationToTargets( metadata, existingDatabase, createNamespaces, targets );
for ( Target target : targets ) {
target.release();
@ -67,25 +67,58 @@ public class SchemaMigratorImpl implements SchemaMigrator {
protected void doMigrationToTargets(
Metadata metadata,
DatabaseInformation existingDatabase,
boolean createSchemas,
boolean createNamespaces,
List<Target> targets) {
final Set<String> exportIdentifiers = new HashSet<String>( 50 );
final Database database = metadata.getDatabase();
final Database database = metadata.getDatabase();
boolean tryToCreateCatalogs = false;
boolean tryToCreateSchemas = false;
if ( createNamespaces ) {
if ( database.getJdbcEnvironment().getDialect().canCreateSchema() ) {
tryToCreateSchemas = true;
}
if ( database.getJdbcEnvironment().getDialect().canCreateCatalog() ) {
tryToCreateCatalogs = true;
}
}
Set<Identifier> exportedCatalogs = new HashSet<Identifier>();
for ( Namespace namespace : database.getNamespaces() ) {
if ( createSchemas ) {
if ( namespace.getName().getSchema() != null ) {
if ( !existingDatabase.schemaExists( namespace.getName() ) ) {
applySqlString(
database.getJdbcEnvironment().getDialect().getCreateSchemaCommand(
namespace.getName().getSchema().render( database.getJdbcEnvironment().getDialect() )
if ( tryToCreateCatalogs || tryToCreateSchemas ) {
if ( tryToCreateCatalogs ) {
final Identifier catalogLogicalName = namespace.getName().getCatalog();
final Identifier catalogPhysicalName = namespace.getPhysicalName().getCatalog();
if ( catalogPhysicalName != null && !exportedCatalogs.contains( catalogLogicalName ) && !existingDatabase
.catalogExists( catalogLogicalName ) ) {
applySqlStrings(
database.getJdbcEnvironment().getDialect().getCreateCatalogCommand(
catalogPhysicalName.render(
database.getJdbcEnvironment().getDialect()
)
),
targets,
false
);
exportedCatalogs.add( catalogLogicalName );
}
}
if ( tryToCreateSchemas
&& namespace.getPhysicalName().getSchema() != null
&& !existingDatabase.schemaExists( namespace.getName() ) ) {
applySqlStrings(
database.getJdbcEnvironment().getDialect().getCreateSchemaCommand(
namespace.getPhysicalName()
.getSchema()
.render( database.getJdbcEnvironment().getDialect() )
),
targets,
false
);
}
}
for ( Table table : namespace.getTables() ) {
@ -240,7 +273,7 @@ public class SchemaMigratorImpl implements SchemaMigrator {
}
private UniqueConstraintSchemaUpdateStrategy determineUniqueConstraintSchemaUpdateStrategy(Metadata metadata) {
final ConfigurationService cfgService = ( (MetadataImplementor) metadata ).getMetadataBuildingOptions()
final ConfigurationService cfgService = ((MetadataImplementor) metadata).getMetadataBuildingOptions()
.getServiceRegistry()
.getService( ConfigurationService.class );

View File

@ -21,21 +21,21 @@ public interface SchemaCreator {
* Perform the creation to the specified targets
*
* @param metadata The "compiled" mapping metadata.
* @param createSchemas Should the schema(s) actually be created as well ({@code CREATE SCHEMA})?
* @param createNamespaces Should the schema(s)/catalog(s) actually be created as well ({@code CREATE SCHEMA})?
* @param targets The targets for creation
*
* @throws SchemaManagementException Indicates a problem processing the creation
*/
public void doCreation(
Metadata metadata,
boolean createSchemas,
boolean createNamespaces,
Target... targets) throws SchemaManagementException;
/**
* Perform the creation to the specified targets
*
* @param metadata The "compiled" mapping metadata.
* @param createSchemas Should the schema(s) actually be created as well ({@code CREATE SCHEMA})?
* @param createNamespaces Should the schema(s)/catalog(s) actually be created as well ({@code CREATE SCHEMA})?
* @param dialect Allow explicitly passing the Dialect to use.
* @param targets The targets for creation
*
@ -43,7 +43,7 @@ public interface SchemaCreator {
*/
public void doCreation(
Metadata metadata,
boolean createSchemas,
boolean createNamespaces,
Dialect dialect,
Target... targets) throws SchemaManagementException;
@ -51,21 +51,21 @@ public interface SchemaCreator {
* Perform the creation to the specified targets
*
* @param metadata The "compiled" mapping metadata.
* @param createSchemas Should the schema(s) actually be created as well ({@code CREATE SCHEMA})?
* @param createNamespaces Should the schema(s) actually be created as well ({@code CREATE SCHEMA})?
* @param targets The targets for creation
*
* @throws SchemaManagementException Indicates a problem processing the creation
*/
public void doCreation(
Metadata metadata,
boolean createSchemas,
boolean createNamespaces,
List<Target> targets) throws SchemaManagementException;
/**
* Perform the creation to the specified targets
*
* @param metadata The "compiled" mapping metadata.
* @param createSchemas Should the schema(s) actually be created as well ({@code CREATE SCHEMA})?
* @param createNamespaces Should the schema(s)/catalog(s) actually be created as well ({@code CREATE SCHEMA})?
* @param dialect Allow explicitly passing the Dialect to use.
* @param targets The targets for creation
*
@ -73,7 +73,7 @@ public interface SchemaCreator {
*/
public void doCreation(
Metadata metadata,
boolean createSchemas,
boolean createNamespaces,
Dialect dialect,
List<Target> targets) throws SchemaManagementException;
}

View File

@ -21,42 +21,42 @@ public interface SchemaDropper {
* Perform the drop to the specified targets
*
* @param metadata The "compiled" mapping metadata.
* @param dropSchemas Should the schema(s) actually be dropped also ({@code DROP SCHEMA})?
* @param dropNamespaces Should the schema(s)/catalog(s) actually be dropped also ({@code DROP SCHEMA})?
* @param targets The targets for drop
*
* @throws SchemaManagementException Indicates a problem processing the creation
*/
public void doDrop(Metadata metadata, boolean dropSchemas, Target... targets) throws SchemaManagementException;
public void doDrop(Metadata metadata, boolean dropNamespaces, Target... targets) throws SchemaManagementException;
/**
* Perform the drop to the specified targets
*
* @param metadata The "compiled" mapping metadata.
* @param dropSchemas Should the schema(s) actually be dropped also ({@code DROP SCHEMA})?
* @param dropNamespaces Should the schema(s)/catalog(s) actually be dropped also ({@code DROP SCHEMA})?
* @param targets The targets for drop
*
* @throws SchemaManagementException Indicates a problem processing the creation
*/
public void doDrop(Metadata metadata, boolean dropSchemas, Dialect dialect, Target... targets) throws SchemaManagementException;
public void doDrop(Metadata metadata, boolean dropNamespaces, Dialect dialect, Target... targets) throws SchemaManagementException;
/**
* Perform the drop to the specified targets
*
* @param metadata The "compiled" mapping metadata.
* @param dropSchemas Should the schema(s) actually be dropped also ({@code DROP SCHEMA})?
* @param dropNamespaces Should the schema(s)/catalog(s) actually be dropped also ({@code DROP SCHEMA})?
* @param targets The targets for drop
*
* @throws SchemaManagementException Indicates a problem processing the creation
*/
public void doDrop(Metadata metadata, boolean dropSchemas, List<Target> targets) throws SchemaManagementException;
public void doDrop(Metadata metadata, boolean dropNamespaces, List<Target> targets) throws SchemaManagementException;
/**
* Perform the drop to the specified targets
*
* @param metadata The "compiled" mapping metadata.
* @param dropSchemas Should the schema(s) actually be dropped also ({@code DROP SCHEMA})?
* @param dropNamespaces Should the schema(s)/catalog(s) actually be dropped also ({@code DROP SCHEMA})?
* @param targets The targets for drop
*
* @throws SchemaManagementException Indicates a problem processing the creation
*/
public void doDrop(Metadata metadata, boolean dropSchemas, Dialect dialect, List<Target> targets) throws SchemaManagementException;
public void doDrop(Metadata metadata, boolean dropNamespaces, Dialect dialect, List<Target> targets) throws SchemaManagementException;
}

View File

@ -22,7 +22,7 @@ public interface SchemaMigrator {
*
* @param metadata The "compiled" mapping metadata.
* @param existingDatabase Access to the information about the existing database.
* @param createSchemas Should the schema(s) actually be created as well ({@code CREATE SCHEMA})?
* @param createNamespaces Should the schema(s)/catalog(s) actually be created?
* @param targets The migration targets
*
* @throws SchemaManagementException
@ -30,6 +30,6 @@ public interface SchemaMigrator {
public void doMigration(
Metadata metadata,
DatabaseInformation existingDatabase,
boolean createSchemas,
boolean createNamespaces,
List<Target> targets) throws SchemaManagementException;
}