-- Track the derived Bichon WebUI login username per mailbox.
--
-- Bichon caps login usernames at 32 chars (UserCreateRequest), but email
-- addresses can be longer, so WHP no longer uses the raw address as the Bichon
-- username — it derives a bounded, globally-unique value
-- (emailmgmt::deriveBichonUsername) and records it here so the panel can show
-- the customer their archive login.
--
-- Idempotent via ADD COLUMN IF NOT EXISTS (MariaDB).
USE whp;

ALTER TABLE whp.email_accounts
    ADD COLUMN IF NOT EXISTS bichon_username VARCHAR(64) NULL AFTER bichon_user_id;
