Skip to content
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 database migration and make them more consistent #955

Merged
merged 2 commits into from
Jun 27, 2017

Conversation

jtojnar
Copy link
Member

@jtojnar jtojnar commented Jun 23, 2017

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 NULLable in 83794f4. These inconsistencies can lead to incorrect assumptions and cause bugs like #954.

This PR fills the NULL fields during SQLite migration, fixing #954, and adds the NOT NULL constraint for updatetime and lastseen fields, making them consistent accross databases and migration paths.

jtojnar added 2 commits June 27, 2017 17:07
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.
@jtojnar jtojnar force-pushed the db-regularization branch from 337e121 to 0a8c04b Compare June 27, 2017 15:08
@jtojnar jtojnar merged commit 0a8c04b into master Jun 27, 2017
@jtojnar jtojnar deleted the db-regularization branch June 28, 2017 00:17
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.

1 participant