Skip to content

Commit

Permalink
randomblob() func used to populate attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
ABresting committed Nov 22, 2023
1 parent 33e7924 commit 2f3473d
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CREATE TABLE IF NOT EXISTS message (
id BLOB,
messageHash BLOB, -- Newly added, this will be populated with a counter value
storedAt INTEGER NOT NULL,
CONSTRAINT messageIndex PRIMARY KEY (storedAt, messageHash)
CONSTRAINT messageIndex PRIMARY KEY (messageHash)
) WITHOUT ROWID;


Expand All @@ -21,11 +21,7 @@ SELECT
mb.version,
mb.timestamp,
mb.id,
(
SELECT COUNT(*)
FROM message_backup AS mb2
WHERE mb2.storedAt <= mb.storedAt
) as messageHash, -- to populate the counter values
randomblob(32), -- to populate 32-byte random blob
mb.storedAt
FROM message_backup AS mb;

Expand Down

0 comments on commit 2f3473d

Please sign in to comment.