chore!: Change H2 Oracle longType and longAutoincType from NUMBER(19) to BIGINT and add CHECK constraint in Oracle and SQLite #2273
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Detailed description:
The SQL type of H2 Oracle Long type were changed. A CHECK constraint was also added for SQLite and Oracle.
The CHECK constraint with a range doesn't reject out-of-range values in SQLite because SQLite can store values that exceed the 64-bit integer range as REAL (floating-point numbers), bypassing the constraint. Using the condition
typeof(long_column) = 'integer'
instead of the range ensures that only 64-bit integer values pass the check, preventing out-of-range values from being stored as REAL and slipping past the constraint. The reason all of this is done thecreateStatement()
function and not in the column creation function as usual is because we need to invokecurrentDialect
to check the dialect and construct the CHECK constraint accordingly, and this cannot be invoke in the column creation function.Type of Change
Please mark the relevant options with an "X":
Updates/remove existing public API methods:
Affected databases:
Checklist
Related Issues