update main.py
kaasislekker
This commit is contained in:
@@ -37,6 +37,21 @@ CREATE TABLE IF NOT EXISTS email_verifications (
|
||||
""")
|
||||
|
||||
|
||||
cur.execute("""
|
||||
CREATE TABLE IF NOT EXISTS password_reset_tokens (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
user_id INTEGER NOT NULL,
|
||||
token_hash TEXT NOT NULL UNIQUE,
|
||||
expires_at TEXT NOT NULL,
|
||||
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (user_id)
|
||||
REFERENCES users(id)
|
||||
ON DELETE CASCADE
|
||||
);
|
||||
""")
|
||||
|
||||
|
||||
cur.execute("""
|
||||
CREATE TABLE IF NOT EXISTS rooms (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
@@ -155,32 +170,43 @@ CREATE INDEX IF NOT EXISTS idx_room_members_user
|
||||
ON room_members(user_id);
|
||||
""")
|
||||
|
||||
|
||||
cur.execute("""
|
||||
CREATE INDEX IF NOT EXISTS idx_events_room
|
||||
ON events(room_id);
|
||||
""")
|
||||
|
||||
|
||||
cur.execute("""
|
||||
CREATE INDEX IF NOT EXISTS idx_event_invitations_user
|
||||
ON event_invitations(user_id);
|
||||
""")
|
||||
|
||||
|
||||
cur.execute("""
|
||||
CREATE INDEX IF NOT EXISTS idx_event_invitations_event
|
||||
ON event_invitations(event_id);
|
||||
""")
|
||||
|
||||
|
||||
cur.execute("""
|
||||
CREATE INDEX IF NOT EXISTS idx_event_signups_user
|
||||
ON event_signups(user_id);
|
||||
""")
|
||||
|
||||
|
||||
cur.execute("""
|
||||
CREATE INDEX IF NOT EXISTS idx_email_verifications_user
|
||||
ON email_verifications(user_id);
|
||||
""")
|
||||
|
||||
|
||||
cur.execute("""
|
||||
CREATE INDEX IF NOT EXISTS idx_password_reset_tokens_user
|
||||
ON password_reset_tokens(user_id);
|
||||
""")
|
||||
|
||||
|
||||
conn.commit()
|
||||
|
||||
print("Database initialized.")
|
||||
|
||||
Reference in New Issue
Block a user