ALTER TABLE maintenance_jobs
    MODIFY COLUMN workflow_stage ENUM(
        'Complaint Logged',
        'Maintenance Review',
        'Work Order Raised',
        'RFQ Sent',
        'Quote Submitted',
        'Quote Vetted',
        'Job Order Approved',
        'Workshop In Progress',
        'Inspection',
        'Internal Control',
        'Closed',
        'Requisition Raised',
        'Requisition Approved',
        'Requisition Rejected',
        'Payment Made',
        'Payment Not Made',
        'Suspended',
        'Cancelled'
    ) NOT NULL DEFAULT 'Complaint Logged';

ALTER TABLE maintenance_jobs
    MODIFY COLUMN status ENUM(
        'Pending',
        'Approved',
        'Rejected',
        'In Progress',
        'Completed',
        'Suspended',
        'Cancelled',
        'Closed',
        'Paid',
        'Not Paid',
        'Job Order Created',
        'Requisition Raised',
        'Requisition Approved',
        'Requisition Rejected',
        'Payment Made',
        'Payment Not Made'
    ) NULL DEFAULT 'Pending';

UPDATE maintenance_jobs
SET workflow_stage = 'Requisition Approved',
    status = 'Requisition Approved'
WHERE TRIM(requisition_status) = 'Approved';

UPDATE maintenance_jobs
SET workflow_stage = 'Requisition Rejected',
    status = 'Requisition Rejected'
WHERE TRIM(requisition_status) = 'Rejected';
