status-go/protocol/migrations/sqlite/1698137562_fix_encryption_k...

27 lines
758 B
MySQL
Raw Permalink Normal View History

CREATE TABLE hash_ratchet_encryption_v2 (
group_id BLOB NOT NULL,
deprecated_key_id INT NOT NULL,
key BLOB NOT NULL,
key_timestamp BLOB,
key_id BLOB NOT NULL,
PRIMARY KEY(key_id) ON CONFLICT REPLACE
);
INSERT INTO hash_ratchet_encryption_v2(group_id, deprecated_key_id, key, key_id) SELECT group_id, key_id, key, group_id || key_id FROM hash_ratchet_encryption;
2023-10-27 14:24:50 +00:00
DROP TABLE hash_ratchet_encryption_cache;
DROP TABLE hash_ratchet_encryption;
ALTER TABLE hash_ratchet_encryption_v2 RENAME TO hash_ratchet_encryption;
UPDATE hash_ratchet_encryption SET key_timestamp = deprecated_key_id;
CREATE TABLE hash_ratchet_encryption_cache (
group_id BLOB NOT NULL,
key_id int NOT NULL,
seq_no INTEGER,
hash BLOB NOT NULL,
sym_enc_key BLOB
);