feat(projects): projects table + owner_project FK; ProjectId/Project types

First commit of §7 multi-repo ownership. A 'project' is a repo-root that
declaratively manages a slice of the shared group tree; each group node is
owned by exactly one project (single-owner-per-node). This lands the registry
+ shared types and wires the inert 0047 `owner_project` seam — no behavior
change yet (claim logic is the next commit).

- migration 0066: `projects` table (UUID pk, unique slug, name, created_by →
  admin_users ON DELETE SET NULL); `groups.owner_project` gains its FK →
  projects(id) ON DELETE SET NULL (un-claim, never cascade-destroy a tree) +
  an index.
- shared: `ProjectId` (id_type! macro) + `Project` struct; `Group` gains
  `owner_project: Option<ProjectId>`.
- group_repo: GROUP_COLS + the ancestors recursive-CTE term now carry
  `owner_project`, so `ancestors()` surfaces ownership for the nearest-claimed
  fold; GroupRow + From updated.
- schema snapshot re-blessed; /version schema assertion 65 → 66.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
MechaCat02
2026-07-06 20:01:57 +02:00
parent f1730a1ba0
commit ba97c35aaf
8 changed files with 106 additions and 9 deletions

View File

@@ -891,12 +891,12 @@ async fn version_includes_public_base_url(pool: PgPool) {
assert!(v["public_base_url"].is_string());
assert_eq!(v["api"], 1);
// `schema` is migrations::latest_version() — the highest embedded
// migration number, currently 65 (…0064_shared_topic_queue_kinds,
// 0065_group_queues from the v1.2 D2/D3 deferrals). This test is
// migration number, currently 66 (…0065_group_queues, then
// 0066_projects wiring the §7 multi-repo ownership seam). This test is
// #[ignore]-gated so it doesn't run in the default `cargo test`; pinned to
// current reality so an unintended schema change is still caught. Bump it
// whenever a migration lands.
assert_eq!(v["schema"], 65);
assert_eq!(v["schema"], 66);
assert_eq!(v["sdk"], "1.10");
}