From 607b1be433ad1242c58a6bdfc48c887ee90282bc Mon Sep 17 00:00:00 2001 From: mina-esn Date: Sun, 16 Aug 2026 11:41:09 +0330 Subject: [PATCH] refactor: update database schema and remove obsolete SQL files --- ..._agency (4).sql => airline_agency (5).sql} | 87 ++++++++++++++++--- 1 file changed, 74 insertions(+), 13 deletions(-) rename database/backups/{airline_agency (4).sql => airline_agency (5).sql} (75%) diff --git a/database/backups/airline_agency (4).sql b/database/backups/airline_agency (5).sql similarity index 75% rename from database/backups/airline_agency (4).sql rename to database/backups/airline_agency (5).sql index ac7e117..5e5ad10 100644 --- a/database/backups/airline_agency (4).sql +++ b/database/backups/airline_agency (5).sql @@ -3,7 +3,7 @@ -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1:3306 --- Generation Time: Aug 15, 2026 at 12:25 PM +-- Generation Time: Aug 16, 2026 at 08:07 AM -- Server version: 8.4.7 -- PHP Version: 8.3.28 @@ -111,14 +111,23 @@ DROP TABLE IF EXISTS `cities`; CREATE TABLE IF NOT EXISTS `cities` ( `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, `county_id` bigint UNSIGNED NOT NULL, + `province_id` bigint UNSIGNED NOT NULL, `name` varchar(64) COLLATE utf8mb4_persian_ci NOT NULL, - `status` tinyint NOT NULL DEFAULT '0', + `status` tinyint NOT NULL DEFAULT '1' COMMENT '0:disable | 1:enable', `created_at` timestamp NOT NULL, `updated_at` timestamp NOT NULL, `deleted_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`), - KEY `cities_fk1` (`county_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_persian_ci; + KEY `cities_fk1` (`county_id`), + KEY `cities_fk2` (`province_id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 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); -- -------------------------------------------------------- @@ -135,7 +144,14 @@ CREATE TABLE IF NOT EXISTS `countries` ( `updated_at` timestamp NOT NULL, `deleted_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_persian_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_persian_ci; + +-- +-- Dumping data for table `countries` +-- + +INSERT INTO `countries` (`id`, `name`, `status`, `created_at`, `updated_at`, `deleted_at`) VALUES +(1, 'iran', 0, '2026-08-16 05:27:45', '2026-08-16 05:27:45', NULL); -- -------------------------------------------------------- @@ -154,7 +170,14 @@ CREATE TABLE IF NOT EXISTS `files` ( `created_at` timestamp NOT NULL, `updated_at` timestamp NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_persian_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_persian_ci; + +-- +-- Dumping data for table `files` +-- + +INSERT INTO `files` (`id`, `name`, `extension`, `size`, `original_name`, `path`, `created_at`, `updated_at`) VALUES +(1, '1786862535_73435.jpg', 'jpg', 25289, 'images (1).jpg', 'user_avatar/1786862535_73435.jpg', '2026-08-16 06:42:15', '2026-08-16 06:42:15'); -- -------------------------------------------------------- @@ -209,6 +232,30 @@ CREATE TABLE IF NOT EXISTS `passengers` ( -- -------------------------------------------------------- +-- +-- Table structure for table `provinces` +-- + +DROP TABLE IF EXISTS `provinces`; +CREATE TABLE IF NOT EXISTS `provinces` ( + `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, + `name` varchar(64) COLLATE utf8mb4_persian_ci NOT NULL, + `status` tinyint NOT NULL DEFAULT '1' COMMENT '0:disable | 1:enable', + `created_at` timestamp NOT NULL, + `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; + +-- +-- 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); + +-- -------------------------------------------------------- + -- -- Table structure for table `tours` -- @@ -263,7 +310,9 @@ CREATE TABLE IF NOT EXISTS `users` ( `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, `first_name` varchar(64) COLLATE utf8mb4_persian_ci NOT NULL, `last_name` varchar(64) COLLATE utf8mb4_persian_ci NOT NULL, - `file_id` bigint UNSIGNED NOT NULL, + `file_id` bigint UNSIGNED DEFAULT NULL, + `city_id` bigint UNSIGNED DEFAULT NULL, + `province_id` bigint UNSIGNED DEFAULT NULL, `national_code` varchar(10) COLLATE utf8mb4_persian_ci NOT NULL, `gender` tinyint UNSIGNED NOT NULL DEFAULT '0' COMMENT 'unknown:0 | male:1 | female:2', `marital_status` tinyint UNSIGNED NOT NULL DEFAULT '0' COMMENT '0:single | 1:married | divorced:2', @@ -272,14 +321,23 @@ CREATE TABLE IF NOT EXISTS `users` ( `email` varchar(150) COLLATE utf8mb4_persian_ci NOT NULL, `username` varchar(100) COLLATE utf8mb4_persian_ci NOT NULL, `password` varchar(255) COLLATE utf8mb4_persian_ci NOT NULL, - `user_province` varchar(100) COLLATE utf8mb4_persian_ci DEFAULT NULL, - `user_city` int DEFAULT NULL, + `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '0:disable | 1:enable', `created_at` timestamp NOT NULL, `updated_at` timestamp NOT NULL, `deleted_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`), - KEY `users_fk1` (`file_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_persian_ci; + KEY `users_fk1` (`file_id`), + KEY `users_fk2` (`province_id`), + KEY `users_fk3` (`city_id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_persian_ci; + +-- +-- Dumping data for table `users` +-- + +INSERT INTO `users` (`id`, `first_name`, `last_name`, `file_id`, `city_id`, `province_id`, `national_code`, `gender`, `marital_status`, `spouse_name`, `mobile`, `email`, `username`, `password`, `status`, `created_at`, `updated_at`, `deleted_at`) VALUES +(1, 'مینا', 'اسمعیل نژاد', 1, NULL, NULL, '2110932325', 2, 0, NULL, '09036097643', 'mina.esmaelnezhad20@gmail.com', 'mina1380', '$2y$12$kJQmWvJVCZSg0dnlQBRAKe7GNHjZth3GS.tZNWsIrgncl2iD2lXyO', 1, '2026-08-16 06:42:15', '2026-08-16 06:42:15', NULL), +(2, 'کیارش', 'مصطفی پور', NULL, NULL, NULL, '2110932324', 1, 0, NULL, '09366554264', 'kiarash@gmail.com', 'Kiarash1389', '$2y$12$sV5Nqy8Kr.JHFeTx.SC1a.t6jYdkDqDZbVuFLjupRvPd9sqg9S0H2', 1, '2026-08-16 07:24:44', '2026-08-16 07:24:44', NULL); -- -- Constraints for dumped tables @@ -297,7 +355,8 @@ ALTER TABLE `booking` -- Constraints for table `cities` -- ALTER TABLE `cities` - ADD CONSTRAINT `cities_fk1` FOREIGN KEY (`county_id`) REFERENCES `countries` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; + ADD CONSTRAINT `cities_fk1` FOREIGN KEY (`county_id`) REFERENCES `countries` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, + ADD CONSTRAINT `cities_fk2` FOREIGN KEY (`province_id`) REFERENCES `provinces` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; -- -- Constraints for table `flights` @@ -331,7 +390,9 @@ ALTER TABLE `tour_departures` -- Constraints for table `users` -- ALTER TABLE `users` - ADD CONSTRAINT `users_fk1` FOREIGN KEY (`file_id`) REFERENCES `files` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; + ADD CONSTRAINT `users_fk1` FOREIGN KEY (`file_id`) REFERENCES `files` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, + ADD CONSTRAINT `users_fk2` FOREIGN KEY (`province_id`) REFERENCES `provinces` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, + ADD CONSTRAINT `users_fk3` FOREIGN KEY (`city_id`) REFERENCES `cities` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;