-- @database: main
--
-- "Official" accounts — the platform's own team accounts, designated by an
-- administrator, which regular users CANNOT block.
--
-- Why a dedicated flag rather than reusing `is_verified`: the blue check marks
-- authenticity (a creator, a partner), while this flag grants a real power —
-- an official account keeps reach over every user, who cannot opt out of its
-- comments, reactions or follows. Conflating the two would silently make every
-- verified creator unblockable. `user_type` was no help either: it is uniform
-- across the base (987k rows share one value), a legacy column carrying no
-- meaning.
--
-- Mutable ONLY through `PUT /admin/users/{hex}/official`, which journals the
-- change in `hxa_bo.user_action_log` — same arrangement as `is_verified`, so
-- designating a team account is always attributable to an operator.
--
-- The index is on `(is_official)` and stays tiny: the column is 0 for
-- virtually every row, so it only ever serves "list the official accounts",
-- never a scan.

ALTER TABLE `user`
    ADD COLUMN `is_official` TINYINT(1) NOT NULL DEFAULT 0 AFTER `is_verified`,
    ADD KEY `idx_user_official` (`is_official`);
