-- phpMyAdmin SQL Dump
-- version 5.0.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 20, 2023 at 08:05 AM
-- Server version: 10.4.17-MariaDB
-- PHP Version: 7.3.25

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: `rms_enhance`
--

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

--
-- Table structure for table `customer_deliveries`
--

CREATE TABLE `customer_deliveries` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `customer_id` bigint(20) UNSIGNED DEFAULT NULL,
  `package_id` bigint(20) UNSIGNED DEFAULT NULL,
  `delivery_company_id` bigint(20) UNSIGNED DEFAULT NULL,
  `delivery_time_id` bigint(20) UNSIGNED DEFAULT NULL,
  `date` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT 'not delivered',
  `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 `customer_deliveries`
--
ALTER TABLE `customer_deliveries`
  ADD PRIMARY KEY (`id`),
  ADD KEY `customer_deliveries_customer_id_foreign` (`customer_id`),
  ADD KEY `customer_deliveries_package_id_foreign` (`package_id`),
  ADD KEY `customer_deliveries_delivery_company_id_foreign` (`delivery_company_id`),
  ADD KEY `customer_deliveries_delivery_time_id_foreign` (`delivery_time_id`);

--
-- AUTO_INCREMENT for dumped tables
--

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `customer_deliveries`
--
ALTER TABLE `customer_deliveries`
  ADD CONSTRAINT `customer_deliveries_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `customer_deliveries_delivery_company_id_foreign` FOREIGN KEY (`delivery_company_id`) REFERENCES `delivery_companies` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `customer_deliveries_delivery_time_id_foreign` FOREIGN KEY (`delivery_time_id`) REFERENCES `delivery_times` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `customer_deliveries_package_id_foreign` FOREIGN KEY (`package_id`) REFERENCES `packages` (`id`) ON DELETE CASCADE;
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 */;
