Adding migration
This commit is contained in:
@@ -302,9 +302,13 @@ async def reset_graph(pool: asyncpg.Pool) -> dict:
|
||||
"""
|
||||
async with pool.acquire() as conn:
|
||||
async with conn.transaction():
|
||||
# Order matters: FK constraints resolution_queue → soas, urd → soas
|
||||
rq = await conn.execute("DELETE FROM resolution_queue")
|
||||
# Delete order must respect FK constraints:
|
||||
# kg_write_log.resolution_queue_id → resolution_queue(id) [no cascade]
|
||||
# kg_write_log.{concept,parent,dim}_id → soas(id)
|
||||
# resolution_queue.{concept,existing_parent,incoming_parent,dim}_id → soas(id)
|
||||
# urd.{id,parent_id,dim_id} → soas(id)
|
||||
kw = await conn.execute("DELETE FROM kg_write_log")
|
||||
rq = await conn.execute("DELETE FROM resolution_queue")
|
||||
urd = await conn.execute("DELETE FROM urd")
|
||||
# Keep only common-English seeds (novelty = 0); delete domain words
|
||||
soas = await conn.execute("DELETE FROM soas WHERE novelty > 0")
|
||||
|
||||
Reference in New Issue
Block a user