[jOOQ/jOOQ#9758] Generated constraint names should not be table prefixed
in meta data (PostgreSQL fix)
This commit is contained in:
parent
5691ad7cb2
commit
3af4c5f6ec
@ -41,9 +41,11 @@ import static java.util.Arrays.asList;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.MARIADB;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.MYSQL;
|
||||
import static org.jooq.SQLDialect.POSTGRES;
|
||||
// ...
|
||||
// ...
|
||||
|
||||
@ -150,9 +152,9 @@ public class DefaultGeneratorStrategy extends AbstractGeneratorStrategy {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// [#9758] And then also for foreign keys
|
||||
else if (definition instanceof ForeignKeyDefinition && asList(POSTGRES).contains(definition.getDatabase().getDialect().family()))
|
||||
return ((ForeignKeyDefinition) definition).getTable().getOutputName().toUpperCase() + "__" + definition.getOutputName().toUpperCase();
|
||||
|
||||
else
|
||||
return definition.getOutputName().toUpperCase();
|
||||
|
||||
@ -327,11 +327,8 @@ public class PostgresDatabase extends AbstractDatabase {
|
||||
TableDefinition uniqueKeyTable = getTable(uniqueKeySchema, uniqueKeyTableName);
|
||||
|
||||
if (foreignKeyTable != null && uniqueKeyTable != null)
|
||||
|
||||
// [#986] Add the table name as a namespace prefix to the key
|
||||
// name. In Postgres, foreign key names are only unique per table
|
||||
relations.addForeignKey(
|
||||
foreignKeyTableName + "__" + foreignKey,
|
||||
foreignKey,
|
||||
foreignKeyTable,
|
||||
foreignKeyTable.getColumn(foreignKeyColumn),
|
||||
uniqueKey,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user