-- Database schema for manual flight time overrides
-- Run this SQL to create the table for storing manual flight times

CREATE TABLE IF NOT EXISTS `EventFlightTimes` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `EventId` int(11) NOT NULL,
  `flight` int(11) NOT NULL,
  `tee` int(11) NOT NULL DEFAULT 1,
  `manualStartTime` time NOT NULL,
  `isManualOverride` tinyint(1) NOT NULL DEFAULT 1,
  `createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_event_flight_tee` (`EventId`, `flight`, `tee`),
  KEY `idx_event_flight` (`EventId`, `flight`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
