-- One-time backfill: align existing domain status with linked subscription status
update public.plesk_domains d
set status = coalesce(s.status, 'unknown')
from public.plesk_subscriptions s
where d.subscription_id = s.id
  and d.agency_id = s.agency_id;

update public.plesk_subscriptions
set status = 'unknown'
where status is null;