matrix-gptbot/migrations/migration_3.py
Kumi 2bbc6a33ca
Moving migrations to subdirectory
Add option for custom system messages per room
Fixing some methods in store
2023-04-24 08:48:59 +00:00

24 lines
No EOL
617 B
Python

# 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()