-- phpMyAdmin SQL Dump
-- version 5.2.2
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Jul 29, 2025 at 03:49 PM
-- Server version: 10.11.13-MariaDB-cll-lve
-- PHP Version: 8.3.23

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `easepayn_sql4`
--

-- --------------------------------------------------------

--
-- Table structure for table `airlines`
--

CREATE TABLE `airlines` (
  `id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `logo` varchar(255) NOT NULL,
  `iata_code` varchar(2) NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `date_added` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `airlines`
--

INSERT INTO `airlines` (`id`, `name`, `logo`, `iata_code`, `is_active`, `date_added`) VALUES
(1, 'Arik Air', 'arik.png', 'W3', 1, '2025-07-21 01:35:40'),
(2, 'Air Peace', 'airpeace.png', 'P4', 1, '2025-07-21 01:35:40'),
(3, 'Dana Air', 'dana.png', '9J', 1, '2025-07-21 01:35:40'),
(4, 'Ibom Air', 'ibom.png', 'QI', 1, '2025-07-21 01:35:40'),
(5, 'Max Air', 'max.png', 'VM', 1, '2025-07-21 01:35:40'),
(6, 'Aero Contractors', 'aero.png', 'AJ', 0, '2025-07-21 01:35:40'),
(7, 'Overland Airways', 'overland.png', 'OJ', 1, '2025-07-21 01:35:40'),
(8, 'United Nigeria Airlines', 'unitedng.png', 'UN', 1, '2025-07-21 01:35:40');

-- --------------------------------------------------------

--
-- Table structure for table `airports`
--

CREATE TABLE `airports` (
  `id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `city` varchar(50) NOT NULL,
  `state` varchar(50) NOT NULL,
  `iata_code` varchar(3) NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `airports`
--

INSERT INTO `airports` (`id`, `name`, `city`, `state`, `iata_code`, `is_active`) VALUES
(1, 'Murtala Muhammed International Airport', 'Lagos', 'Lagos', 'LOS', 1),
(2, 'Nnamdi Azikiwe International Airport', 'Abuja', 'FCT', 'ABV', 1),
(3, 'Port Harcourt International Airport', 'Port Harcourt', 'Rivers', 'PHC', 1),
(4, 'Mallam Aminu Kano International Airport', 'Kano', 'Kano', 'KAN', 1),
(5, 'Akanu Ibiam International Airport', 'Enugu', 'Enugu', 'ENU', 1),
(6, 'Margaret Ekpo International Airport', 'Calabar', 'Cross River', 'CBQ', 1),
(7, 'Sam Mbakwe International Airport', 'Owerri', 'Imo', 'QOW', 1),
(8, 'Yakubu Gowon Airport', 'Jos', 'Plateau', 'JOS', 1),
(9, 'Kaduna International Airport', 'Kaduna', 'Kaduna', 'KAD', 1),
(10, 'Benin Airport', 'Benin City', 'Edo', 'BNI', 1),
(11, 'Sadiq Abubakar III International Airport', 'Sokoto', 'Sokoto', 'SKO', 1),
(12, 'Maiduguri International Airport', 'Maiduguri', 'Borno', 'MIU', 1);

-- --------------------------------------------------------

--
-- Table structure for table `bookings`
--

CREATE TABLE `bookings` (
  `id` int(11) NOT NULL,
  `unique_id` varchar(255) NOT NULL,
  `flight_id` int(11) NOT NULL,
  `booking_reference` varchar(10) NOT NULL,
  `passenger_name` varchar(100) NOT NULL,
  `passenger_email` varchar(100) NOT NULL,
  `passenger_phone` varchar(20) NOT NULL,
  `seat_number` varchar(5) DEFAULT NULL,
  `booking_date` datetime NOT NULL DEFAULT current_timestamp(),
  `travel_date` date NOT NULL,
  `amount_paid` decimal(10,2) NOT NULL,
  `status` enum('pending','confirmed','cancelled','completed') NOT NULL DEFAULT 'pending',
  `payment_reference` varchar(50) DEFAULT NULL,
  `admin_notes` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `bookings`
--

INSERT INTO `bookings` (`id`, `unique_id`, `flight_id`, `booking_reference`, `passenger_name`, `passenger_email`, `passenger_phone`, `seat_number`, `booking_date`, `travel_date`, `amount_paid`, `status`, `payment_reference`, `admin_notes`) VALUES
(1, 'USER123', 1, 'ABC123', 'John Adekunle', 'john@example.com', '08012345678', '12A', '2025-07-21 01:35:40', '2023-11-15', 35000.00, 'confirmed', 'PAY12345', 'Early check-in requested'),
(2, 'USER123', 3, 'DEF456', 'John Adekunle', 'john@example.com', '08012345678', '8B', '2025-07-21 01:35:40', '2023-11-20', 42000.00, 'completed', 'PAY67890', 'Flight completed successfully'),
(3, 'USER456', 2, 'GHI789', 'Chioma Eze', 'chioma@example.com', '08023456789', '15C', '2025-07-21 01:35:40', '2023-11-16', 38000.00, 'confirmed', 'PAY24680', NULL),
(4, 'USER789', 5, 'JKL012', 'Emeka Okoro', 'emeka@example.com', '08034567890', NULL, '2025-07-21 01:35:40', '2023-11-18', 40000.00, 'pending', NULL, NULL),
(5, 'USER456', 7, 'MNO345', 'Chioma Eze', 'chioma@example.com', '08023456789', '22D', '2025-07-21 01:35:40', '2023-11-22', 50000.00, 'confirmed', 'PAY13579', 'Vegetarian meal requested'),
(6, 'USER123', 4, 'PQR678', 'John Adekunle', 'john@example.com', '08012345678', '5A', '2025-07-21 01:35:40', '2023-11-25', 45000.00, 'cancelled', 'PAY11223', 'Cancelled due to personal reasons'),
(7, 'USER789', 6, 'STU901', 'Emeka Okoro', 'emeka@example.com', '08034567890', '10B', '2025-07-21 01:35:40', '2023-11-19', 48000.00, 'completed', 'PAY33445', NULL),
(8, 'USER456', 8, 'VWX234', 'Chioma Eze', 'chioma@example.com', '08023456789', NULL, '2025-07-21 01:35:40', '2023-11-21', 42000.00, 'pending', NULL, NULL),
(9, 'USER123', 9, 'YZA567', 'John Adekunle', 'john@example.com', '08012345678', '3C', '2025-07-21 01:35:40', '2023-11-23', 55000.00, 'confirmed', 'PAY55667', 'Window seat preferred'),
(10, 'USER789', 10, 'BCD890', 'Emeka Okoro', 'emeka@example.com', '08034567890', '7D', '2025-07-21 01:35:40', '2023-11-24', 38000.00, 'confirmed', 'PAY77889', NULL);

-- --------------------------------------------------------

--
-- Table structure for table `flights`
--

CREATE TABLE `flights` (
  `id` int(11) NOT NULL,
  `flight_number` varchar(10) NOT NULL,
  `airline_id` int(11) NOT NULL,
  `departure_airport_id` int(11) NOT NULL,
  `arrival_airport_id` int(11) NOT NULL,
  `departure_time` time NOT NULL,
  `arrival_time` time NOT NULL,
  `duration` int(11) NOT NULL COMMENT 'in minutes',
  `price` decimal(10,2) NOT NULL,
  `total_seats` int(11) NOT NULL,
  `available_seats` int(11) NOT NULL,
  `days_operational` varchar(7) NOT NULL COMMENT '1-7 for Monday-Sunday',
  `is_active` tinyint(1) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `flights`
--

INSERT INTO `flights` (`id`, `flight_number`, `airline_id`, `departure_airport_id`, `arrival_airport_id`, `departure_time`, `arrival_time`, `duration`, `price`, `total_seats`, `available_seats`, `days_operational`, `is_active`) VALUES
(1, 'P4731', 2, 1, 2, '07:00:00', '08:15:00', 75, 35000.00, 180, 145, '1234567', 1),
(2, 'W3234', 1, 2, 1, '09:30:00', '10:45:00', 75, 38000.00, 160, 120, '1234567', 1),
(3, '9J512', 3, 1, 3, '11:00:00', '12:00:00', 60, 42000.00, 120, 85, '123456', 1),
(4, 'QI201', 4, 2, 4, '13:15:00', '15:00:00', 105, 45000.00, 90, 45, '134567', 1),
(5, 'VM222', 5, 3, 2, '08:30:00', '09:45:00', 75, 40000.00, 140, 110, '23456', 1),
(6, 'UN101', 8, 1, 5, '10:00:00', '11:30:00', 90, 48000.00, 100, 75, '1234567', 1),
(7, 'P4890', 2, 4, 1, '14:00:00', '15:45:00', 105, 50000.00, 180, 150, '1234567', 1),
(8, 'OJ345', 7, 5, 2, '16:30:00', '17:45:00', 75, 42000.00, 80, 60, '2457', 1),
(9, 'QI205', 4, 2, 6, '12:00:00', '13:30:00', 90, 55000.00, 90, 40, '135', 1),
(10, '9J518', 3, 3, 1, '18:00:00', '19:00:00', 60, 38000.00, 120, 95, '1234567', 1);

--
-- Indexes for dumped tables
--

--
-- Indexes for table `airlines`
--
ALTER TABLE `airlines`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `iata_code` (`iata_code`);

--
-- Indexes for table `airports`
--
ALTER TABLE `airports`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `iata_code` (`iata_code`);

--
-- Indexes for table `bookings`
--
ALTER TABLE `bookings`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `booking_reference` (`booking_reference`),
  ADD KEY `unique_id` (`unique_id`),
  ADD KEY `flight_id` (`flight_id`);

--
-- Indexes for table `flights`
--
ALTER TABLE `flights`
  ADD PRIMARY KEY (`id`),
  ADD KEY `airline_id` (`airline_id`),
  ADD KEY `departure_airport_id` (`departure_airport_id`),
  ADD KEY `arrival_airport_id` (`arrival_airport_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `airlines`
--
ALTER TABLE `airlines`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT for table `airports`
--
ALTER TABLE `airports`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;

--
-- AUTO_INCREMENT for table `bookings`
--
ALTER TABLE `bookings`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;

--
-- AUTO_INCREMENT for table `flights`
--
ALTER TABLE `flights`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
