Compare commits

..

2 commits

View file

@ -496,11 +496,8 @@ def _migrate(conn_factory):
("users", "profil_sichtbarkeit", "TEXT NOT NULL DEFAULT 'public'"), ("users", "profil_sichtbarkeit", "TEXT NOT NULL DEFAULT 'public'"),
("users", "avatar_url", "TEXT"), ("users", "avatar_url", "TEXT"),
("places", "telefon", "TEXT"), ("places", "telefon", "TEXT"),
# Chat: Foto-Versand # Chat: Foto-Versand + Read Receipts — nur wenn Tabelle existiert (wird später per CREATE IF NOT EXISTS angelegt)
("direct_messages", "media_url", "TEXT"), # Hinweis: Wird nach dem direct_messages-CREATE unten nochmal als separate Migration behandelt
("direct_messages", "media_type", "TEXT"),
# Chat: Read Receipts
("direct_messages", "read_at", "TEXT"),
# Chat: Online-Indikator # Chat: Online-Indikator
("users", "last_seen", "TEXT"), ("users", "last_seen", "TEXT"),
# Foto-Editor: Zoom + Position # Foto-Editor: Zoom + Position
@ -779,6 +776,11 @@ def _migrate(conn_factory):
); );
CREATE INDEX IF NOT EXISTS idx_dm_conv ON direct_messages(conversation_id, created_at ASC); CREATE INDEX IF NOT EXISTS idx_dm_conv ON direct_messages(conversation_id, created_at ASC);
""") """)
# Chat-Spalten sicher nach CREATE hinzufügen
_dm_cols = [r[1] for r in conn.execute("PRAGMA table_info(direct_messages)").fetchall()]
for _col, _typedef in [("media_url", "TEXT"), ("media_type", "TEXT"), ("read_at", "TEXT")]:
if _col not in _dm_cols:
conn.execute(f"ALTER TABLE direct_messages ADD COLUMN {_col} {_typedef}")
# Wiki: Rassen-Datenbank (TheDogAPI) # Wiki: Rassen-Datenbank (TheDogAPI)
conn.executescript(""" conn.executescript("""