1-- Insert/update labeler service on actors table (denormalized)
2-- Parameters: $1=actor_id, $2=cid(bytea), $3=reasons, $4=subject_types, $5=subject_collections
3-- NOTE: actor_id is provided by dispatcher after ensuring actor exists
4-- Sets labeler_* columns on actors table instead of separate labelers table
5UPDATE actors
6SET
7 labeler_cid = $2::bytea,
8 labeler_created_at = COALESCE(labeler_created_at, NOW()),
9 labeler_reasons = $3::text[]::reason_type[],
10 labeler_subject_types = $4::text[]::subject_type[],
11 labeler_subject_collections = $5,
12 labeler_status = 'complete'::labeler_status,
13 labeler_like_count = COALESCE(labeler_like_count, 0)
14WHERE id = $1