-- +mixmaker Up
UPDATE players
SET tank_rating = LEAST(GREATEST(tank_rating, 1), 40),
    damage_rating = LEAST(GREATEST(damage_rating, 1), 40),
    support_rating = LEAST(GREATEST(support_rating, 1), 40);

ALTER TABLE players
    DROP CONSTRAINT IF EXISTS players_tank_rating_check,
    DROP CONSTRAINT IF EXISTS players_damage_rating_check,
    DROP CONSTRAINT IF EXISTS players_support_rating_check,
    ADD CONSTRAINT players_tank_rating_check CHECK (tank_rating BETWEEN 1 AND 40),
    ADD CONSTRAINT players_damage_rating_check CHECK (damage_rating BETWEEN 1 AND 40),
    ADD CONSTRAINT players_support_rating_check CHECK (support_rating BETWEEN 1 AND 40);

-- +mixmaker Down
ALTER TABLE players
    DROP CONSTRAINT IF EXISTS players_tank_rating_check,
    DROP CONSTRAINT IF EXISTS players_damage_rating_check,
    DROP CONSTRAINT IF EXISTS players_support_rating_check,
    ADD CONSTRAINT players_tank_rating_check CHECK (tank_rating BETWEEN 1 AND 100),
    ADD CONSTRAINT players_damage_rating_check CHECK (damage_rating BETWEEN 1 AND 100),
    ADD CONSTRAINT players_support_rating_check CHECK (support_rating BETWEEN 1 AND 100);
