-
Notifications
You must be signed in to change notification settings - Fork 6
Conversation
Pull Request Test Coverage Report for Build 222
💛 - Coveralls |
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.
This still doesn't update get_last_pending_patch
, get_last_pending_patch_date
, and get_expired_pending_patches
, which would break sktm in various ways. Search for pendingpatches
in sktm/db.py
to find all the places to update. Please also update the FIXME
above the database creation script. Thank you!
README.md
Outdated
For example, if the database path is `.sktm.db` and migration `01-pending.sql` | ||
is being applied, the command will be | ||
|
||
sqlite3 .sktm.db < 01-pending.sql |
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.
Could we maybe have this (and paragraph above) use ~/.sktm.db
so it works as is with the default install, regardless of the current directory (which will probably be db_migrations
)?
Not necessary for my ACK.
db_migrations/01-pending.sql
Outdated
@@ -0,0 +1,11 @@ | |||
CREATE TABLE pendingpatches_tmp(id INTEGER PRIMARY KEY, pdate TEXT, |
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.
Can we have this named pendingpatches_new
for clarity?
Not necessary for my ACK.
sktm/db.py
Outdated
patchsource_id INTEGER, | ||
timestamp INTEGER, | ||
FOREIGN KEY(patchsource_id) REFERENCES patchsource(id) | ||
baseurl TEXT, |
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.
We need to add PRIMARY KEY(baseurl, id)
next, in a separate PR, to fix the bug mentioned in set_patchset_pending
description.
Not necessary for my ACK.
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.
Shouldn't be hard to add here 👍
sktm/db.py
Outdated
base URL"). | ||
specifed patch date, for specified Patchwork base URL, and marked with | ||
current timestamp. Replace any previously added patches with the same | ||
ID (bug: should be "same ID and base URL"). |
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.
This bug.
I must have messed up something during the rebases because I'm pretty sure I fixed those methods yesterday. Ah well, thanks for noticing! |
0e49f12
to
e9e5ddf
Compare
I dug around the SQL syntax a little and it seems we can simply change the delete statement to only match the baseurl and the patch id like this: DELETE FROM pendingpatches
WHERE patchsource_id IN (SELECT DISTINCT id
FROM patchsource
WHERE baseurl = ?) AND
id = ? E.g.: DELETE FROM pendingpatches
WHERE patchsource_id IN (SELECT DISTINCT id
FROM patchsource
WHERE baseurl = "https://patchwork.kernel.org") AND
id = 10451123 This way we won't have to update the schema at all, nor have duplication, nor so many code changes. |
That should work too. Agreed that we have a lot of DB stuff to fix later, and are only pushing there more and more things that we'll need to eventually fix. But for now, it should be fine. I'd still keep the migration infrastructure in a separate commit though, we'd need it :) |
Yes, let's keep the migration infrastructure. Thanks :) |
If the patch moved between Patchwork projects during the time it's being tested, it gets stuck in the pending patch table. Since patch IDs are unique per instance (and don't depend on the project), change the DELETE statement to get all known patchsource_ids with given URL and then remove the appropriate patch from the table. This allows us to function independently of where the patch moved. Fixes cki-project#57 Signed-off-by: Veronika Kabatova <vkabatov@redhat.com>
We will need it soon. Signed-off-by: Veronika Kabatova <vkabatov@redhat.com>
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.
Looks great, thank you, Veronika :)!
Fix bug with pending patch removal
If the patch moved between Patchwork projects during the time it's being
tested, it gets stuck in the pending patch table. Since patch IDs are
unique per instance (and don't depend on the project), change the
pending patch table to contain Patchwork instance's base URL in addition
to ID of (base URL, patch ID) pair. This solves the problem with patch
removal from pending table, while keeps the original information needed
for proper testing.
Also introduce a way to migrate the database after upgrades since it's
needed for this change.
Fixes #57
Signed-off-by: Veronika Kabatova vkabatov@redhat.com