fix(topology): delete topology_mutations in delete-cascade

delete_topology_cascade manually deletes status_events, edges, deckies
and lans but overlooked topology_mutations, so deleting any topology
that ever had a mutation enqueued (i.e. edits while active|degraded)
failed with an FK IntegrityError. Add the missing DELETE and extend
the cascade test to seed a mutation row.
This commit is contained in:
2026-04-22 17:50:30 -04:00
parent 3f460bab84
commit 5704e8fcce
2 changed files with 5 additions and 0 deletions

View File

@@ -1111,6 +1111,10 @@ class SQLModelRepository(BaseRepository):
text("DELETE FROM lans WHERE topology_id = :t"),
params,
)
await session.execute(
text("DELETE FROM topology_mutations WHERE topology_id = :t"),
params,
)
result = await session.execute(
select(Topology).where(Topology.id == topology_id)
)