fix: alembic 003 avoid :r bind param in fingerprint backfill SQL
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -26,15 +26,18 @@ def upgrade() -> None:
|
||||
op.create_index("ix_problems_last_seen_at", "problems", ["last_seen_at"])
|
||||
|
||||
op.execute(
|
||||
"""
|
||||
UPDATE problems p SET
|
||||
fingerprint = 'h' || COALESCE(p.host_id::text, '0') || ':r' || COALESCE(p.rule_id, 'unknown'),
|
||||
event_count = COALESCE(
|
||||
(SELECT COUNT(*)::int FROM problem_events pe WHERE pe.problem_id = p.id),
|
||||
1
|
||||
),
|
||||
last_seen_at = COALESCE(p.updated_at, p.created_at)
|
||||
"""
|
||||
sa.text(
|
||||
"""
|
||||
UPDATE problems p SET
|
||||
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
|
||||
),
|
||||
last_seen_at = COALESCE(p.updated_at, p.created_at)
|
||||
"""
|
||||
)
|
||||
)
|
||||
|
||||
op.alter_column("problems", "fingerprint", nullable=False)
|
||||
|
||||
Reference in New Issue
Block a user