-- https://www.phpmyadmin.net/
--

START TRANSACTION;



--
-- Database: `uber`
--

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

--
-- Table structure for table `all_statuses`
--

CREATE TABLE `all_statuses` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `all_statuses`
--

INSERT INTO `all_statuses` (`id`, `name`, `created_at`, `updated_at`) VALUES
(1, 'trip_request', '2019-09-02 13:48:52', '2019-09-02 13:48:52'),
(2, 'no_response', '2019-09-02 13:48:52', '2019-09-02 13:48:52'),
(3, 'accept_user', '2019-09-02 13:48:52', '2019-09-02 13:48:52'),
(4, 'reject_user', '2019-09-02 13:48:52', '2019-09-02 13:48:52'),
(5, 'accept_driver', '2019-09-02 13:48:52', '2019-09-02 13:48:52'),
(6, 'reject_driver', '2019-09-02 13:48:52', '2019-09-02 13:48:52'),
(7, 'arrive', '2019-09-02 13:48:52', '2019-09-02 13:48:52'),
(8, 'start_trip', '2019-09-02 13:48:52', '2019-09-02 13:48:52'),
(9, 'end_first_destination', '2019-09-02 13:48:52', '2019-09-02 13:48:52'),
(10, 'end_second_destination', '2019-09-02 13:48:52', '2019-09-02 13:48:52'),
(11, 'end_third_destination', '2019-09-02 13:48:52', '2019-09-02 13:48:52'),
(12, 'end_trip', '2019-09-02 13:48:52', '2019-09-02 13:48:52'),
(13, 'rate', '2019-09-02 13:48:52', '2019-09-02 13:48:52');

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

--
-- Table structure for table `cars`
--

CREATE TABLE `cars` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `country_id` bigint(20) UNSIGNED NOT NULL,
  `price` double(8,2) NOT NULL COMMENT 'price kilo',
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cars`
--

INSERT INTO `cars` (`id`, `country_id`, `price`, `deleted_at`, `created_at`, `updated_at`) VALUES
(1, 2, 2.50, NULL, '2019-09-01 13:21:09', '2019-09-01 13:21:09'),
(2, 2, 3.00, NULL, '2019-09-01 13:21:09', '2019-09-01 13:21:09');

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

--
-- Table structure for table `car_translations`
--

CREATE TABLE `car_translations` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `cars_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `locale` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `car_translations`
--

INSERT INTO `car_translations` (`id`, `cars_id`, `name`, `locale`) VALUES
(5, 1, 'يلا ميني', 'ar'),
(6, 1, 'Go mini', 'en'),
(7, 2, 'يلا', 'ar'),
(8, 2, 'Go', 'en');

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

--
-- Table structure for table `countries`
--

CREATE TABLE `countries` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `code` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `countries`
--

INSERT INTO `countries` (`id`, `code`, `created_at`, `updated_at`) VALUES
(1, '966', '2019-09-01 10:02:25', '2019-09-01 10:02:25'),
(2, '20', '2019-09-02 08:52:49', '2019-09-02 08:52:49'),
(3, '53', '2019-09-03 10:44:33', '2019-09-03 10:44:33');

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

--
-- Table structure for table `country_translations`
--

CREATE TABLE `country_translations` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `country_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `locale` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `country_translations`
--

INSERT INTO `country_translations` (`id`, `country_id`, `name`, `locale`) VALUES
(1, 1, 'الرياض', 'ar'),
(2, 1, 'Ryad', 'en'),
(5, 2, 'مصر', 'ar'),
(6, 2, 'Egypt', 'en'),
(7, 3, 'UAE', 'en'),
(8, 3, 'الإمارات', 'ar');

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

--
-- Table structure for table `driver_cars`
--

CREATE TABLE `driver_cars` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `driver_id` bigint(20) UNSIGNED NOT NULL,
  `model` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `color` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `plat_number` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `image` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `id_image` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `driving_license_image` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `car_license_image` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `driver_cars`
--

INSERT INTO `driver_cars` (`id`, `driver_id`, `model`, `color`, `plat_number`, `image`, `id_image`, `driving_license_image`, `car_license_image`, `created_at`, `updated_at`) VALUES
(1, 1, 'asd', 'asd', 'asd', '', '', '', '', '2019-09-03 06:42:30', '2019-09-03 06:42:30'),
(2, 1, 'asd', 'ddd', 'ddd', '', '', '', '', '2019-09-03 06:42:30', '2019-09-03 06:42:30');

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

--
-- Table structure for table `driver_credits`
--

CREATE TABLE `driver_credits` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `driver_id` bigint(20) UNSIGNED NOT NULL,
  `driver_credit` int(11) NOT NULL,
  `admin_credit` int(11) NOT NULL,
  `type` enum('1','2') COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '1 convert from bank, 2 payment online',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `driver_notifies`
--

CREATE TABLE `driver_notifies` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `driver_id` bigint(20) UNSIGNED NOT NULL,
  `trip_id` bigint(20) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `driver_notify_translations`
--

CREATE TABLE `driver_notify_translations` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `driver_notify_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `locale` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `messages`
--

CREATE TABLE `messages` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `driver_id` bigint(20) UNSIGNED NOT NULL,
  `body` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `sent` enum('user','driver') COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `migrations`
--

CREATE TABLE `migrations` (
  `id` int(10) UNSIGNED NOT NULL,
  `migration` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `migrations`
--

INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2014_10_12_100000_create_password_resets_table', 1),
(2, '2019_08_27_120820_verifications', 1),
(3, '2019_08_27_124401_user_notify', 1),
(4, '2019_08_27_124622_wallet', 1),
(5, '2019_08_27_130934_driver_notify', 1),
(6, '2019_08_27_131305_driver_credit', 1),
(7, '2019_08_27_135151_trips', 1),
(8, '2019_08_28_123607_cars', 1),
(9, '2019_08_28_123818_create_users_table', 1),
(10, '2019_08_28_130736_driver', 1),
(11, '2019_08_29_123817_country', 1),
(12, '2019_08_28_142947_messages', 2),
(13, '2019_08_28_143624_trip_paths', 2),
(14, '2019_08_28_143816_trip_active_requests', 2),
(15, '2019_08_28_152039_promo', 3),
(16, '2019_08_28_152105_promo_used', 3),
(17, '2019_09_01_093650_country_translations', 4),
(18, '2019_09_01_131457_car_translations', 5),
(20, '2019_09_01_145458_service_cars', 6),
(21, '2019_09_02_133000_all_statuses', 7),
(22, '2019_09_02_133111_trip_statuses', 8),
(23, '2019_09_02_141241_driver_cars', 9),
(24, '2019_09_03_125555_driver_notify_translations', 10);

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

--
-- Table structure for table `promo`
--

CREATE TABLE `promo` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `code` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `limit` int(11) DEFAULT NULL,
  `start_date` timestamp NULL DEFAULT NULL,
  `end_date` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `promo_used`
--

CREATE TABLE `promo_used` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `status` enum('0,1') COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '0 not_used, 1 used',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `service_cars`
--

CREATE TABLE `service_cars` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `country_id` bigint(20) UNSIGNED NOT NULL,
  `start` double(8,2) NOT NULL DEFAULT '0.00' COMMENT 'start counter',
  `wait` double(8,2) NOT NULL DEFAULT '0.00' COMMENT 'price waiting time',
  `minimum_fare` double(8,2) NOT NULL DEFAULT '0.00',
  `service_fees` double(8,2) NOT NULL DEFAULT '0.00',
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `service_cars`
--

INSERT INTO `service_cars` (`id`, `country_id`, `start`, `wait`, `minimum_fare`, `service_fees`, `deleted_at`, `created_at`, `updated_at`) VALUES
(1, 2, 11.50, 1.00, 10.00, 0.14, NULL, '2019-09-02 09:24:10', '2019-09-02 09:24:10');

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

--
-- Table structure for table `trips`
--

CREATE TABLE `trips` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `type` enum('urgent','scheduled') COLLATE utf8mb4_unicode_ci NOT NULL,
  `car_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `driver_id` bigint(20) UNSIGNED DEFAULT NULL,
  `order_action` tinyint(4) NOT NULL DEFAULT '0' COMMENT '1 completed, 2 canceled',
  `canceled_by` enum('','user','driver') COLLATE utf8mb4_unicode_ci NOT NULL,
  `feedback` text COLLATE utf8mb4_unicode_ci,
  `rate` double(8,2) NOT NULL DEFAULT '0.00',
  `total` double(8,2) NOT NULL DEFAULT '0.00',
  `date` date DEFAULT NULL,
  `time` time DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `trips`
--

INSERT INTO `trips` (`id`, `type`, `car_id`, `user_id`, `driver_id`, `order_action`, `canceled_by`, `feedback`, `rate`, `total`, `date`, `time`, `created_at`, `updated_at`) VALUES
(3, 'urgent', 1, 1, 1, 0, '', 'asdasd', 4.00, 0.00, '0000-00-00', '00:00:00', '2019-09-04 22:00:00', '2019-09-04 07:31:15'),
(4, 'urgent', 1, 1, NULL, 0, '', NULL, 0.00, 0.00, NULL, NULL, '2019-09-03 08:24:37', '2019-09-03 08:24:37');

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

--
-- Table structure for table `trip_active_requests`
--

CREATE TABLE `trip_active_requests` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `trip_id` bigint(20) UNSIGNED NOT NULL,
  `driver_id` bigint(20) UNSIGNED DEFAULT NULL,
  `user_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '1 accept, 2 reject',
  `driver_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '1 accept, 2 reject',
  `arrive` tinyint(4) NOT NULL DEFAULT '0' COMMENT '1 arrive',
  `time_out` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `trip_active_requests`
--

INSERT INTO `trip_active_requests` (`id`, `trip_id`, `driver_id`, `user_status`, `driver_status`, `arrive`, `time_out`, `created_at`, `updated_at`) VALUES
(1, 4, NULL, 0, 0, 0, '2019-09-03 22:02:00', '2019-09-03 08:24:37', '2019-09-03 08:24:37');

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

--
-- Table structure for table `trip_paths`
--

CREATE TABLE `trip_paths` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `trip_id` bigint(20) UNSIGNED NOT NULL,
  `type` enum('pick_up','where_to','where_second','where_third','end_trip') COLLATE utf8mb4_unicode_ci NOT NULL,
  `address` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `lat` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `lng` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `trip_paths`
--

INSERT INTO `trip_paths` (`id`, `trip_id`, `type`, `address`, `lat`, `lng`, `created_at`, `updated_at`) VALUES
(1, 3, 'pick_up', 'asdasd', '123', '123', '2019-09-04 11:17:11', '2019-09-04 11:17:11'),
(2, 3, 'where_to', 'ase', '345', '456', '2019-09-04 11:17:40', '2019-09-04 11:17:40'),
(3, 3, 'end_trip', 'sadasdddddddddd', '6677', '6777', '2019-09-04 11:17:40', '2019-09-04 11:17:40');

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

--
-- Table structure for table `trip_statuses`
--

CREATE TABLE `trip_statuses` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `trip_id` bigint(20) UNSIGNED NOT NULL,
  `status_id` bigint(20) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `trip_statuses`
--

INSERT INTO `trip_statuses` (`id`, `trip_id`, `status_id`, `created_at`, `updated_at`) VALUES
(2, 3, 1, '2019-09-03 06:47:51', '2019-09-03 06:47:51'),
(3, 3, 2, '2019-09-03 07:04:49', '2019-09-03 07:04:49');

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

--
-- Table structure for table `user_notifies`
--

CREATE TABLE `user_notifies` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `trip_id` bigint(20) UNSIGNED NOT NULL,
  `body` int(11) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `verifications`
--

CREATE TABLE `verifications` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `role` enum('user','driver') COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` enum('activate','reset') COLLATE utf8mb4_unicode_ci NOT NULL,
  `phone` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `code` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0 not activated, 1 activated',
  `expire_at` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `verifications`
--

INSERT INTO `verifications` (`id`, `role`, `type`, `phone`, `code`, `status`, `expire_at`, `created_at`, `updated_at`) VALUES
(1, 'user', 'activate', '0151496459', '4456', 0, '2019-09-04 13:18:46', '2019-09-04 10:18:46', '2019-09-04 10:18:46');

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

--
-- Table structure for table `wallets`
--

CREATE TABLE `wallets` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_d` bigint(20) UNSIGNED NOT NULL,
  `amount` double(8,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `all_statuses`
--
ALTER TABLE `all_statuses`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `cars`
--
ALTER TABLE `cars`
  ADD PRIMARY KEY (`id`),
  ADD KEY `country_id` (`country_id`);

--
-- Indexes for table `car_translations`
--
ALTER TABLE `car_translations`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `car_translations_cars_id_locale_unique` (`cars_id`,`locale`),
  ADD KEY `car_translations_locale_index` (`locale`);

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

--
-- Indexes for table `country_translations`
--
ALTER TABLE `country_translations`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `country_translations_country_id_locale_unique` (`country_id`,`locale`),
  ADD KEY `country_translations_locale_index` (`locale`);

--
-- Indexes for table `driver_cars`
--
ALTER TABLE `driver_cars`
  ADD PRIMARY KEY (`id`),
  ADD KEY `driver_cars_driver_id_foreign` (`driver_id`);

--
-- Indexes for table `driver_credits`
--
ALTER TABLE `driver_credits`
  ADD PRIMARY KEY (`id`),
  ADD KEY `driver_id` (`driver_id`);

--
-- Indexes for table `driver_notifies`
--
ALTER TABLE `driver_notifies`
  ADD PRIMARY KEY (`id`),
  ADD KEY `driver_id` (`driver_id`),
  ADD KEY `trip_id` (`trip_id`);

--
-- Indexes for table `driver_notify_translations`
--
ALTER TABLE `driver_notify_translations`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `driver_notify_translations_driver_notify_id_locale_unique` (`driver_notify_id`,`locale`),
  ADD KEY `driver_notify_translations_locale_index` (`locale`);

--
-- Indexes for table `messages`
--
ALTER TABLE `messages`
  ADD PRIMARY KEY (`id`),
  ADD KEY `messages_driver_id_foreign` (`driver_id`),
  ADD KEY `messages_user_id_foreign` (`user_id`);

--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `promo`
--
ALTER TABLE `promo`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `promo_used`
--
ALTER TABLE `promo_used`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`);

--
-- Indexes for table `service_cars`
--
ALTER TABLE `service_cars`
  ADD PRIMARY KEY (`id`),
  ADD KEY `service_cars_country_id_foreign` (`country_id`);

--
-- Indexes for table `trips`
--
ALTER TABLE `trips`
  ADD PRIMARY KEY (`id`),
  ADD KEY `car_id` (`car_id`),
  ADD KEY `user_id` (`user_id`),
  ADD KEY `driver_id` (`driver_id`);

--
-- Indexes for table `trip_active_requests`
--
ALTER TABLE `trip_active_requests`
  ADD PRIMARY KEY (`id`),
  ADD KEY `trip_active_requests_driver_id_foreign` (`driver_id`),
  ADD KEY `trip_active_requests_trip_id_foreign` (`trip_id`);

--
-- Indexes for table `trip_paths`
--
ALTER TABLE `trip_paths`
  ADD PRIMARY KEY (`id`),
  ADD KEY `trip_paths_trip_id_foreign` (`trip_id`);

--
-- Indexes for table `trip_statuses`
--
ALTER TABLE `trip_statuses`
  ADD PRIMARY KEY (`id`),
  ADD KEY `trip_statuses_trip_id_foreign` (`trip_id`),
  ADD KEY `trip_statuses_status_id_foreign` (`status_id`);

--
-- Indexes for table `user_notifies`
--
ALTER TABLE `user_notifies`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`),
  ADD KEY `trip_id` (`trip_id`);

--
-- Indexes for table `verifications`
--
ALTER TABLE `verifications`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `wallets`
--
ALTER TABLE `wallets`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_d` (`user_d`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `all_statuses`
--
ALTER TABLE `all_statuses`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;

--
-- AUTO_INCREMENT for table `cars`
--
ALTER TABLE `cars`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `car_translations`
--
ALTER TABLE `car_translations`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT for table `countries`
--
ALTER TABLE `countries`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `country_translations`
--
ALTER TABLE `country_translations`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT for table `driver_cars`
--
ALTER TABLE `driver_cars`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `driver_credits`
--
ALTER TABLE `driver_credits`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `driver_notifies`
--
ALTER TABLE `driver_notifies`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `driver_notify_translations`
--
ALTER TABLE `driver_notify_translations`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `messages`
--
ALTER TABLE `messages`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=25;

--
-- AUTO_INCREMENT for table `promo`
--
ALTER TABLE `promo`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `promo_used`
--
ALTER TABLE `promo_used`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `service_cars`
--
ALTER TABLE `service_cars`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `trips`
--
ALTER TABLE `trips`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `trip_active_requests`
--
ALTER TABLE `trip_active_requests`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `trip_paths`
--
ALTER TABLE `trip_paths`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `trip_statuses`
--
ALTER TABLE `trip_statuses`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `user_notifies`
--
ALTER TABLE `user_notifies`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `verifications`
--
ALTER TABLE `verifications`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `wallets`
--
ALTER TABLE `wallets`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `cars`
--
ALTER TABLE `cars`
  ADD CONSTRAINT `cars_ibfk_1` FOREIGN KEY (`country_id`) REFERENCES `countries` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `car_translations`
--
ALTER TABLE `car_translations`
  ADD CONSTRAINT `car_translations_cars_id_foreign` FOREIGN KEY (`cars_id`) REFERENCES `cars` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `country_translations`
--
ALTER TABLE `country_translations`
  ADD CONSTRAINT `country_translations_country_id_foreign` FOREIGN KEY (`country_id`) REFERENCES `countries` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `driver_cars`
--
ALTER TABLE `driver_cars`
  ADD CONSTRAINT `driver_cars_driver_id_foreign` FOREIGN KEY (`driver_id`) REFERENCES `drivers` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `driver_credits`
--
ALTER TABLE `driver_credits`
  ADD CONSTRAINT `driver_credits_ibfk_1` FOREIGN KEY (`driver_id`) REFERENCES `drivers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `driver_notifies`
--
ALTER TABLE `driver_notifies`
  ADD CONSTRAINT `driver_notifies_ibfk_1` FOREIGN KEY (`driver_id`) REFERENCES `drivers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `driver_notifies_ibfk_2` FOREIGN KEY (`trip_id`) REFERENCES `trips` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `driver_notify_translations`
--
ALTER TABLE `driver_notify_translations`
  ADD CONSTRAINT `driver_notify_translations_driver_notify_id_foreign` FOREIGN KEY (`driver_notify_id`) REFERENCES `driver_notifies` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `messages`
--
ALTER TABLE `messages`
  ADD CONSTRAINT `messages_driver_id_foreign` FOREIGN KEY (`driver_id`) REFERENCES `drivers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `messages_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `promo_used`
--
ALTER TABLE `promo_used`
  ADD CONSTRAINT `promo_used_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `service_cars`
--
ALTER TABLE `service_cars`
  ADD CONSTRAINT `service_cars_country_id_foreign` FOREIGN KEY (`country_id`) REFERENCES `countries` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `trips`
--
ALTER TABLE `trips`
  ADD CONSTRAINT `trips_ibfk_1` FOREIGN KEY (`car_id`) REFERENCES `cars` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `trips_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `trips_ibfk_3` FOREIGN KEY (`driver_id`) REFERENCES `drivers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `trip_active_requests`
--
ALTER TABLE `trip_active_requests`
  ADD CONSTRAINT `trip_active_requests_driver_id_foreign` FOREIGN KEY (`driver_id`) REFERENCES `drivers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `trip_active_requests_trip_id_foreign` FOREIGN KEY (`trip_id`) REFERENCES `trips` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `trip_paths`
--
ALTER TABLE `trip_paths`
  ADD CONSTRAINT `trip_paths_trip_id_foreign` FOREIGN KEY (`trip_id`) REFERENCES `trips` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `trip_statuses`
--
ALTER TABLE `trip_statuses`
  ADD CONSTRAINT `trip_statuses_status_id_foreign` FOREIGN KEY (`status_id`) REFERENCES `all_statuses` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `trip_statuses_trip_id_foreign` FOREIGN KEY (`trip_id`) REFERENCES `trips` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `user_notifies`
--
ALTER TABLE `user_notifies`
  ADD CONSTRAINT `user_notifies_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `user_notifies_ibfk_2` FOREIGN KEY (`trip_id`) REFERENCES `trips` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `wallets`
--
ALTER TABLE `wallets`
  ADD CONSTRAINT `wallets_ibfk_1` FOREIGN KEY (`user_d`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;

