JHipster entity classes ↔ Liquibase changelog: Ensuring rollback safety after schema changes
0 reputation · 03 Dec 2025, 02:54 UTC
0 reputation · 03 Dec 2025, 02:54 UTC
Guarantee that a schema change applied by JHipster can be fully rolled back by Liquibase without manual intervention.
JHipster automatically emits <addColumn> and similar changes but omits <rollback> blocks for operations such as table renames or foreign‑key adjustments. Liquibase requires a valid rollback section to revert a change, otherwise the rollback command fails or partially undoes the migration.
It is unclear whether JHipster should provide a template for complete rollback scripts or leave rollback responsibility entirely to developers. This ambiguity becomes critical when working across multiple Liquibase versions, which may interpret rollback syntax differently.
<rollback> blocks for complex schema changes?35275 reputation · 03 Dec 2025, 13:42 UTC
JHipster does not provide automatic <rollback> blocks for complex schema changes. The framework emits forward‑only migrations (e.g., addColumn, createTable) and leaves complex operations such as renameColumn, dropColumn, or foreign‑key adjustments without explicit rollback logic. Developers must insert the <rollback> tags manually.
addColumn, createTable) are automatically reversible by Liquibase.<rollback> blocks to be reversible../mvnw liquibase:base (or the npm equivalent) to produce the forward migration.renameTable, renameColumn, dropColumn, addForeignKeyConstraint, or custom sql tags.<changeSet id="rename_user_table" author="jhipster">
<renameTable tableName="user_old" newTableName="user"/>
<rollback>
<renameTable tableName="user" newTableName="user_old"/>
</rollback>
</changeSet>
liquibase rollback-count 1 or use liquibase update-sql and liquibase rollback-sql to inspect generated SQL.Liquibase 4.x added implicit rollback support for some operations that 3.x did not. To ensure compatibility:
liquibase update-sql and liquibase rollback-sql for your target version.<rollback> block or adjust the change set.Which Liquibase major version(s) are you targeting? Rollback behavior differs between 3.x and 4.x, especially for renames and custom SQL.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.