fix(drift_repository): CAST(:param AS jsonb) 取代 :param::jsonb
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled

asyncpg 不支援 named param 混用 :: cast 語法,導致 PostgresSyntaxError。
改用 CAST() 函數語法,與 SQLAlchemy text() named params 相容。

影響: drift_reports 現在可正常寫入 DB

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OG T
2026-04-10 00:22:43 +08:00
parent 25412807f5
commit 5d591c4639

View File

@@ -92,7 +92,7 @@ class DriftReportRepository:
VALUES
(:report_id, :namespace, :triggered_by, :scanned_at,
:high_count, :medium_count, :info_count,
:items::jsonb, :interpretation::jsonb, :status, :created_at, :resolved_at)
CAST(:items AS jsonb), CAST(:interpretation AS jsonb), :status, :created_at, :resolved_at)
ON CONFLICT (report_id) DO UPDATE SET
items = EXCLUDED.items,
interpretation = EXCLUDED.interpretation,
@@ -144,7 +144,7 @@ class DriftReportRepository:
await db.execute(
text("""
UPDATE drift_reports
SET interpretation = :interpretation::jsonb
SET interpretation = CAST(:interpretation AS jsonb)
WHERE report_id = :report_id
"""),
{