diff --git a/database/backups/airline_agency (5).sql b/database/backups/airline_agency (6).sql similarity index 83% rename from database/backups/airline_agency (5).sql rename to database/backups/airline_agency (6).sql index 5e5ad10..caf1619 100644 --- a/database/backups/airline_agency (5).sql +++ b/database/backups/airline_agency (6).sql @@ -1,9 +1,9 @@ --- phpMyAdmin SQL Dump +- phpMyAdmin SQL Dump -- version 5.2.3 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1:3306 --- Generation Time: Aug 16, 2026 at 08:07 AM +-- Generation Time: Aug 16, 2026 at 01:33 PM -- Server version: 8.4.7 -- PHP Version: 8.3.28 @@ -31,13 +31,22 @@ DROP TABLE IF EXISTS `airlines`; CREATE TABLE IF NOT EXISTS `airlines` ( `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, `name` varchar(64) COLLATE utf8mb4_persian_ci NOT NULL, - `country` varchar(64) COLLATE utf8mb4_persian_ci NOT NULL, + `country_id` bigint UNSIGNED NOT NULL, `phone` varchar(11) COLLATE utf8mb4_persian_ci NOT NULL, `status` tinyint NOT NULL DEFAULT '1', `created_at` timestamp NOT NULL, `updated_at` timestamp NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_persian_ci; + PRIMARY KEY (`id`), + KEY `airlines_fk1` (`country_id`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_persian_ci; + +-- +-- Dumping data for table `airlines` +-- + +INSERT INTO `airlines` (`id`, `name`, `country_id`, `phone`, `status`, `created_at`, `updated_at`) VALUES +(1, 'ماهان', 1, '', 1, '2026-08-16 11:22:55', '2026-08-16 11:22:55'), +(3, 'ایرانایر', 1, '', 1, '2026-08-16 11:23:26', '2026-08-16 11:23:26'); -- -------------------------------------------------------- @@ -49,13 +58,22 @@ DROP TABLE IF EXISTS `airports`; CREATE TABLE IF NOT EXISTS `airports` ( `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, `name` varchar(100) COLLATE utf8mb4_persian_ci NOT NULL, - `city` varchar(64) COLLATE utf8mb4_persian_ci NOT NULL, - `country` varchar(100) COLLATE utf8mb4_persian_ci NOT NULL, + `city_id` bigint UNSIGNED NOT NULL, `status` tinyint NOT NULL DEFAULT '0' COMMENT '0:active | 1:inactive', `created_at` timestamp NOT NULL, `updated_at` timestamp NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_persian_ci; + PRIMARY KEY (`id`), + KEY `airports_fk1` (`city_id`) +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_persian_ci; + +-- +-- Dumping data for table `airports` +-- + +INSERT INTO `airports` (`id`, `name`, `city_id`, `status`, `created_at`, `updated_at`) VALUES +(3, 'مهرآباد', 2, 0, '2026-08-16 11:33:52', '2026-08-16 11:33:52'), +(4, 'امام خمینی', 1, 0, '2026-08-16 11:33:52', '2026-08-16 11:33:52'), +(5, 'شهید بهشتی', 3, 0, '2026-08-16 11:36:53', '2026-08-16 11:36:53'); -- -------------------------------------------------------- @@ -120,14 +138,16 @@ CREATE TABLE IF NOT EXISTS `cities` ( PRIMARY KEY (`id`), KEY `cities_fk1` (`county_id`), KEY `cities_fk2` (`province_id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_persian_ci; +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_persian_ci; -- -- Dumping data for table `cities` -- INSERT INTO `cities` (`id`, `county_id`, `province_id`, `name`, `status`, `created_at`, `updated_at`, `deleted_at`) VALUES -(1, 1, 1, 'ساری', 1, '2026-08-16 05:28:05', '2026-08-16 05:28:05', NULL); +(1, 1, 1, 'ساری', 1, '2026-08-16 05:28:05', '2026-08-16 05:28:05', NULL), +(2, 1, 2, 'تهران', 1, '2026-08-16 11:32:54', '2026-08-16 11:32:54', NULL), +(3, 1, 3, 'اصفهان', 1, '2026-08-16 11:34:51', '2026-08-16 11:34:51', NULL); -- -------------------------------------------------------- @@ -191,7 +211,9 @@ CREATE TABLE IF NOT EXISTS `flights` ( `airline_id` bigint UNSIGNED NOT NULL, `origin_airport_id` bigint UNSIGNED NOT NULL, `destination_airport_id` bigint UNSIGNED NOT NULL, + `file_id` bigint UNSIGNED DEFAULT NULL, `flight_number` varchar(20) COLLATE utf8mb4_persian_ci NOT NULL, + `trip_type` tinyint NOT NULL DEFAULT '0' COMMENT '0:One-way | 1:round-trip', `departure_time` datetime NOT NULL, `price` int UNSIGNED NOT NULL, `capacity` int UNSIGNED NOT NULL, @@ -201,8 +223,17 @@ CREATE TABLE IF NOT EXISTS `flights` ( PRIMARY KEY (`id`), KEY `flights_fk1` (`airline_id`), KEY `flights_fk2` (`origin_airport_id`), - KEY `flights_fk3` (`destination_airport_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_persian_ci; + KEY `flights_fk3` (`destination_airport_id`), + KEY `flights_fk4` (`file_id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_persian_ci; + +-- +-- Dumping data for table `flights` +-- + +INSERT INTO `flights` (`id`, `airline_id`, `origin_airport_id`, `destination_airport_id`, `file_id`, `flight_number`, `trip_type`, `departure_time`, `price`, `capacity`, `status`, `created_at`, `updated_at`) VALUES +(1, 3, 4, 5, NULL, '1122334455', 0, '2026-08-16 11:36:57', 10000000, 100, 0, '2026-08-16 11:37:43', '2026-08-16 11:37:43'), +(2, 1, 5, 4, NULL, '1122334466', 1, '2026-08-16 13:10:14', 10000000, 100, 0, '2026-08-16 13:10:55', '2026-08-16 13:10:55'); -- -------------------------------------------------------- @@ -245,14 +276,16 @@ CREATE TABLE IF NOT EXISTS `provinces` ( `updated_at` timestamp NOT NULL, `deleted_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_persian_ci; +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_persian_ci; -- -- Dumping data for table `provinces` -- INSERT INTO `provinces` (`id`, `name`, `status`, `created_at`, `updated_at`, `deleted_at`) VALUES -(1, 'مازندران', 1, '2026-08-16 05:27:10', '2026-08-16 05:27:10', NULL); +(1, 'مازندران', 1, '2026-08-16 05:27:10', '2026-08-16 05:27:10', NULL), +(2, 'تهران', 1, '2026-08-16 11:32:42', '2026-08-16 11:32:42', NULL), +(3, 'اصفهان', 1, '2026-08-16 11:34:36', '2026-08-16 11:34:36', NULL); -- -------------------------------------------------------- @@ -288,8 +321,8 @@ DROP TABLE IF EXISTS `tour_departures`; CREATE TABLE IF NOT EXISTS `tour_departures` ( `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, `tour_id` bigint UNSIGNED NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, + `start_date` datetime NOT NULL, + `end_date` datetime NOT NULL, `price` bigint UNSIGNED NOT NULL, `capacity` int UNSIGNED NOT NULL, `status` tinyint NOT NULL DEFAULT '0' COMMENT '0:active | 1:sold out | 2:canceled', @@ -343,6 +376,18 @@ INSERT INTO `users` (`id`, `first_name`, `last_name`, `file_id`, `city_id`, `pro -- Constraints for dumped tables -- +-- +-- Constraints for table `airlines` +-- +ALTER TABLE `airlines` + ADD CONSTRAINT `airlines_fk1` FOREIGN KEY (`country_id`) REFERENCES `countries` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; + +-- +-- Constraints for table `airports` +-- +ALTER TABLE `airports` + ADD CONSTRAINT `airports_fk1` FOREIGN KEY (`city_id`) REFERENCES `cities` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; + -- -- Constraints for table `booking` -- @@ -364,7 +409,8 @@ ALTER TABLE `cities` ALTER TABLE `flights` ADD CONSTRAINT `flights_fk1` FOREIGN KEY (`airline_id`) REFERENCES `airlines` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, ADD CONSTRAINT `flights_fk2` FOREIGN KEY (`origin_airport_id`) REFERENCES `airports` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - ADD CONSTRAINT `flights_fk3` FOREIGN KEY (`destination_airport_id`) REFERENCES `airports` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; + ADD CONSTRAINT `flights_fk3` FOREIGN KEY (`destination_airport_id`) REFERENCES `airports` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, + ADD CONSTRAINT `flights_fk4` FOREIGN KEY (`file_id`) REFERENCES `files` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; -- -- Constraints for table `passengers`