MCPcopy Create free account
hub / github.com/cortexkit/magic-context / delete_session_fact

Function delete_session_fact

packages/dashboard/src-tauri/src/db.rs:4479–4490  ·  view source on GitHub ↗
(conn: &mut Connection, fact_id: i64)

Source from the content-addressed store, hash-verified

4477}
4478
4479pub fn delete_session_fact(conn: &mut Connection, fact_id: i64) -> Result<usize, rusqlite::Error> {
4480 // Phase A: read the fact's owning session before opening the transaction.
4481 let session_id = lookup_session_fact_session_id(conn, fact_id)?;
4482
4483 // Phase B: re-check, bump before delete, then delete.
4484 let tx = conn.transaction_with_behavior(TransactionBehavior::Immediate)?;
4485 verify_session_fact_session_unchanged(&tx, fact_id, &session_id)?;
4486 bump_session_facts_version_for_session(&tx, &session_id)?;
4487 let affected = tx.execute("DELETE FROM session_facts WHERE id = ?1", params![fact_id])?;
4488 tx.commit()?;
4489 Ok(affected)
4490}
4491
4492pub fn update_note(
4493 conn: &Connection,