-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[jdbc] Add safety valve for suspicious migrations #13797
Merged
lolodomo
merged 3 commits into
openhab:main
from
jlaur:11906-jdbc-migration-safety-valve
Nov 28, 2022
Merged
[jdbc] Add safety valve for suspicious migrations #13797
lolodomo
merged 3 commits into
openhab:main
from
jlaur:11906-jdbc-migration-safety-valve
Nov 28, 2022
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
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
lolodomo
approved these changes
Nov 28, 2022
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.
LGTM
lolodomo
added
the
enhancement
An enhancement or new feature for an existing add-on
label
Nov 28, 2022
andrasU
pushed a commit
to andrasU/openhab-addons
that referenced
this pull request
Dec 24, 2022
* Abort migration from real names when most tables have table name prefix * Add missing checks for database connection from console commands * Add additional documentation for check/fix schema Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk> Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com>
borazslo
pushed a commit
to borazslo/openhab-mideaac-addon
that referenced
this pull request
Jan 8, 2023
* Abort migration from real names when most tables have table name prefix * Add missing checks for database connection from console commands * Add additional documentation for check/fix schema Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
psmedley
pushed a commit
to psmedley/openhab-addons
that referenced
this pull request
Feb 23, 2023
* Abort migration from real names when most tables have table name prefix * Add missing checks for database connection from console commands * Add additional documentation for check/fix schema Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
nemerdaud
pushed a commit
to nemerdaud/openhab-addons
that referenced
this pull request
Feb 28, 2023
* Abort migration from real names when most tables have table name prefix * Add missing checks for database connection from console commands * Add additional documentation for check/fix schema Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
andrasU
pushed a commit
to andrasU/openhab-addons
that referenced
this pull request
Jan 6, 2024
* Abort migration from real names when most tables have table name prefix * Add missing checks for database connection from console commands * Add additional documentation for check/fix schema Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk> Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com>
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.
This is a small follow-up to #13544 and #13737 since the combination of these features and an invalid configuration can potentially be dangerous.
Consider this case:
itemsManageTable=items
;tableNamePrefix=Item
;tableUseRealItemNames=false
;tableIdDigitCount=4
,rebuildTableNames=true
Items
,Item1
,Item4
,Item5
This is logically considered as a migration from real names to indexed scheme with prefixes and sequential numbers, since index (items manage table) is not found. As a result:
items
is created.Item1
is renamed toItem0001
and indexed as item name "Item1".Item4
is renamed toItem0002
and indexed as item name "Item4".Item5
is renamed toItem0003
and indexed as item name "Item5".Items
is renamed toItem0004
and indexed as item name "Items".This resulting mess can be avoided with a small sanity check: If most tables start with either the configured prefix or the hardcoded default prefix "item" (case insensitive), then log an error and abort the migration. It would be very unlikely for any user to have most items named like this.