Merge: direct_messages Migration-Fix

This commit is contained in:
rene 2026-04-29 20:12:15 +02:00
commit a06b7862ab

View file

@ -496,11 +496,8 @@ def _migrate(conn_factory):
("users", "profil_sichtbarkeit", "TEXT NOT NULL DEFAULT 'public'"),
("users", "avatar_url", "TEXT"),
("places", "telefon", "TEXT"),
# Chat: Foto-Versand
("direct_messages", "media_url", "TEXT"),
("direct_messages", "media_type", "TEXT"),
# Chat: Read Receipts
("direct_messages", "read_at", "TEXT"),
# Chat: Foto-Versand + Read Receipts — nur wenn Tabelle existiert (wird später per CREATE IF NOT EXISTS angelegt)
# Hinweis: Wird nach dem direct_messages-CREATE unten nochmal als separate Migration behandelt
# Chat: Online-Indikator
("users", "last_seen", "TEXT"),
# 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);
""")
# 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)
conn.executescript("""