Fix: direct_messages Migration-Reihenfolge für frische DBs; Staging produktionsbereit — SW by-v513, APP_VER 490
This commit is contained in:
parent
041af92306
commit
27d847ce31
1 changed files with 7 additions and 5 deletions
|
|
@ -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("""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue