fix: alembic 003 avoid :r bind param in fingerprint backfill SQL

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-28 09:47:35 +10:00
parent a4a224b284
commit 83f48dce97
@@ -26,9 +26,11 @@ def upgrade() -> None:
op.create_index("ix_problems_last_seen_at", "problems", ["last_seen_at"])
op.execute(
sa.text(
"""
UPDATE problems p SET
fingerprint = 'h' || COALESCE(p.host_id::text, '0') || ':r' || COALESCE(p.rule_id, 'unknown'),
fingerprint = 'h' || COALESCE(p.host_id::text, '0') || chr(58) || 'r'
|| COALESCE(p.rule_id, 'unknown'),
event_count = COALESCE(
(SELECT COUNT(*)::int FROM problem_events pe WHERE pe.problem_id = p.id),
1
@@ -36,6 +38,7 @@ def upgrade() -> None:
last_seen_at = COALESCE(p.updated_at, p.created_at)
"""
)
)
op.alter_column("problems", "fingerprint", nullable=False)
op.alter_column("problems", "last_seen_at", nullable=False)