fn rebuild_table(conn: &Connection, spec: &TableSpec) -> Result<usize, String>Expand description
Rebuild one table so its agent_id FK targets db_agents instead of
db_agent_definitions. Rows whose agent_id has no db_agents row at
all are dropped (logged) rather than left to violate the new FK — the
gap-repair pass immediately before this loop is what makes that count
zero in the overwhelmingly common case.