Sprint 16: Chat-Fotos/Online/Read-Receipts, Gesundheit-Dokumente löschen, Bugfixes
- Chat: Foto-Versand (POST /api/chat/conversations/{id}/upload, media_url/media_type)
- Chat: Online-Indikator (last_seen Heartbeat, grüner Dot, 3min-Fenster)
- Chat: Read Receipts (read_at, Einzel-/Doppelhaken-Icons)
- Gesundheit: Dokument löschen (DELETE .../dokument, Datei + DB-Eintrag)
- Bug: events.user_id NOT NULL → nullable (Table-Recreation-Migration)
- Bug: scheduler INSERT user_id 0 → NULL
- Bug: Wikidata Rate-Limit: sleep 0.3s→1.0s, retries 2→4, exponentielles Backoff
- SW: by-v146, APP_VER 119
This commit is contained in:
parent
34f29f9d0a
commit
a7753c9cf5
15 changed files with 375 additions and 43 deletions
|
|
@ -453,6 +453,13 @@ 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: Online-Indikator
|
||||
("users", "last_seen", "TEXT"),
|
||||
]
|
||||
with conn_factory() as conn:
|
||||
for table, column, col_type in migrations:
|
||||
|
|
@ -648,3 +655,35 @@ def _migrate(conn_factory):
|
|||
CREATE INDEX IF NOT EXISTS idx_dog_shares_user ON dog_shares(shared_with_id);
|
||||
""")
|
||||
logger.info("Migration: dog_shares Tabelle bereit.")
|
||||
|
||||
# Events: user_id NOT NULL Constraint entfernen (für Scheduler-Imports ohne User)
|
||||
row = conn.execute(
|
||||
"SELECT notnull FROM pragma_table_info('events') WHERE name='user_id'"
|
||||
).fetchone()
|
||||
if row and row[0] == 1:
|
||||
conn.executescript("""
|
||||
CREATE TABLE IF NOT EXISTS events_new (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
user_id INTEGER,
|
||||
titel TEXT NOT NULL,
|
||||
datum TEXT NOT NULL,
|
||||
uhrzeit TEXT,
|
||||
lat REAL,
|
||||
lon REAL,
|
||||
ort_name TEXT,
|
||||
typ TEXT NOT NULL DEFAULT 'sonstiges',
|
||||
beschreibung TEXT,
|
||||
link TEXT,
|
||||
status TEXT NOT NULL DEFAULT 'aktiv',
|
||||
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
||||
quelle TEXT NOT NULL DEFAULT 'nutzer',
|
||||
external_id TEXT
|
||||
);
|
||||
INSERT OR IGNORE INTO events_new SELECT * FROM events;
|
||||
DROP TABLE events;
|
||||
ALTER TABLE events_new RENAME TO events;
|
||||
CREATE INDEX IF NOT EXISTS idx_events_datum ON events(datum ASC);
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS idx_events_external
|
||||
ON events(external_id) WHERE external_id IS NOT NULL;
|
||||
""")
|
||||
logger.info("Migration: events.user_id NOT NULL Constraint entfernt.")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue