UPDATE booked_slot
SET status = 'CANCELED'
WHERE status = 'CANCELLED';

UPDATE booked_slot
SET status = 'FAILED'
WHERE status = 'CRASHED';

UPDATE booked_slot
SET status = 'FINISHED'
WHERE status = 'COMPLETED';

ALTER TABLE booked_slot
    DROP CONSTRAINT IF EXISTS chk_booked_slot_status;

ALTER TABLE booked_slot
    ADD CONSTRAINT chk_booked_slot_status
        CHECK (status IN ('BOOKED', 'PROCESSED', 'FINISHED', 'CANCELED', 'FAILED', 'FAILED_TIMEOUT'));

CREATE INDEX IF NOT EXISTS idx_booked_slot_status
    ON booked_slot(status);
