SET @has_approved_charge_amount := (
  SELECT COUNT(*)
  FROM information_schema.COLUMNS
  WHERE TABLE_SCHEMA = DATABASE()
    AND TABLE_NAME = 'print_error_logs'
    AND COLUMN_NAME = 'approved_charge_amount'
);
SET @sql_add_approved_charge_amount := IF(@has_approved_charge_amount = 0,
  'ALTER TABLE print_error_logs ADD COLUMN approved_charge_amount DECIMAL(15,2) NULL AFTER charge_amount',
  'SELECT 1'
);
PREPARE stmt_add_approved_charge_amount FROM @sql_add_approved_charge_amount;
EXECUTE stmt_add_approved_charge_amount;
DEALLOCATE PREPARE stmt_add_approved_charge_amount;
