From 9300fd4b3a9db45d905fa406cdb347e4623c0ca9 Mon Sep 17 00:00:00 2001 From: G <28568419+s1fr0@users.noreply.github.com> Date: Thu, 3 Feb 2022 22:02:53 +0100 Subject: [PATCH] Add files via upload --- .../00003_convertTimestampsToInts.up.sql | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 waku/v2/node/storage/migration/00003_convertTimestampsToInts.up.sql diff --git a/waku/v2/node/storage/migration/00003_convertTimestampsToInts.up.sql b/waku/v2/node/storage/migration/00003_convertTimestampsToInts.up.sql new file mode 100644 index 0000000000..1e64e370ce --- /dev/null +++ b/waku/v2/node/storage/migration/00003_convertTimestampsToInts.up.sql @@ -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; \ No newline at end of file