Phase 3: Add path size inference and also bin some stupid migration tests while we're at it

This commit is contained in:
Jack Kingsman
2026-03-07 19:02:37 -08:00
parent e0d7c8a083
commit f97c846378
6 changed files with 35 additions and 46 deletions
+7 -4
View File
@@ -25,8 +25,8 @@ class ContactRepository:
await db.conn.execute(
"""
INSERT INTO contacts (public_key, name, type, flags, last_path, last_path_len,
last_advert, lat, lon, last_seen, on_radio, last_contacted,
first_seen)
last_advert, lat, lon, last_seen,
on_radio, last_contacted, first_seen)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
ON CONFLICT(public_key) DO UPDATE SET
name = COALESCE(excluded.name, contacts.name),
@@ -200,9 +200,12 @@ class ContactRepository:
return [ContactRepository._row_to_contact(row) for row in rows]
@staticmethod
async def update_path(public_key: str, path: str, path_len: int) -> None:
async def update_path(
public_key: str, path: str, path_len: int
) -> None:
await db.conn.execute(
"UPDATE contacts SET last_path = ?, last_path_len = ?, last_seen = ? WHERE public_key = ?",
"""UPDATE contacts SET last_path = ?, last_path_len = ?,
last_seen = ? WHERE public_key = ?""",
(path, path_len, int(time.time()), public_key.lower()),
)
await db.conn.commit()