START TRANSACTION;

UPDATE quota_request
SET status = cast('CONFIRMED' AS quota_request_status)
WHERE status = cast('ORDERED' AS quota_request_status);

ALTER TYPE quota_request_status
    RENAME TO _quota_request_status;

create type quota_request_status as enum ('NEW', 'CANCELLED', 'REJECTED', 'APPLIED', 'CONFIRMED', 'READY_FOR_REVIEW');

ALTER TABLE quota_request
    ALTER COLUMN status TYPE quota_request_status USING status :: text :: quota_request_status;

DROP TYPE _quota_request_status;

COMMIT;