SET NAMES utf8mb4;

SET @db = DATABASE();

SET @sql = IF (
    EXISTS (
        SELECT 1
        FROM INFORMATION_SCHEMA.COLUMNS
        WHERE TABLE_SCHEMA = @db
          AND TABLE_NAME = 'order_items'
          AND COLUMN_NAME = 'source_product_id'
          AND IS_NULLABLE = 'YES'
    ),
    'SELECT 1',
    'ALTER TABLE order_items MODIFY COLUMN source_product_id BIGINT UNSIGNED NULL'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
