alter table xf_user_alert add column `sv_container_id` int(10) unsigned DEFAULT NULL;
UPDATE xf_user_alert AS alert
JOIN xf_post AS post ON (alert.content_type = 'post' AND alert.content_id = post.post_id)
SET alert.sv_container_id = post.thread_id
WHERE alert.sv_container_id IS NULL AND `action` in ('insert', 'op_insert')