fix(ci): harden migration workflow audit
All checks were successful
Code Review / ai-code-review (push) Successful in 11s

This commit is contained in:
Your Name
2026-05-12 23:29:17 +08:00
parent 1a62c322bc
commit f318fd3a89
2 changed files with 32 additions and 4 deletions

View File

@@ -6307,6 +6307,29 @@ RLS app context:
project_context=awoooi total=312 redacted_total=0 envelope_total=0
```
**Migration CI 紅燈修正**
- 首次推版後 `run-migration.yml` run `1914` 失敗在 `Seed asset_discovery_run (audit)`
- `psql -c` 不展開 `:'commit_sha'` / `:'files_json'` 變數,造成 syntax error。
- 同一 workflow 也把 `_down.sql` 當新增 migration 套用,導致 up migration 後又被 rollback。
- 已手動確認 production 欄位曾被 `_down.sql` 移除,並立即重新套回 up migration。
- workflow 修正:
- `Identify new migrations` 跳過 `*_down.sql` / `*rollback.sql`
- audit SQL 改用 heredoc 餵給 `psql`,讓 `-v` 變數正常展開。
```text
ruby YAML.load_file(".gitea/workflows/run-migration.yml")
# yaml ok
bash -n Identify new migrations / Seed asset_discovery_run extracted scripts
# bash syntax ok
Identify new migrations local dry-run:
apps/api/migrations/awooop_phase7_outbound_truth_chain_columns_2026-05-12.sql
Rollback/down migrations skipped:
apps/api/migrations/awooop_phase7_outbound_truth_chain_columns_2026-05-12_down.sql
```
**下一步**
- 推 Gitea main讓 API image 部署 T1 程式碼。