Overview of the issue
After upgrading from JHipster 8.7 to 9.0, running mvn liquibase:diff against an existing database continuously generates a changelog that drops and recreates every primary key and unique constraint in the schema. The generated changelog uses dropPrimaryKey / addPrimaryKey pairs, renaming constraints from the PostgreSQL default naming convention (e.g. dest_permissions_pkey) to Hibernate 7's implicit naming convention (e.g. dest_permissionsPK).
Attempting to apply this generated changelog fails with:
Caused by: org.postgresql.util.PSQLException: ERROR: cannot drop constraint dest_permissions_pkey on table dest_permissions because other objects depend on it
Detail: constraint fk_rel_dest_permissions__username__dest_permissions_id on table rel_dest_permissions__username depends on index dest_permissions_pkey
Hint: Use DROP ... CASCADE to drop the dependent objects too.
Where: SQL statement "alter table public.dest_permissions drop constraint "dest_permissions_pkey""
PL/pgSQL function inline_code_block line 7 at EXECUTE
Motivation for or Use Case
This is a blocker for any existing JHipster project migrating from JHipster 8.x to JHipster 9. The liquibase:diff goal is used as part of the development workflow to detect real schema changes. With this bug, it permanently generates noise for every table's primary key and unique constraint, making the diff output unreliable and the generated changelogs unapplicable without risking FK constraint violations.
Reproduce the error
1. Generate a JHipster application (v8.x) with PostgreSQL and Liquibase.
2. Run the application once to let Liquibase create the schema — PostgreSQL assigns default PK names like <table>_pkey.
3. Upgrade to JHipster v9.
4. Run mvn liquibase:diff against the existing database.
5. Observe that a changelog is generated with dropPrimaryKey / addPrimaryKey for every table, renaming constraints from <table>_pkey → <table>PK.
6. Attempt to apply the changelog — it fails with PSQLException: cannot drop constraint ... because other objects depend on it for any table that has a FK referencing its PK.
Related issues
Suggest a Fix
Two potential fixes:
- In the JHipster generator: when generating the referenceUrl for the liquibase-maven-plugin, explicitly configure hibernate.implicit_naming_strategy to a strategy that does not emit explicit PK constraint names (or preserves the legacy behaviour from Hibernate 6), so that liquibase:diff does not flag constraint name mismatches caused purely by the Hibernate 7 upgrade.
- In the JHipster generator: add configuration to the liquibase-maven-plugin that excludes primaryKeys and uniqueConstraints from diff output, since JHipster manages these explicitly in its generated changelogs and does not need them to be detected via diff:
<diffTypes>tables,columns,views,indexes,foreignKeys,sequences,data</diffTypes>
JHipster Version(s)
JHipster 9.0.0
Browsers and Operating System
MacOS
Overview of the issue
After upgrading from JHipster 8.7 to 9.0, running
mvn liquibase:diffagainst an existing database continuously generates a changelog that drops and recreates every primary key and unique constraint in the schema. The generated changelog usesdropPrimaryKey/addPrimaryKeypairs, renaming constraints from the PostgreSQL default naming convention (e.g.dest_permissions_pkey) to Hibernate 7's implicit naming convention (e.g.dest_permissionsPK).Attempting to apply this generated changelog fails with:
Motivation for or Use Case
This is a blocker for any existing JHipster project migrating from JHipster 8.x to JHipster 9. The liquibase:diff goal is used as part of the development workflow to detect real schema changes. With this bug, it permanently generates noise for every table's primary key and unique constraint, making the diff output unreliable and the generated changelogs unapplicable without risking FK constraint violations.
Reproduce the error
Related issues
Suggest a Fix
Two potential fixes:
<diffTypes>tables,columns,views,indexes,foreignKeys,sequences,data</diffTypes>JHipster Version(s)
JHipster 9.0.0
Browsers and Operating System
MacOS