feat(database): increment schema version to 20 and add notifications table with relevant indices

This commit is contained in:
2026-01-01 23:36:52 -06:00
parent d8af1836cd
commit 54700c0dee

View File

@@ -2,7 +2,7 @@ from .provider import DatabaseProvider
class DatabaseSchema:
LATEST_VERSION = 19
LATEST_VERSION = 20
def __init__(self, provider: DatabaseProvider):
self.provider = provider
@@ -247,6 +247,18 @@ class DatabaseSchema:
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
)
""",
"notifications": """
CREATE TABLE IF NOT EXISTS notifications (
id INTEGER PRIMARY KEY AUTOINCREMENT,
type TEXT,
remote_hash TEXT,
title TEXT,
content TEXT,
is_viewed INTEGER DEFAULT 0,
timestamp REAL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
)
""",
}
for table_name, create_sql in tables.items():
@@ -556,6 +568,26 @@ class DatabaseSchema:
"CREATE INDEX IF NOT EXISTS idx_call_history_remote_name ON call_history(remote_identity_name)",
)
if current_version < 20:
self.provider.execute("""
CREATE TABLE IF NOT EXISTS notifications (
id INTEGER PRIMARY KEY AUTOINCREMENT,
type TEXT,
remote_hash TEXT,
title TEXT,
content TEXT,
is_viewed INTEGER DEFAULT 0,
timestamp REAL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
)
""")
self.provider.execute(
"CREATE INDEX IF NOT EXISTS idx_notifications_remote_hash ON notifications(remote_hash)",
)
self.provider.execute(
"CREATE INDEX IF NOT EXISTS idx_notifications_timestamp ON notifications(timestamp)",
)
# Update version in config
self.provider.execute(
"""