ALTER TABLE heroes
    ADD COLUMN hero_model_variant integer;

UPDATE heroes
SET hero_model_variant = floor(random() * 3)::int
WHERE hero_model_variant IS NULL;

ALTER TABLE heroes
    ALTER COLUMN hero_model_variant SET NOT NULL;

ALTER TABLE heroes
    ALTER COLUMN hero_model_variant SET DEFAULT floor(random() * 3)::int;

ALTER TABLE heroes
    ADD CONSTRAINT heroes_hero_model_variant_check
    CHECK (hero_model_variant BETWEEN 0 AND 2);
