-- Migration: Optional per-bicycle late fee (AED per hour or per rental package day/hour unit)
-- Idempotent: safe to run more than once.

SET @dbname = DATABASE();
SET @exists = (
  SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
  WHERE TABLE_SCHEMA = @dbname AND TABLE_NAME = 'bicycles' AND COLUMN_NAME = 'late_fee_override'
);
SET @sql = IF(@exists = 0,
  'ALTER TABLE `bicycles` ADD COLUMN `late_fee_override` DECIMAL(12,2) NULL DEFAULT NULL COMMENT ''Late fee rate; NULL = use package or global default'' AFTER `notes`',
  'SELECT 1'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
