Skip to content

Conversation

@bog-walk
Copy link
Member

@bog-walk bog-walk commented Jul 25, 2025

Description

Summary of the change: Drop support for H2 V1 in tests and where applicable in source-code

Detailed description:

  • Why: Phased-out support for H2 version 1 has been documented since Exposed's initial release 0.42.0. Most new features implemented since then have not included support for or testing on this version. As a technical and db-support breaking change, 1.0.0 is a good candidate to officially drop support. Full details in EXPOSED-30.

  • How:

    • Remove gradle dependencies on older H2 version
    • Remove gradle test task for h2_v1 and TestDB.H2_V1
    • Remove any associated test classes or functions for older version
    • Deprecate H2MajorVersion.One in H2Dialect
    • Refactor H2Dialect.majorVersion so that it only returns Two; any other detected version throws
    • Replace all usages of H2Dialect.isSecondVersion()

Type of Change

Please mark the relevant options with an "X":

  • Other - Task

Updates/remove existing public API methods:

  • Is breaking change

Affected databases:

  • H2

Checklist

  • Unit tests are in place
  • The build is green (including the Detekt check)
  • All public methods affected by my PR has up to date API docs
  • Documentation for my change is up to date

Related Issues

EXPOSED-30

Comment on lines 440 to +445
is H2Dialect -> {
when (dialect.isSecondVersion) {
false -> append("BITAND(", expr1, ", ", expr2, ")")
true -> {
+"BITAND("
castToExpressionTypeForH2BitWiseIps(expr1, this)
+", "
castToExpressionTypeForH2BitWiseIps(expr2, this)
+")"
}
}
+"BITAND("
castToExpressionTypeForH2BitWiseIps(expr1, this)
+", "
castToExpressionTypeForH2BitWiseIps(expr2, this)
+")"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isSecondVersion() either always returns true or throws an exception now.

More details in H2.kt

Comment on lines 221 to 237
val isSecondVersion get() = majorVersion == H2MajorVersion.Two
// Adding a note to discuss keeping, as this will only ever be true now (otherwise throws)
val isSecondVersion: Boolean get() = majorVersion == H2MajorVersion.Two
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the 2 changes above, this will only ever have a value of true, or it will throw an exception.
That's why all usages have been changed in the source code.

I considered also deprecating this function, but I could understand leaving it in. Maybe H2 will eventually reach V3 and there will be a case for needing this distinction. But we could then add a more pertinent isThirdVersion, so I'm willing to keep or leave.

Let me know if anyone has strong opinions about this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will update breaking changes accordingly once the deprecation details, etc are agreed on.

@bog-walk bog-walk requested review from e5l and obabichevjb July 25, 2025 07:42
bog-walk added 3 commits July 27, 2025 17:21
- Remove dependencies for H2V1
- Remove TestDB.H2_V1 from exposed-tests
- Deprecate H2MajorVersion.One
- Replace usage of H2Dialect.isSecondVersion and will always be true now
- Fix incorrectly excluded tests
- Add breaking changes note
- Fix broken rebased test
@bog-walk bog-walk force-pushed the bog-walk/phase-out-h2-v1 branch from 5e0573b to 26a41dc Compare July 27, 2025 21:53
@bog-walk bog-walk merged commit 9d056aa into main Jul 28, 2025
7 checks passed
@bog-walk bog-walk deleted the bog-walk/phase-out-h2-v1 branch July 28, 2025 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants