This commit is contained in:
ben de roo committed 2026-09-10 16:36:54 +02:00
1 parent cfbd561763
commit 0fd81f7abd
1 file changed
+29 -1
+29 -1
View File
@@ -12,7 +12,35 @@ try:
conn.execute("PRAGMA foreign_keys = ON;") conn.execute("PRAGMA foreign_keys = ON;")
cur = conn.cursor() cur = conn.cursor()
# Migrations cur.execute("""
CREATE TABLE IF NOT EXISTS room_invitations (
id INTEGER PRIMARY KEY AUTOINCREMENT,
room_id INTEGER NOT NULL,
email TEXT NOT NULL,
token_hash TEXT NOT NULL UNIQUE,
expires_at TEXT NOT NULL,
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
accepted_at TEXT,
FOREIGN KEY (room_id)
REFERENCES rooms(id)
ON DELETE CASCADE
);
""")
cur.execute("""
CREATE INDEX IF NOT EXISTS idx_room_invitations_token
ON room_invitations(token_hash);
""")
cur.execute("""
CREATE INDEX IF NOT EXISTS idx_room_invitations_room
ON room_invitations(room_id);
""")
conn.commit() conn.commit()