USE whp;

-- The 2026-05-13-account-suspensions.sql migration originally created
-- accounts_disabled and account_disable_audit with the DB default collation
-- (utf8mb4_general_ci on some hosts), but whp.sites.username and
-- whp.site_domains.fqdn are utf8mb4_unicode_ci. A LEFT JOIN of
-- accounts_disabled.username against sites.username throws "Illegal mix of
-- collations" — the accounts-search admin endpoint failed with an empty
-- response body.
--
-- A prior pass of this migration converted both new tables to general_ci
-- (the wrong direction — that flipped which side of the JOIN was incompatible).
-- This pass converts them to unicode_ci, matching the WHP convention for
-- textual columns. Idempotent: re-running CONVERT TO is a no-op if the
-- target collation is already in place.
ALTER TABLE whp.accounts_disabled
    CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

ALTER TABLE whp.account_disable_audit
    CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
