ALTER TABLE orders
    ADD COLUMN internal_order_number VARCHAR(11) NULL AFTER id,
    ADD UNIQUE KEY orders_internal_order_number_unique (internal_order_number);

UPDATE orders
SET internal_order_number = CONCAT('OP', LPAD(id, 9, '0'))
WHERE internal_order_number IS NULL OR internal_order_number = '';
