fix: content_script_version_4.nim: migration failed when dropping unexisting constraing (#2672)

This commit is contained in:
Ivan FB 2024-05-06 18:22:50 +02:00 committed by GitHub
parent a46d4451eb
commit 38f8b08c7c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -2,7 +2,6 @@ const ContentScriptVersion_4* =
""" """
ALTER TABLE IF EXISTS messages_backup RENAME TO messages; ALTER TABLE IF EXISTS messages_backup RENAME TO messages;
ALTER TABLE messages RENAME TO messages_backup; ALTER TABLE messages RENAME TO messages_backup;
ALTER TABLE messages_backup DROP CONSTRAINT messageIndex;
CREATE TABLE IF NOT EXISTS messages ( CREATE TABLE IF NOT EXISTS messages (
pubsubTopic VARCHAR NOT NULL, pubsubTopic VARCHAR NOT NULL,
@ -64,6 +63,8 @@ INSERT INTO messages (
storedAt storedAt
FROM messages_backup; FROM messages_backup;
CREATE INDEX IF NOT EXISTS i_query ON messages (contentTopic, pubsubTopic, storedAt, id);
DROP TABLE messages_backup; DROP TABLE messages_backup;
UPDATE version SET version = 4 WHERE version = 3; UPDATE version SET version = 4 WHERE version = 3;