EDDN: messages.id AUTOINCREMENT, and index created & cmdr

We'll definitely want to query against `cmdr`, and possibly `created`.

We shouldn't need to against other fields, they'll just be checked during
processing of an already selected message.
This commit is contained in:
Athanasius authored and Athanasius committed 2022-11-22 14:01:59 +00:00
1 parent 9faae8b9bc
commit 072eadd893
1 file changed
+19 -1
+19 -1
View File
@@ -191,7 +191,7 @@ class EDDN:
"""
CREATE TABLE messages
(
id INT PRIMARY KEY NOT NULL,
id INTEGER PRIMARY KEY AUTOINCREMENT,
created TEXT NOT NULL,
cmdr TEXT NOT NULL,
edmc_version TEXT,
@@ -202,6 +202,24 @@ class EDDN:
"""
)
replaydb.execute(
"""
CREATE INDEX messages_created ON messages
(
created
)
"""
)
replaydb.execute(
"""
CREATE INDEX messages_cmdr ON messages
(
cmdr
)
"""
)
except sqlite3.OperationalError as e:
if str(e) != "table messages already exists":
raise e