-- Backfill creators as subscribers
INSERT INTO issue_subscriber (issue_id, user_type, user_id, reason)
SELECT id, creator_type, creator_id, 'creator'
FROM issue
ON CONFLICT DO NOTHING;

-- Backfill assignees as subscribers
INSERT INTO issue_subscriber (issue_id, user_type, user_id, reason)
SELECT id, assignee_type, assignee_id, 'assignee'
FROM issue
WHERE assignee_type IS NOT NULL AND assignee_id IS NOT NULL
ON CONFLICT DO NOTHING;
