-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
waku/v2/node/storage/migration/00003_convertTimestampsToInts.up.sql
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
CREATE TABLE IF NOT EXISTS Message_backup ( | ||
id BLOB PRIMARY KEY, | ||
receiverTimestamp REAL NOT NULL, | ||
contentTopic BLOB NOT NULL, | ||
pubsubTopic BLOB NOT NULL, | ||
payload BLOB, | ||
version INTEGER NOT NULL, | ||
senderTimestamp REAL NOT NULL | ||
) WITHOUT ROWID; | ||
|
||
|
||
INSERT INTO Message_backup SELECT id, receiverTimestamp, contentTopic, pubsubTopic, payload, version, senderTimestamp FROM Message; | ||
|
||
DROP TABLE Message; | ||
|
||
CREATE TABLE IF NOT EXISTS Message ( | ||
id BLOB PRIMARY KEY, | ||
receiverTimestamp INTEGER NOT NULL, | ||
contentTopic BLOB NOT NULL, | ||
pubsubTopic BLOB NOT NULL, | ||
payload BLOB, | ||
version INTEGER NOT NULL, | ||
senderTimestamp INTEGER NOT NULL | ||
) WITHOUT ROWID; | ||
|
||
|
||
INSERT INTO Message (id, receiverTimestamp, contentTopic, pubsubTopic, payload, version, senderTimestamp) | ||
SELECT id, FLOOR(receiverTimestamp*1000), contentTopic, pubsubTopic, payload, version, FLOOR(senderTimestamp*1000) | ||
FROM Message_backup; | ||
|
||
DROP TABLE Message_backup; |