本卡屬 FR-155(母卡 CM-2977 https://app.notion.com/p/FR-155-RBAC-tab-4-11-400346da4cd081c1b7ffce63ec77390d),第 6 批 T-6.1:寫 188 基線庫(決策者 2026-10-22 已裁示放行)。等第 5 批全過。
新客戶安裝時用的不是一支一支 migration,而是一份「長好的」資料庫結構檔與種子檔。本案加了角色表新欄、專案能力點、每租戶四個專案角色,這些還沒進那兩份檔。這一棒把 188 上的基線庫套到本案為止的 migration,再從它重產結構檔與種子檔。
基線庫:192.168.50.188:25432 guidant_ai(cmmgr,密碼與 DEV 同組,看 .env)
~/Projects/Billows/Audit-Manager/compliance-manager-be/scripts/init/README.md regenerate 鐵則(開工先讀完)
~/Projects/Billows/Audit-Manager/compliance-manager-be/scripts/init/gen_schema_sql.sh、gen_seed_sql.sh、gen_stamp_sql.sh
~/Projects/Billows/Audit-Manager/compliance-manager-be/scripts/sql/manifest.tsv 本案 migration:2026-10-21-fr155-project-roles-schema、-seed-project-roles、-backfill-project-role-id、T-5.1 的 -drop-two-unused-capabilities
~/Projects/Billows/Audit-Manager/compliance-manager-be/.claude/skills/sql-migration/SKILL.md「出貨基線同步」段
psql -h 192.168.50.188 -p 25432 -d guidant_ai -Atc "select version from schema_migrations order by applied_at desc limit 5" 看基線庫套到哪,與 manifest.tsv 對,列出缺的(memory:補套依 manifest 順序,不只套本案的)。--single-transaction -v ON_ERROR_STOP=1)。基線庫只有租戶 1,seed 會建四個專案角色;project_participants 若有列要回填。gen_schema_sql.sh → 02-schema.sql;gen_seed_sql.sh → 04-seed-core.sql(T-2.2 已把產生器改成只吐 kind='system',專案角色由 tenant_provisioning 建;確認 04 裡沒有 kind='project' 列);gen_stamp_sql.sh → 99-stamp.sql。grep -n "kind\|is_default_owner" scripts/init/02-schema.sql 有 roles 兩欄;grep -c "proj\." scripts/init/04-seed-core.sql = 13(能力點列);用乾淨 docker postgres 跑 scripts/init/ 全套(README 有指令),裝完 select count(*) from capabilities where module='proj' = 13、select count(*) from roles where kind='project' = 4(精靈建的租戶)。git diff --stat scripts/init/ 貼進回寫;三支檔一起 commit。/srv/guidant-ai stack(那是 STG/POC)。feature/FR-139(BE ~/Projects/Billows/Audit-Manager/compliance-manager-be、FE ~/Projects/Billows/Audit-Manager/compliance-manager-fe、套件 ~/Projects/Jedicogy/module/jedi-python-package),在當前 branch 工作、不切 branch;動 git 前先 git status,有不是自己的改動就停下回報。pyproject.toml:118-128 對應註解行打開、poetry update <套件名>);path 改動不 commit、不發版、不推 Nexus。common/authz/、common/code/flow_control_error_code.py、docs/claude/domain-capabilities.md)。localhost:5432,密碼看 .env 的 DB_PASSWORD),用 cmmgr:psql --single-transaction -v ON_ERROR_STOP=1 -f <檔>;絕不碰 STG/POC。pytest test/test_module_boundaries.py test/test_project_role_literal_guard.py test/test_project_caps_not_in_tenant_expansion.py -q。不跑全量 pytest。git add <檔名>(禁 -am)commit(做了什麼/為什麼/怎麼驗/踩了什麼坑)→ 本卡 append 白話回寫(含 commit hash、手測清單)→ 狀態改「修正待驗證」。不等令。push 等決策者明示。