Commit Graph

2 Commits

Author SHA1 Message Date
Rob Sherman a5a959ad50
feat(scripts): add --strategy flag with auto privilege detection for relocate fallback
Adds _can_defer_constraints() to probe whether the current role can ALTER
the sessions table's constraints, and _resolve_strategy() to resolve 'auto'
(the new default) to 'in_place' or 'create_new' based on that probe.

apply_moves() now defaults to strategy='auto' and raises MoveError on
unknown values instead of silently routing to create_new. The CLI gains
--strategy {auto,in_place,create_new} and the dry-run output shows which
concrete strategy will run.

Claude-Session: https://claude.ai/code/session_017E61SyPWyCgohR5wUwNXG7
2026-06-29 19:48:53 -07:00
Rob Sherman c0d6bc6f3b
feat(scripts): add tool to losslessly move sessions between workspaces
Adds scripts/move_session_workspace.py, an admin tool that relocates named
sessions (with their messages, embeddings, and conclusions) from one workspace
to another without data loss. Preserves session IDs in place via transaction-local
deferrable constraints, copies any missing target peers/collections full-column,
renames on collision, clears transient queue items, and asserts referential
integrity inside a single pg_dump-backed transaction. Dry-run by default; a
no-privilege create-new-row fallback exists for deployments that cannot defer
constraints. Includes 20 tests (tests/scripts/test_move_session_workspace.py).
2026-06-29 18:07:23 -07:00