borinquenkid opened a new pull request, #16497: URL: https://github.com/apache/grails-core/pull/16497
## Description `grails-data-hibernate7/dbmigration-core` vendors a fork of [liquibase-hibernate](https://github.com/liquibase/liquibase-hibernate) v4.27.0 (Apache 2.0). That fork has fallen behind the fixes made upstream since, and the `liquibase-hibernate7-oss` (Liquibase 4.x) line that the upstream README documents has never been published, so Grails cannot take these fixes as a dependency. This PR ports them into the vendored copy, keeping the Grails class names and structure. Ported (upstream references are to `liquibase/liquibase-hibernate`): - **ID generation intent**: an identifier is only treated as generated when `@GeneratedValue` is present (`hbm.xml` mappings always count), and the identifier property is passed to `createGenerator` (fixes an NPE). - **`@NativeGenerator`** support for auto-increment and sequence snapshots. - **Sequence snapshots** for sequences owned by native and sequence-style generators (previously only the relational namespace was read). - **Primary key columns** are always non-nullable, not only when a generator is found. - **Column remarks**: an unchanged-size type difference no longer discards unrelated differences of the same column (upstream #824). - **PostgreSQL**: new `HibernateChangedIndexChangeGenerator`, plus `using` suppression in the primary key and unique constraint generators, so a diff no longer drops and recreates them (upstream #718, #848). The shared reflection and `GeneratorSettings` code lives in a small package-private `IdentifierGeneratorSupport`. The Hibernate 7.3 `Map<String, Object>` bootstrap fix, enum, timezone and `replaces()` handling were already present. **Tests** - Ported upstream `SequenceGeneratorTest`, `NativeGeneratorAutoIncrementTest`, `NativeGeneratorSequenceTest`, `CustomIdGeneratorTest`, `ColumnRemarksIntegrationTest` and their fixtures. - New `HibernateIndexDifferenceSuppressionTest` (upstream has none for #848), including a negative control for plain database-to-database diffs. - `HibernateChangedColumnChangeGeneratorSpec` updated: two cases asserted the old `getDifferences()` interaction, and a new case proves remark differences survive. - With the production change reverted, 7 of the 9 new or ported tests fail; the other two are the negative control and the already-supported `@SequenceGenerator` case. - `:grails-data-hibernate7-dbmigration-core:test` 34/34 passing. `:grails-data-hibernate7-dbmigration:test` had 86 tests with 2 failures before the spec update; I re-ran only the updated spec afterwards (9/9), not the full module. - Checkstyle (main, test, testFixtures) and CodeNarc (main) are clean for `dbmigration-core`; CodeNarc (test) for `dbmigration`. RAT: 0 unknown licenses. **Licensing**: the ported files are Liquibase code under Apache 2.0, so they keep no ASF header and are covered by RAT exclusions in `gradle/rat-root-config.gradle` and a `META-INF/NOTICE` entry (now "as of commit 93316a3"), the same way the original fork is handled. `HibernateIndexDifferenceSuppressionTest` is new Grails code and has the ASF header. **Not done**: no linked issue yet, the full `./gradlew build --rerun-tasks` and `./gradlew codeStyle` were not run (module-level checks only), and the `4.27.0` managed version in `dependencies.gradle` is untouched since nothing consumes it. ## Contributor Checklist Please review the following checklist before submitting your pull request. Pull requests that do not meet these requirements may be closed without review. ### Issue and Scope > Unchecked boxes below are things I did not do or could not claim; see "Not done" above. Background: Grails 8.0.x cannot consume the unpublished liquibase-hibernate7 4.x line, so the fixes are ported into the vendored fork. - [ ] This PR is linked to an existing issue that has been **acknowledged or approved** by the project team. If no approved issue exists, please give background on why this change is necessary. Tickets are preferred for release change log history. - [ ] This PR addresses the **complete scope** of the linked issue. Partial implementations or unfinished work should not be submitted for review. - [x] This PR contains a **single, focused change**. Unrelated changes should be submitted as separate pull requests. - [x] This PR targets the **correct branch** for the type of change: - **Patch release branches** (e.g., `7.0.x`): Bug fixes only. No new features or API changes. - **Minor release branches** (e.g., `7.1.x`): New features are welcome, but breaking existing APIs must be avoided. - **Major release branches** (e.g., `8.0.x`): Reserved for major changes. Breaking API changes are permitted. ### Code Quality - [x] I have **added or updated tests** that cover the changes introduced in this PR. All code contributions are expected to include appropriate test coverage. - [ ] I have verified that all existing tests pass by running `./gradlew build --rerun-tasks`. - [ ] My code follows the project's **code style** guidelines. I have run `./gradlew codeStyle` and resolved any violations. See [Code Style](../CONTRIBUTING.md#code-style) for details. - [ ] This PR does **not** include mass reformatting, style-only changes, or large-scale refactoring unless it was **explicitly approved** in the linked issue. Unsolicited reformatting will not be accepted. - [x] If generative AI tooling was used in preparing this contribution, a quality model was used to ensure contributions are **consistent with the project's quality standards**. ### Licensing and Attribution > Ported liquibase-hibernate code is third-party Apache 2.0 code, not original work, and keeps no ASF header (RAT exclusion + NOTICE), so the "new source files include the header" and "own original work" boxes are left unchecked. Generative AI (Claude) was used and is attributed in the commit trailer. - [x] All contributed code is provided under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0), and new source files include the appropriate **Apache license header**. - [ ] I have the necessary rights to submit this contribution and confirm it is my own original work (see [Legal Notice](../CONTRIBUTING.md#i-want-to-contribute)). - [x] If generative AI tooling was used in preparing this contribution, I have followed the [Apache Software Foundation's policy on generative tooling](https://www.apache.org/legal/generative-tooling.html) and have properly attributed its use. ### Documentation - [ ] If this PR introduces user-facing changes, I have included or updated the relevant documentation. - [ ] If this PR adds a new feature, I have updated the **What's New** section of the Grails Guide. - [ ] If this PR introduces breaking changes or changes that require user action during an upgrade, I have updated the **Upgrade Notes** for the corresponding version in the Grails Guide. - [x] The PR description clearly explains **what** was changed and **why**. --- > **First-time contributors:** Please read our [Contributing Guide](../CONTRIBUTING.md) before submitting. > Pull requests that appear to be auto-generated, incomplete, or unrelated to an approved issue may be > closed to help maintainers focus on reviewed and planned work. We appreciate your understanding. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
