matrix-gptbot/migrations/migration_3.py

24 lines
617 B
Python
Raw Permalink Normal View History

# Migration for custom system messages
from datetime import datetime
def migration(conn):
with conn.cursor() as cursor:
cursor.execute(
"""
CREATE TABLE IF NOT EXISTS system_messages (
room_id TEXT NOT NULL,
message_id TEXT NOT NULL,
user_id TEXT NOT NULL,
body TEXT NOT NULL,
timestamp BIGINT NOT NULL,
)
"""
)
cursor.execute(
"INSERT INTO migrations (id, timestamp) VALUES (3, ?)",
(datetime.now(),)
)
conn.commit()