Fix database migration and make them more consistent#955
Merged
Conversation
In 14442c0, `updatetime` field was introduced to the `items` table. Unfortunately, unlike the initialization, the migration did not flag the field `NOT NULL`. This resulted in the pre-existing items to have `updatetime = 0`. When re-creating the table for adding an another field in 83794f4, the `updatetime` was set to `NOT NULL`, based on the previous initialization. That caused an error when migrating those items. This patch fixes the assumption by filling the `NULL` fields. Closes: #954
In 14442c0, `updatetime` field was introduced to the `items` table. Unfortunately, unlike the initialization, the migration did not flag the field `NOT NULL`. Additionally, the `lastseen` column in MySQL database was added as `NULL`able in 83794f4. These inconsistencies can lead to incorrect assumptions and cause bugs like #954. This patch adds the `NOT NULL` constraint for `updatetime` and `lastseen` fields, making the database consistent again. SQLite consistency was already rectified in 83794f4 by re-creating the table.
337e121 to
0a8c04b
Compare
This file contains hidden or 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
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.
In 14442c0,
updatetimefield was introduced to theitemstable. Unfortunately, unlike the initialization, the migration did not flag the fieldNOT NULL. Additionally, thelastseencolumn in MySQL database was added asNULLable in 83794f4. These inconsistencies can lead to incorrect assumptions and cause bugs like #954.This PR fills the
NULLfields during SQLite migration, fixing #954, and adds theNOT NULLconstraint forupdatetimeandlastseenfields, making them consistent accross databases and migration paths.