retronews

a featureful fork of the luke8086/retronews hn+lobste.rs tui
Log | Files | Refs | README | LICENSE

commit 97702cc537a12c53622b7674486e8c2ac8b2f989
parent a0b44168ed4f3be1aa1daca064f4301a5beb87b0
Author: luke8086 <55237178+luke8086@users.noreply.github.com>
Date:   Wed, 27 Jul 2022 22:09:08 +0000

Add db index on messages.thread_id

Diffstat:
Mretronews.py | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/retronews.py b/retronews.py @@ -389,12 +389,14 @@ def db_init() -> sqlite3.Connection: CREATE TABLE IF NOT EXISTS messages ( id TEXT NOT NULL PRIMARY KEY, thread_id TEXT NOT NULL, - flags JSON NOT NULL) + flags JSON NOT NULL); + + CREATE INDEX IF NOT EXISTS messages_thread_id ON messages (thread_id); """ db = sqlite3.connect(path) db.row_factory = sqlite3.Row - db.execute(create_table_sql) + db.executescript(create_table_sql) db.commit() return db