-- +mixmaker Up
ALTER TABLE events DROP CONSTRAINT IF EXISTS events_state_check;
ALTER TABLE events ADD CONSTRAINT events_state_check CHECK (state IN (
    'RegistrationOpen', 'RegistrationClosed', 'Balancing',
    'RostersDraft', 'RostersConfirmed', 'Live', 'Completed', 'Cancelled'
));

-- +mixmaker Down
UPDATE events SET state = 'Completed' WHERE state = 'Cancelled';
ALTER TABLE events DROP CONSTRAINT IF EXISTS events_state_check;
ALTER TABLE events ADD CONSTRAINT events_state_check CHECK (state IN (
    'RegistrationOpen', 'RegistrationClosed', 'Balancing',
    'RostersDraft', 'RostersConfirmed', 'Live', 'Completed'
));
