Add tests and edit comments if the item they're replying to has been edited

This commit is contained in:
2023-09-02 15:52:26 -07:00
parent dfd40c55f5
commit b049a4359d
10 changed files with 522 additions and 78 deletions

View File

@@ -1,5 +1,8 @@
/* name: ItemExists :one */
SELECT COUNT(1) FROM replied_items WHERE item_type = ? AND id = ? AND updated_time = ?;
/* name: GetItem :one */
SELECT * FROM replied_items WHERE item_type = ? AND id = ? LIMIT 1;
/* name: AddItem :exec */
INSERT OR REPLACE INTO replied_items (id, item_type, updated_time) VALUES (?, ?, ?);
INSERT OR REPLACE INTO replied_items (id, reply_id, item_type, updated_time) VALUES (?, -1, ?, ?);
/* name: SetReplyID :exec */
UPDATE replied_items SET reply_id = ? WHERE id = ?;

View File

@@ -1,5 +1,6 @@
CREATE TABLE IF NOT EXISTS replied_items (
id INT NOT NULL PRIMARY KEY,
reply_id INT NOT NULL,
item_type TEXT NOT NULL CHECK( item_type IN ('p', 'c') ),
updated_time INT NOT NULL,
UNIQUE(id, item_type)