mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-12 06:04:49 +00:00
HHH-12935 : Constraint and AuxiliaryDatabaseObject export identifiers are not qualified by schema or catalog
(cherry picked from commit ba80f0b3dc18f11bbaf1544bdcadd5828ad161df)
This commit is contained in:
parent
320772e5ee
commit
5ba82d6691
@ -8,6 +8,8 @@
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.hibernate.boot.model.naming.Identifier;
|
||||
|
||||
/**
|
||||
* Mainly this is used to support legacy sequence exporting.
|
||||
*
|
||||
@ -42,6 +44,10 @@ public NamedAuxiliaryDatabaseObject(
|
||||
|
||||
@Override
|
||||
public String getExportIdentifier() {
|
||||
return name;
|
||||
return new QualifiedNameImpl(
|
||||
Identifier.toIdentifier( getCatalogName() ),
|
||||
Identifier.toIdentifier( getSchemaName() ),
|
||||
Identifier.toIdentifier( name )
|
||||
).render();
|
||||
}
|
||||
}
|
||||
|
@ -93,6 +93,14 @@ public String[] sqlDropStrings(Dialect dialect) {
|
||||
return copy;
|
||||
}
|
||||
|
||||
protected String getCatalogName() {
|
||||
return catalogName;
|
||||
}
|
||||
|
||||
protected String getSchemaName() {
|
||||
return schemaName;
|
||||
}
|
||||
|
||||
private String injectCatalogAndSchema(String ddlString) {
|
||||
String rtn = StringHelper.replace( ddlString, CATALOG_NAME_PLACEHOLDER, catalogName == null ? "" : catalogName );
|
||||
rtn = StringHelper.replace( rtn, SCHEMA_NAME_PLACEHOLDER, schemaName == null ? "" : schemaName );
|
||||
|
@ -33,7 +33,7 @@ public ForeignKey() {
|
||||
@Override
|
||||
public String getExportIdentifier() {
|
||||
// NOt sure name is always set. Might need some implicit naming
|
||||
return StringHelper.qualify( getTable().getName(), "FK-" + getName() );
|
||||
return StringHelper.qualify( getTable().getExportIdentifier(), "FK-" + getName() );
|
||||
}
|
||||
|
||||
public void disableCreation() {
|
||||
|
@ -238,6 +238,6 @@ public String toString() {
|
||||
|
||||
@Override
|
||||
public String getExportIdentifier() {
|
||||
return StringHelper.qualify( getTable().getName(), "IDX-" + getName() );
|
||||
return StringHelper.qualify( getTable().getExportIdentifier(), "IDX-" + getName() );
|
||||
}
|
||||
}
|
||||
|
@ -89,6 +89,6 @@ public String generatedConstraintNamePrefix() {
|
||||
|
||||
@Override
|
||||
public String getExportIdentifier() {
|
||||
return StringHelper.qualify( getTable().getName(), "PK-" + getName() );
|
||||
return StringHelper.qualify( getTable().getExportIdentifier(), "PK-" + getName() );
|
||||
}
|
||||
}
|
||||
|
@ -72,6 +72,6 @@ public String generatedConstraintNamePrefix() {
|
||||
|
||||
@Override
|
||||
public String getExportIdentifier() {
|
||||
return StringHelper.qualify( getTable().getName(), "UK-" + getName() );
|
||||
return StringHelper.qualify( getTable().getExportIdentifier(), "UK-" + getName() );
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user