-
Notifications
You must be signed in to change notification settings - Fork 696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: EXPOSED-706 Handle MariaDB sequence max value for versions earlier than 11.5 #2375
Open
joc-a
wants to merge
1
commit into
main
Choose a base branch
from
joc/handle-mariadb-sequence-max-value
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
joc-a
changed the title
fix: Handle MariaDB sequence max value
fix: Handle MariaDB sequence max value for versions earlier than 11.5
Jan 27, 2025
joc-a
force-pushed
the
joc/handle-mariadb-sequence-max-value
branch
from
January 27, 2025 18:12
78640af
to
0cf78d8
Compare
joc-a
changed the title
fix: Handle MariaDB sequence max value for versions earlier than 11.5
fix: EXPOSED-706 Handle MariaDB sequence max value for versions earlier than 11.5
Jan 27, 2025
…er than 11.5 According to the documentation [here](https://mariadb.com/kb/en/create-sequence/#maxvalue), MariaDB versions less than 11.5 have a max value for sequences that is lower than the one Exposed currently allows and that causes errors.
joc-a
force-pushed
the
joc/handle-mariadb-sequence-max-value
branch
from
January 28, 2025 10:24
0cf78d8
to
0f15119
Compare
joc-a
commented
Jan 28, 2025
Comment on lines
-778
to
+809
name = "my_sequence", | ||
startWith = 1, | ||
minValue = 1, | ||
maxValue = 9223372036854775807 | ||
) | ||
private val sequenceName by lazy { "custom_sequence" } | ||
|
||
private val sequenceName = "custom_sequence" | ||
|
||
private val tableWithoutAutoIncrement = object : IdTable<Long>("test_table") { | ||
override val id: Column<EntityID<Long>> = long("id").entityId() | ||
private val tableWithoutAutoIncrement by lazy { | ||
object : IdTable<Long>("test_table") { | ||
override val id: Column<EntityID<Long>> = long("id").entityId() | ||
} | ||
} | ||
|
||
private val tableWithAutoIncrement = object : IdTable<Long>("test_table") { | ||
override val id: Column<EntityID<Long>> = long("id").autoIncrement().entityId() | ||
private val tableWithAutoIncrement by lazy { | ||
object : IdTable<Long>("test_table") { | ||
override val id: Column<EntityID<Long>> = long("id").autoIncrement().entityId() | ||
} | ||
} | ||
|
||
private val tableWithAutoIncrementCustomSequence = object : IdTable<Long>("test_table") { | ||
override val id: Column<EntityID<Long>> = long("id").autoIncrement(sequence).entityId() | ||
private val tableWithAutoIncrementCustomSequence by lazy { | ||
object : IdTable<Long>("test_table") { | ||
override val id: Column<EntityID<Long>> = long("id").autoIncrement(sequence).entityId() | ||
} | ||
} | ||
|
||
private val tableWithAutoIncrementSequenceName = object : IdTable<Long>("test_table") { | ||
override val id: Column<EntityID<Long>> = long("id").autoIncrement(sequenceName).entityId() | ||
private val tableWithAutoIncrementSequenceName by lazy { | ||
object : IdTable<Long>("test_table") { | ||
override val id: Column<EntityID<Long>> = long("id").autoIncrement(sequenceName).entityId() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed these to lazy properties to be able to make the sequence variable in the test a late-initialized property without running into an error that it is not initalized yet.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
sequenceMaxValue
, toDatabaseDialect
, and that is overridden inMariaDBDialect
and used to set themaxValue
ofSequence
wherever a sequence is created.How to test:
docker-compose-mariadb.yml
image: mariadb:10.3.0
SequencesTests
andDatabaseMigrationTests
for MariaDB v2 and v3 and they should passType of Change
Please mark the relevant options with an "X":
Updates/remove existing public API methods:
Affected databases:
Checklist
Related Issues