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

START TRANSACTION;



--
-- Database: `dcmanager`
--

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

--
-- Table structure for table `achat_articles`
--

CREATE TABLE `achat_articles` (
  `id` int(10) UNSIGNED NOT NULL,
  `mouvement_article_id` int(10) UNSIGNED NOT NULL,
  `provider_id` int(10) UNSIGNED NOT NULL,
  `net_price` double NOT NULL,
  `unit_price` double NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `achat_articles`
--

INSERT INTO `achat_articles` (`id`, `mouvement_article_id`, `provider_id`, `net_price`, `unit_price`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, 1, 2500, 3500, '2022-11-13 09:09:31', '2022-11-13 09:09:31', NULL),
(2, 2, 2, 1500, 1000, '2022-11-13 10:07:42', '2022-11-13 10:07:42', NULL),
(3, 3, 1, 2500, 550, '2022-11-13 12:13:40', '2022-11-13 12:13:40', NULL);

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

--
-- Table structure for table `articles`
--

CREATE TABLE `articles` (
  `id` int(10) UNSIGNED NOT NULL,
  `code` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` enum('produit','service','consommable','stockable','non stockable') COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `stock` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `safety_stock` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `for_sale` tinyint(1) NOT NULL DEFAULT 0,
  `sub_category_article_id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `site_id` int(10) UNSIGNED NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `articles`
--

INSERT INTO `articles` (`id`, `code`, `name`, `type`, `description`, `stock`, `safety_stock`, `for_sale`, `sub_category_article_id`, `user_id`, `site_id`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'ART-Ca-so-Ar6370933e9a8f7', 'Article 1', 'produit', 'une descriptio', 43, 12, 1, 1, 1, 1, '2022-11-13 06:48:30', '2022-11-13 06:48:30', NULL),
(2, 'ART-Ca-so-Ar63709366973f0', 'Article 2', 'produit', 'une description', 63, 10, 1, 2, 1, 2, '2022-11-13 06:49:10', '2022-11-13 06:49:10', NULL),
(3, 'ART-Ca-so-Ar6370d0b534b60', 'Article 3', 'service', 'une description', 1, 1, 1, 1, 1, 2, '2022-11-13 11:10:45', '2022-11-13 11:10:45', NULL),
(4, 'ART-Ca-so-Ar6370d2f1155da', 'Article 4', 'service', 'ok ok', 1, 1, 1, 1, 1, 2, '2022-11-13 11:20:17', '2022-11-13 11:20:17', NULL);

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

--
-- Table structure for table `category_articles`
--

CREATE TABLE `category_articles` (
  `id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `category_articles`
--

INSERT INTO `category_articles` (`id`, `user_id`, `name`, `description`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, 'Catégorie 1', 'une descriptio,', '2022-11-13 06:46:35', '2022-11-13 06:46:35', NULL),
(2, 1, 'Categorie 2', 'hello', '2022-11-13 06:46:57', '2022-11-13 06:46:57', NULL);

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

--
-- Table structure for table `clients`
--

CREATE TABLE `clients` (
  `id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `site_id` int(10) UNSIGNED NOT NULL,
  `firstname` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `lastname` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `phone` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `birthday` date NOT NULL,
  `gender` enum('feminin','masculin') COLLATE utf8mb4_unicode_ci NOT NULL,
  `langue` enum('English','Français') COLLATE utf8mb4_unicode_ci NOT NULL,
  `has_company` tinyint(1) NOT NULL DEFAULT 0,
  `company_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `company_occupation` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `company_address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `company_country` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `company_city` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `clients`
--

INSERT INTO `clients` (`id`, `user_id`, `site_id`, `firstname`, `lastname`, `email`, `phone`, `birthday`, `gender`, `langue`, `has_company`, `company_name`, `company_occupation`, `company_address`, `company_country`, `company_city`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, 1, 'Jean', 'De Dieu', NULL, '0229554554', '2022-11-09', 'masculin', 'Français', 0, NULL, NULL, NULL, NULL, NULL, '2022-11-14 17:42:54', '2022-11-14 17:42:54', NULL),
(2, 1, 1, 'Paul', 'Dossouza', NULL, '74545454', '2022-11-23', 'masculin', 'Français', 0, 'ok ok', 'okok', NULL, NULL, NULL, '2022-11-14 18:09:45', '2022-11-14 18:09:45', NULL),
(3, 1, 1, 'Noelly', 'Houza', NULL, '451142454', '2022-11-17', 'feminin', 'Français', 0, NULL, NULL, NULL, NULL, NULL, '2022-11-14 18:17:06', '2022-11-14 18:17:06', NULL),
(4, 1, 1, 'Miguelle', 'Heriton', NULL, '54545', '2022-11-15', 'feminin', 'English', 0, 'hello', 'okoko', NULL, NULL, NULL, '2022-11-14 18:25:54', '2022-11-14 18:25:54', NULL),
(5, 1, 1, 'jeanne', 'Cordion', NULL, '545454', '2022-11-16', 'masculin', 'English', 0, 'hello', 'sdfg', NULL, NULL, NULL, '2022-11-14 18:30:00', '2022-11-14 18:30:00', NULL),
(6, 1, 1, 'doriane', 'helo', NULL, 'hello', '2022-11-15', 'feminin', 'Français', 0, NULL, NULL, NULL, NULL, NULL, '2022-11-14 18:32:39', '2022-11-14 18:32:39', NULL),
(7, 1, 1, 'Tossou', 'Jacob', NULL, '675285693', '2022-12-14', 'feminin', 'Français', 0, NULL, NULL, NULL, 'CI', NULL, '2022-12-16 02:35:24', '2022-12-17 06:08:59', NULL),
(8, 1, 1, 'Eclo', 'HEy', NULL, '652452556', '2022-12-14', 'feminin', 'Français', 0, NULL, NULL, NULL, 'BF', NULL, '2022-12-16 04:53:08', '2022-12-16 04:53:08', NULL);

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

--
-- Table structure for table `client_tags`
--

CREATE TABLE `client_tags` (
  `id` int(10) UNSIGNED NOT NULL,
  `tag_id` int(10) UNSIGNED NOT NULL,
  `client_id` int(10) UNSIGNED NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `client_tags`
--

INSERT INTO `client_tags` (`id`, `tag_id`, `client_id`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 2, 8, '2022-12-17 13:41:05', '2022-12-17 13:41:05', NULL),
(2, 2, 7, '2022-12-17 13:41:26', '2022-12-17 13:41:26', NULL),
(3, 2, 5, '2022-12-21 09:37:57', '2022-12-21 09:37:57', NULL),
(4, 1, 5, '2022-12-21 09:38:23', '2022-12-21 09:38:23', NULL);

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

--
-- Table structure for table `contracts`
--

CREATE TABLE `contracts` (
  `id` int(10) UNSIGNED NOT NULL,
  `personal_id` int(10) UNSIGNED NOT NULL,
  `type` enum('employe','stagiaire','formation','apprentissage','spécialité','consultant') COLLATE utf8mb4_unicode_ci NOT NULL,
  `start_date` date NOT NULL,
  `end_date` date NOT NULL,
  `status` enum('en cours','terminé','suspendu') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'en cours',
  `suspend_reason` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `suspend_date` date DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `contracts`
--

INSERT INTO `contracts` (`id`, `personal_id`, `type`, `start_date`, `end_date`, `status`, `suspend_reason`, `suspend_date`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, 'apprentissage', '2022-11-07', '2022-11-30', 'suspendu', 'hello', '2022-11-30', '2022-11-27 17:49:33', '2022-11-27 19:38:48', NULL);

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

--
-- Table structure for table `dossiers`
--

CREATE TABLE `dossiers` (
  `id` int(10) UNSIGNED NOT NULL,
  `personal_id` int(10) UNSIGNED NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `file` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `dossiers`
--

INSERT INTO `dossiers` (`id`, `personal_id`, `name`, `description`, `file`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, 'Acte de naissance ok ok', 'une descruption', '637d5dbbc0e70637d5d5199508637d5d3f68b21637d5cedafef1637d5cc5e2878.png.png.png.png.png', '2022-11-22 22:04:11', '2022-11-23 21:15:34', NULL);

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

--
-- Table structure for table `frais`
--

CREATE TABLE `frais` (
  `id` int(10) UNSIGNED NOT NULL,
  `personal_id` int(10) UNSIGNED NOT NULL,
  `type` enum('de formation','de stage','de consultant','de spécialité','employé','apprentissage','autre','de dossier') COLLATE utf8mb4_unicode_ci NOT NULL,
  `amount` double NOT NULL,
  `amount_remaining` double NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `frais`
--

INSERT INTO `frais` (`id`, `personal_id`, `type`, `amount`, `amount_remaining`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 2, 'de stage', 45000, 0, '2022-11-27 21:12:05', '2022-11-30 20:04:22', NULL),
(2, 2, 'de formation', 75000, 70000, '2022-12-15 04:33:06', '2022-12-16 02:33:28', NULL);

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

--
-- Table structure for table `invoices`
--

CREATE TABLE `invoices` (
  `id` int(10) UNSIGNED NOT NULL,
  `code` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `payment_amount` double NOT NULL,
  `reste_amount` double NOT NULL,
  `payment_method_id` int(10) UNSIGNED NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `invoices`
--

INSERT INTO `invoices` (`id`, `code`, `user_id`, `payment_amount`, `reste_amount`, `payment_method_id`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'D&C_CASH_FAC - 133BCF8841', 1, 2500, 190000, 2, '2022-12-21 14:54:21', '2022-12-21 14:54:21', NULL),
(2, 'D&C_CASH_FAC - D249E4BE76', 1, 90000, 100000, 1, '2022-12-21 14:59:47', '2022-12-21 14:59:47', NULL),
(3, 'D&C_CASH_FAC - 71785CE83E', 1, 52000, 48000, 4, '2022-12-22 03:38:26', '2022-12-22 03:38:26', NULL),
(4, 'D&C_CASH_FAC - 66894CBBBD', 1, 5000, 43000, 3, '2022-12-22 03:46:08', '2022-12-22 03:46:08', NULL),
(5, 'D&C_CASH_FAC - 85098D7A3F', 1, 7000, 36000, 4, '2022-12-22 03:48:15', '2022-12-22 03:48:15', NULL);

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

--
-- Table structure for table `invoice_orders`
--

CREATE TABLE `invoice_orders` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `order_id` int(10) UNSIGNED NOT NULL,
  `invoice_id` int(10) UNSIGNED NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `invoice_orders`
--

INSERT INTO `invoice_orders` (`id`, `order_id`, `invoice_id`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 3, 1, '2022-12-21 14:54:21', '2022-12-21 14:54:21', NULL),
(2, 3, 2, '2022-12-21 14:59:47', '2022-12-21 14:59:47', NULL),
(3, 10, 3, '2022-12-22 04:38:26', '2022-12-22 04:38:26', NULL),
(4, 10, 4, '2022-12-22 04:46:08', '2022-12-22 04:46:08', NULL),
(5, 10, 5, '2022-12-22 04:48:15', '2022-12-22 04:48:15', NULL);

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

--
-- Table structure for table `menu_accesses`
--

CREATE TABLE `menu_accesses` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `slug` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `menu_accesses`
--

INSERT INTO `menu_accesses` (`id`, `name`, `slug`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'Admininistrateur', 'admin', '2022-12-28 18:42:54', '2022-12-28 18:42:54', NULL),
(2, 'Gestion Stock', 'stock', '2022-12-28 18:42:54', '2022-12-28 18:42:54', NULL),
(3, 'Gestion Comptable', 'accounting', '2022-12-28 18:42:54', '2022-12-28 18:42:54', NULL),
(4, 'Gestion Clientele', 'client', '2022-12-28 18:42:54', '2022-12-28 18:42:54', NULL),
(5, 'Gestion Commerciale', 'commerciale', '2022-12-28 18:42:54', '2022-12-28 18:42:54', NULL),
(6, 'Gestion Personnel', 'personnel', '2022-12-28 18:42:54', '2022-12-28 18:42:54', NULL);

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

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

CREATE TABLE `migrations` (
  `id` int(10) UNSIGNED NOT NULL,
  `migration` varchar(255) 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, '2019_12_14_000001_create_personal_access_tokens_table', 1),
(2, '2022_10_04_134119_create_sites_table', 1),
(3, '2022_10_05_041140_create_roles_table', 1),
(4, '2022_10_05_041215_create_privileges_table', 1),
(5, '2022_10_05_041431_create_role_privileges_table', 1),
(6, '2022_10_05_041451_create_users_table', 1),
(7, '2022_10_09_175038_create_providers_table', 1),
(8, '2022_10_12_053707_create_category_articles_table', 1),
(9, '2022_10_12_053708_create_sub_category_articles_table', 1),
(10, '2022_10_14_024159_create_articles_table', 1),
(11, '2022_10_20_051513_create_mouvement_articles_table', 1),
(12, '2022_10_20_182141_create_achat_articles_table', 1),
(13, '2022_10_21_200829_create_return_articles_table', 1),
(14, '2022_10_22_083950_create_transfert_articles_table', 1),
(15, '2022_10_22_161628_create_clients_table', 1),
(16, '2022_10_26_135426_create_tags_table', 1),
(17, '2022_10_26_135715_create_client_tags_table', 1),
(18, '2022_11_11_075823_create_sale_articles_table', 1),
(19, '2022_11_14_090138_create_payment_methods_table', 2),
(20, '2022_11_14_112728_create_orders_table', 3),
(21, '2022_11_14_113022_create_order_items_table', 3),
(22, '2022_11_14_113154_create_invoices_table', 3),
(23, '2022_11_14_113210_create_invoice_orders_table', 3),
(24, '2022_11_15_000613_create_vente_articles_table', 4),
(26, '2022_11_15_193846_create_personals_table', 5),
(27, '2022_11_15_210427_create_contracts_table', 5),
(28, '2022_11_16_034338_create_dossiers_table', 5),
(29, '2022_11_16_041528_create_frais_table', 6),
(30, '2022_11_16_042629_create_reglements_table', 6),
(31, '2022_12_28_182240_create_menu_accesses_table', 7),
(32, '2022_12_28_182701_create_user_menu_accesses_table', 7);

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

--
-- Table structure for table `mouvement_articles`
--

CREATE TABLE `mouvement_articles` (
  `id` int(10) UNSIGNED NOT NULL,
  `quantity` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `article_id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `site_id` int(10) UNSIGNED NOT NULL,
  `type` enum('vente','achat','retour','transfert') COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `mouvement_articles`
--

INSERT INTO `mouvement_articles` (`id`, `quantity`, `article_id`, `user_id`, `site_id`, `type`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, '45', 1, 1, 1, 'achat', '2022-11-13 10:09:31', '2022-11-13 10:09:31', NULL),
(2, '75', 2, 1, 1, 'achat', '2022-11-13 11:07:41', '2022-11-13 11:07:41', NULL),
(3, '50', 1, 1, 1, 'achat', '2022-11-13 13:13:40', '2022-11-13 13:13:40', NULL),
(4, '2', 1, 1, 3, 'vente', '2022-11-15 08:51:22', '2022-11-15 08:51:22', NULL),
(5, '2', 2, 1, 3, 'vente', '2022-11-15 08:51:22', '2022-11-15 08:51:22', NULL),
(6, '2', 4, 1, 3, 'vente', '2022-11-15 08:51:22', '2022-11-15 08:51:22', NULL),
(7, '3', 1, 1, 3, 'vente', '2022-11-15 09:00:05', '2022-11-15 09:00:05', NULL),
(8, '2', 2, 1, 3, 'vente', '2022-11-15 09:00:08', '2022-11-15 09:00:08', NULL),
(9, '2', 4, 1, 3, 'vente', '2022-11-15 09:00:09', '2022-11-15 09:00:09', NULL),
(10, '5', 2, 1, 2, 'vente', '2022-11-15 09:20:12', '2022-11-15 09:20:12', NULL),
(11, '5', 4, 1, 2, 'vente', '2022-11-15 09:20:12', '2022-11-15 09:20:12', NULL),
(12, '2', 1, 1, 2, 'vente', '2022-11-15 09:20:12', '2022-11-15 09:20:12', NULL),
(13, '2', 3, 1, 2, 'vente', '2022-11-15 09:20:13', '2022-11-15 09:20:13', NULL),
(14, '2', 3, 1, 2, 'vente', '2022-12-21 17:18:48', '2022-12-21 17:18:48', NULL),
(15, '1', 4, 1, 2, 'vente', '2022-12-21 17:18:49', '2022-12-21 17:18:49', NULL),
(16, '3', 2, 1, 3, 'vente', '2022-12-21 17:21:44', '2022-12-21 17:21:44', NULL),
(17, '2', 3, 1, 2, 'vente', '2022-12-22 04:31:11', '2022-12-22 04:31:11', NULL),
(18, '3', 3, 1, 3, 'vente', '2022-12-22 04:33:23', '2022-12-22 04:33:23', NULL),
(19, '4', 4, 1, 2, 'vente', '2022-12-22 04:36:59', '2022-12-22 04:36:59', NULL);

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

--
-- Table structure for table `orders`
--

CREATE TABLE `orders` (
  `id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `site_id` int(10) UNSIGNED NOT NULL,
  `client_id` int(10) UNSIGNED NOT NULL,
  `code` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `total_amount` double NOT NULL DEFAULT 0,
  `reste_amount` double NOT NULL DEFAULT 0,
  `status` enum('En attente','En traitement','Traitée','Annulée') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'En attente',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `orders`
--

INSERT INTO `orders` (`id`, `user_id`, `site_id`, `client_id`, `code`, `total_amount`, `reste_amount`, `status`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, 3, 5, 'D&C_CASH - 8910B96D3F', 7500, 7500, 'En attente', '2022-11-15 08:51:22', '2022-11-15 08:51:22', NULL),
(2, 1, 3, 4, 'D&C_CASH - 1FF6749758', 60000, 60000, 'En attente', '2022-11-15 09:00:04', '2022-11-15 09:00:04', NULL),
(3, 1, 2, 5, 'D&C_CASH - 714B64E5B3', 192500, 100000, 'En traitement', '2022-11-15 09:20:12', '2022-11-15 09:20:12', NULL),
(4, 1, 2, 7, 'D&C_CASH - 155D26C254', 55000, 55000, 'En attente', '2022-12-21 17:18:48', '2022-12-21 17:18:48', NULL),
(5, 1, 3, 6, 'D&C_CASH - BC1E2CF518', 7500, 7500, 'En attente', '2022-12-21 17:21:44', '2022-12-21 17:21:44', NULL),
(6, 1, 2, 3, 'D&C_CASH - 82DA7844E9', 30000, 30000, 'En attente', '2022-12-22 04:31:11', '2022-12-22 04:31:11', NULL),
(8, 1, 3, 4, 'D&C_CASH - CAF6BE5DFC', 45000, 45000, 'En attente', '2022-12-22 04:33:23', '2022-12-22 04:33:23', NULL),
(10, 1, 2, 4, 'D&C_CASH - 40BEB07462', 100000, 36000, 'En traitement', '2022-12-22 04:36:59', '2022-12-22 04:36:59', NULL);

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

--
-- Table structure for table `order_items`
--

CREATE TABLE `order_items` (
  `id` int(10) UNSIGNED NOT NULL,
  `order_id` int(10) UNSIGNED NOT NULL,
  `article_id` int(10) UNSIGNED NOT NULL,
  `quantity` int(10) UNSIGNED NOT NULL,
  `price` double NOT NULL,
  `price_type` enum('price','promo_price','new_price','old_price') COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `order_items`
--

INSERT INTO `order_items` (`id`, `order_id`, `article_id`, `quantity`, `price`, `price_type`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, 1, 2, 2500, 'promo_price', '2022-11-15 08:51:22', '2022-11-15 08:51:22', NULL),
(2, 1, 2, 2, 1250, 'promo_price', '2022-11-15 08:51:22', '2022-11-15 08:51:22', NULL),
(3, 1, 4, 2, 25000, 'promo_price', '2022-11-15 08:51:22', '2022-11-15 08:51:22', NULL),
(4, 2, 1, 3, 2500, 'promo_price', '2022-11-15 09:00:07', '2022-11-15 09:00:07', NULL),
(5, 2, 2, 2, 1250, 'promo_price', '2022-11-15 09:00:08', '2022-11-15 09:00:08', NULL),
(6, 2, 4, 2, 25000, 'price', '2022-11-15 09:00:09', '2022-11-15 09:00:09', NULL),
(7, 3, 2, 5, 2500, 'price', '2022-11-15 09:20:12', '2022-11-15 09:20:12', NULL),
(8, 3, 4, 5, 25000, 'price', '2022-11-15 09:20:12', '2022-11-15 09:20:12', NULL),
(9, 3, 1, 2, 12500, 'price', '2022-11-15 09:20:12', '2022-11-15 09:20:12', NULL),
(10, 3, 3, 2, 15000, 'price', '2022-11-15 09:20:13', '2022-11-15 09:20:13', NULL),
(11, 4, 3, 2, 15000, 'price', '2022-12-21 17:18:49', '2022-12-21 17:18:49', NULL),
(12, 4, 4, 1, 25000, 'price', '2022-12-21 17:18:49', '2022-12-21 17:18:49', NULL),
(13, 5, 2, 3, 2500, 'price', '2022-12-21 17:21:44', '2022-12-21 17:21:44', NULL),
(14, 6, 3, 2, 15000, 'price', '2022-12-22 04:31:11', '2022-12-22 04:31:11', NULL),
(15, 8, 3, 3, 15000, 'price', '2022-12-22 04:33:23', '2022-12-22 04:33:23', NULL),
(16, 10, 4, 4, 25000, 'price', '2022-12-22 04:36:59', '2022-12-22 04:36:59', NULL);

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

--
-- Table structure for table `payment_methods`
--

CREATE TABLE `payment_methods` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `payment_methods`
--

INSERT INTO `payment_methods` (`id`, `name`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'MTN Momo', '2022-11-14 10:23:56', '2022-11-14 10:23:56', NULL),
(2, 'CHÈQUE Bancaire', '2022-11-14 10:23:56', '2022-11-14 10:23:56', NULL),
(3, 'MOOV Money', '2022-11-14 10:23:56', '2022-11-14 10:23:56', NULL),
(4, 'VIREMENT Bancaire', '2022-11-14 10:23:56', '2022-11-14 10:23:56', NULL),
(5, 'ESPÈCE', '2022-11-14 10:23:56', '2022-11-14 10:23:56', NULL),
(6, 'CARTE Crédit', '2022-11-14 10:23:56', '2022-11-14 10:23:56', NULL),
(7, 'CELTIIS Cash', '2022-11-14 10:23:56', '2022-11-14 10:23:56', NULL);

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

--
-- Table structure for table `personals`
--

CREATE TABLE `personals` (
  `id` int(10) UNSIGNED NOT NULL,
  `matricule` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `site_id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `first_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `phone` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `address` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `city` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `state` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `birthday` date NOT NULL,
  `birthplace` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `sexe` enum('Masculin','Feminin') COLLATE utf8mb4_unicode_ci NOT NULL,
  `marital_status` enum('célibataire','marié','divorcé','veuf') COLLATE utf8mb4_unicode_ci NOT NULL,
  `situation_status` enum('démissionnaire','licencié','retraité','décédé','autre','actif') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'actif',
  `situation_date` date DEFAULT NULL,
  `fonction` enum('en interne','en CDI','en CDD','en contrat de formation','en contrat apprentissage','en contrat de spécialité','en contrat de consultant','autre') COLLATE utf8mb4_unicode_ci NOT NULL,
  `ifu` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `cnss` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `photo` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `contact_person` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `phone_contact_person` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `bourcier` tinyint(1) NOT NULL DEFAULT 0,
  `bourcier_type` enum('démi bourcier','bourcier','secourier') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `personals`
--

INSERT INTO `personals` (`id`, `matricule`, `site_id`, `user_id`, `name`, `first_name`, `email`, `phone`, `address`, `city`, `state`, `birthday`, `birthplace`, `sexe`, `marital_status`, `situation_status`, `situation_date`, `fonction`, `ifu`, `cnss`, `photo`, `contact_person`, `phone_contact_person`, `bourcier`, `bourcier_type`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'P637a7b560c38d', 1, 1, 'Hello', 'Hjiu', 'ambroise.ghi', 'nhs', 'sdhj', 'hello', 'Cotonoi', '2022-11-14', 'Ctono', 'Feminin', 'divorcé', 'actif', NULL, 'en CDD', NULL, NULL, NULL, 'Helli', '54545', 0, NULL, '2022-11-20 18:09:10', '2022-11-20 18:09:10', NULL),
(2, 'P637d34a7ccaac', 2, 1, 'BHFGF', 'FGHGHGJ', 'GHGH@JGHF.COM', '54NBDFDF', 'DFGFD', 'DFGF', 'GHG4554', '2022-11-23', 'GGFGF', 'Feminin', 'divorcé', 'actif', NULL, 'en CDI', NULL, NULL, 'undefined', 'JGHFGDDDF', 'KL454', 1, 'bourcier', '2022-11-22 19:44:23', '2022-11-22 20:13:01', NULL);

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

--
-- Table structure for table `privileges`
--

CREATE TABLE `privileges` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `providers`
--

CREATE TABLE `providers` (
  `id` int(10) UNSIGNED NOT NULL,
  `site_id` int(10) UNSIGNED NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `contact` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `providers`
--

INSERT INTO `providers` (`id`, `site_id`, `name`, `contact`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, 'Fournisseur 1', '0029996565', '2022-11-13 06:45:50', '2022-11-13 06:45:50', NULL),
(2, 2, 'Fournisseur 2', '2295466554', '2022-11-13 06:46:11', '2022-11-13 06:46:11', NULL);

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

--
-- Table structure for table `reglements`
--

CREATE TABLE `reglements` (
  `id` int(10) UNSIGNED NOT NULL,
  `frais_id` int(10) UNSIGNED NOT NULL,
  `amount_paid` double NOT NULL,
  `payment_method_id` int(10) UNSIGNED NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `reglements`
--

INSERT INTO `reglements` (`id`, `frais_id`, `amount_paid`, `payment_method_id`, `created_at`, `updated_at`, `deleted_at`) VALUES
(2, 1, 25000, 4, '2022-11-30 20:04:05', '2022-11-30 20:04:05', NULL),
(3, 1, 30000, 5, '2022-11-30 20:04:22', '2022-11-30 20:04:22', NULL),
(4, 2, 5000, 2, '2022-12-16 02:33:28', '2022-12-16 02:33:28', NULL);

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

--
-- Table structure for table `return_articles`
--

CREATE TABLE `return_articles` (
  `id` int(10) UNSIGNED NOT NULL,
  `mouvement_article_id` int(10) UNSIGNED NOT NULL,
  `provider_id` int(10) UNSIGNED NOT NULL,
  `unit_price` double NOT NULL,
  `raison` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `roles`
--

CREATE TABLE `roles` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `roles`
--

INSERT INTO `roles` (`id`, `name`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'Admininistrateur', '2022-11-13 06:44:58', '2022-11-13 06:44:58', NULL),
(2, 'Utilisateur', '2022-11-13 06:44:58', '2022-11-13 06:44:58', NULL),
(3, 'Gestion Comptable', '2022-11-13 06:44:58', '2022-11-13 06:44:58', NULL);

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

--
-- Table structure for table `role_privileges`
--

CREATE TABLE `role_privileges` (
  `id` int(10) UNSIGNED NOT NULL,
  `role_id` int(10) UNSIGNED NOT NULL,
  `privilege_id` int(10) UNSIGNED NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `sale_articles`
--

CREATE TABLE `sale_articles` (
  `id` int(10) UNSIGNED NOT NULL,
  `article_id` int(10) UNSIGNED NOT NULL,
  `in_promotion` tinyint(1) NOT NULL DEFAULT 0,
  `price` double NOT NULL DEFAULT 0,
  `promo_price` double NOT NULL DEFAULT 0,
  `old_price` double NOT NULL DEFAULT 0,
  `new_price` double NOT NULL DEFAULT 0,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sale_articles`
--

INSERT INTO `sale_articles` (`id`, `article_id`, `in_promotion`, `price`, `promo_price`, `old_price`, `new_price`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, 0, 12500, 2500, 750, 8500, '2022-11-13 06:48:30', '2022-11-13 06:48:30', NULL),
(2, 2, 1, 2500, 1250, 950, 3000, '2022-11-13 06:49:10', '2022-11-13 06:49:10', NULL),
(3, 3, 0, 15000, 0, 0, 0, '2022-11-13 11:10:45', '2022-11-13 11:10:45', NULL),
(4, 4, 0, 25000, 0, 0, 0, '2022-11-13 11:20:17', '2022-11-13 11:20:17', NULL);

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

--
-- Table structure for table `sites`
--

CREATE TABLE `sites` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `address` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `country` enum('BJ','GH','NG','SL','TG','UG') COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sites`
--

INSERT INTO `sites` (`id`, `name`, `address`, `country`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'Agla', 'Bénin, agla', 'BJ', '2022-11-13 06:44:57', '2022-11-13 06:44:57', NULL),
(2, 'Calavi', 'Bénin, calavi', 'BJ', '2022-11-13 06:44:57', '2022-11-13 06:44:57', NULL),
(3, 'Accra', 'Ghana, accra', 'GH', '2022-11-13 06:44:58', '2022-11-13 06:44:58', NULL),
(4, 'Lomé', 'Togo, lomé', 'TG', '2022-11-13 06:44:58', '2022-11-13 06:44:58', NULL);

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

--
-- Table structure for table `sub_category_articles`
--

CREATE TABLE `sub_category_articles` (
  `id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `category_article_id` int(10) UNSIGNED NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sub_category_articles`
--

INSERT INTO `sub_category_articles` (`id`, `user_id`, `category_article_id`, `name`, `description`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, 1, 'sous categorie 1', 'une descriptio,', '2022-11-13 06:47:22', '2022-11-13 06:47:22', NULL),
(2, 1, 2, 'sous categorie 2', 'une description 21', '2022-11-13 06:47:40', '2022-11-13 06:47:40', NULL);

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

--
-- Table structure for table `tags`
--

CREATE TABLE `tags` (
  `id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `site_id` int(10) UNSIGNED NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `color` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `tags`
--

INSERT INTO `tags` (`id`, `user_id`, `site_id`, `name`, `color`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, 3, 'Crediteur', '#0ed82f', '2022-12-17 10:14:01', '2022-12-17 10:14:01', NULL),
(2, 1, 2, 'REGLO', '#1f0505', '2022-12-17 10:43:06', '2022-12-17 10:43:06', NULL);

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

--
-- Table structure for table `transfert_articles`
--

CREATE TABLE `transfert_articles` (
  `id` int(10) UNSIGNED NOT NULL,
  `mouvement_article_id` int(10) UNSIGNED NOT NULL,
  `from_article` int(10) UNSIGNED NOT NULL,
  `to_article` int(10) UNSIGNED NOT NULL,
  `site_dest_id` int(10) UNSIGNED NOT NULL,
  `raison` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `user_menu_accesses`
--

CREATE TABLE `user_menu_accesses` (
  `id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `menu_access_id` int(10) UNSIGNED NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `user_menu_accesses`
--

INSERT INTO `user_menu_accesses` (`id`, `user_id`, `menu_access_id`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 4, 2, '2022-12-29 05:04:42', '2022-12-29 05:04:42', NULL),
(2, 4, 3, '2022-12-29 05:04:42', '2022-12-29 05:04:42', NULL),
(3, 4, 4, '2022-12-29 05:04:42', '2022-12-29 05:04:42', NULL);

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

--
-- Table structure for table `vente_articles`
--

CREATE TABLE `vente_articles` (
  `id` int(10) UNSIGNED NOT NULL,
  `mouvement_article_id` int(10) UNSIGNED NOT NULL,
  `client_id` int(10) UNSIGNED NOT NULL,
  `price` double NOT NULL,
  `price_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `vente_articles`
--

INSERT INTO `vente_articles` (`id`, `mouvement_article_id`, `client_id`, `price`, `price_type`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 4, 5, 2500, 'promo_price', '2022-11-15 08:51:22', '2022-11-15 08:51:22', NULL),
(2, 5, 5, 1250, 'promo_price', '2022-11-15 08:51:22', '2022-11-15 08:51:22', NULL),
(3, 6, 5, 0, 'promo_price', '2022-11-15 08:51:22', '2022-11-15 08:51:22', NULL),
(4, 7, 4, 2500, 'promo_price', '2022-11-15 09:00:06', '2022-11-15 09:00:06', NULL),
(5, 8, 4, 1250, 'promo_price', '2022-11-15 09:00:08', '2022-11-15 09:00:08', NULL),
(6, 9, 4, 25000, 'price', '2022-11-15 09:00:09', '2022-11-15 09:00:09', NULL),
(7, 10, 5, 2500, 'price', '2022-11-15 09:20:12', '2022-11-15 09:20:12', NULL),
(8, 11, 5, 25000, 'price', '2022-11-15 09:20:12', '2022-11-15 09:20:12', NULL),
(9, 12, 5, 12500, 'price', '2022-11-15 09:20:12', '2022-11-15 09:20:12', NULL),
(10, 13, 5, 15000, 'price', '2022-11-15 09:20:13', '2022-11-15 09:20:13', NULL),
(11, 14, 7, 15000, 'price', '2022-12-21 17:18:48', '2022-12-21 17:18:48', NULL),
(12, 15, 7, 25000, 'price', '2022-12-21 17:18:49', '2022-12-21 17:18:49', NULL),
(13, 16, 6, 2500, 'price', '2022-12-21 17:21:44', '2022-12-21 17:21:44', NULL),
(14, 17, 3, 15000, 'price', '2022-12-22 04:31:11', '2022-12-22 04:31:11', NULL),
(15, 18, 4, 15000, 'price', '2022-12-22 04:33:23', '2022-12-22 04:33:23', NULL),
(16, 19, 4, 25000, 'price', '2022-12-22 04:36:59', '2022-12-22 04:36:59', NULL);

--
-- Indexes for dumped tables
--

--
-- Indexes for table `achat_articles`
--
ALTER TABLE `achat_articles`
  ADD PRIMARY KEY (`id`),
  ADD KEY `achat_articles_provider_id_foreign` (`provider_id`),
  ADD KEY `achat_articles_mouvement_article_id_foreign` (`mouvement_article_id`);

--
-- Indexes for table `articles`
--
ALTER TABLE `articles`
  ADD PRIMARY KEY (`id`),
  ADD KEY `articles_user_id_foreign` (`user_id`),
  ADD KEY `articles_site_id_foreign` (`site_id`),
  ADD KEY `articles_sub_category_article_id_foreign` (`sub_category_article_id`);

--
-- Indexes for table `category_articles`
--
ALTER TABLE `category_articles`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `category_articles_name_unique` (`name`),
  ADD KEY `category_articles_user_id_foreign` (`user_id`);

--
-- Indexes for table `clients`
--
ALTER TABLE `clients`
  ADD PRIMARY KEY (`id`),
  ADD KEY `clients_user_id_foreign` (`user_id`),
  ADD KEY `clients_site_id_foreign` (`site_id`);

--
-- Indexes for table `client_tags`
--
ALTER TABLE `client_tags`
  ADD PRIMARY KEY (`id`),
  ADD KEY `client_tags_tag_id_foreign` (`tag_id`),
  ADD KEY `client_tags_client_id_foreign` (`client_id`);

--
-- Indexes for table `contracts`
--
ALTER TABLE `contracts`
  ADD PRIMARY KEY (`id`),
  ADD KEY `contracts_personal_id_foreign` (`personal_id`);

--
-- Indexes for table `dossiers`
--
ALTER TABLE `dossiers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `dossiers_personal_id_foreign` (`personal_id`);

--
-- Indexes for table `frais`
--
ALTER TABLE `frais`
  ADD PRIMARY KEY (`id`),
  ADD KEY `frais_personal_id_foreign` (`personal_id`);

--
-- Indexes for table `invoices`
--
ALTER TABLE `invoices`
  ADD PRIMARY KEY (`id`),
  ADD KEY `invoices_payment_method_id_foreign` (`payment_method_id`),
  ADD KEY `invoices_user_id_foreign` (`user_id`);

--
-- Indexes for table `invoice_orders`
--
ALTER TABLE `invoice_orders`
  ADD PRIMARY KEY (`id`),
  ADD KEY `invoice_orders_order_id_foreign` (`order_id`),
  ADD KEY `invoice_orders_invoice_id_foreign` (`invoice_id`);

--
-- Indexes for table `menu_accesses`
--
ALTER TABLE `menu_accesses`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `menu_accesses_name_unique` (`name`),
  ADD UNIQUE KEY `menu_accesses_slug_unique` (`slug`);

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

--
-- Indexes for table `mouvement_articles`
--
ALTER TABLE `mouvement_articles`
  ADD PRIMARY KEY (`id`),
  ADD KEY `mouvement_articles_article_id_foreign` (`article_id`),
  ADD KEY `mouvement_articles_user_id_foreign` (`user_id`),
  ADD KEY `mouvement_articles_site_id_foreign` (`site_id`);

--
-- Indexes for table `orders`
--
ALTER TABLE `orders`
  ADD PRIMARY KEY (`id`),
  ADD KEY `orders_client_id_foreign` (`client_id`),
  ADD KEY `orders_user_id_foreign` (`user_id`),
  ADD KEY `orders_site_id_foreign` (`site_id`);

--
-- Indexes for table `order_items`
--
ALTER TABLE `order_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `order_items_order_id_foreign` (`order_id`),
  ADD KEY `order_items_article_id_foreign` (`article_id`);

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

--
-- Indexes for table `personals`
--
ALTER TABLE `personals`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `personals_matricule_unique` (`matricule`),
  ADD UNIQUE KEY `personals_email_unique` (`email`),
  ADD UNIQUE KEY `personals_phone_unique` (`phone`),
  ADD UNIQUE KEY `personals_ifu_unique` (`ifu`),
  ADD UNIQUE KEY `personals_cnss_unique` (`cnss`),
  ADD KEY `personals_user_id_foreign` (`user_id`),
  ADD KEY `personals_site_id_foreign` (`site_id`);

--
-- Indexes for table `privileges`
--
ALTER TABLE `privileges`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `privileges_name_unique` (`name`);

--
-- Indexes for table `providers`
--
ALTER TABLE `providers`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `providers_name_unique` (`name`),
  ADD KEY `providers_site_id_foreign` (`site_id`);

--
-- Indexes for table `reglements`
--
ALTER TABLE `reglements`
  ADD PRIMARY KEY (`id`),
  ADD KEY `reglements_payment_method_id_foreign` (`payment_method_id`),
  ADD KEY `reglements_frais_id_foreign` (`frais_id`);

--
-- Indexes for table `return_articles`
--
ALTER TABLE `return_articles`
  ADD PRIMARY KEY (`id`),
  ADD KEY `return_articles_provider_id_foreign` (`provider_id`),
  ADD KEY `return_articles_mouvement_article_id_foreign` (`mouvement_article_id`);

--
-- Indexes for table `roles`
--
ALTER TABLE `roles`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `roles_name_unique` (`name`);

--
-- Indexes for table `role_privileges`
--
ALTER TABLE `role_privileges`
  ADD PRIMARY KEY (`id`),
  ADD KEY `role_privileges_role_id_foreign` (`role_id`),
  ADD KEY `role_privileges_privilege_id_foreign` (`privilege_id`);

--
-- Indexes for table `sale_articles`
--
ALTER TABLE `sale_articles`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `sale_articles_article_id_unique` (`article_id`);

--
-- Indexes for table `sites`
--
ALTER TABLE `sites`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `sites_name_unique` (`name`);

--
-- Indexes for table `sub_category_articles`
--
ALTER TABLE `sub_category_articles`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `sub_category_articles_name_unique` (`name`),
  ADD KEY `sub_category_articles_user_id_foreign` (`user_id`),
  ADD KEY `sub_category_articles_category_article_id_foreign` (`category_article_id`);

--
-- Indexes for table `tags`
--
ALTER TABLE `tags`
  ADD PRIMARY KEY (`id`),
  ADD KEY `tags_user_id_foreign` (`user_id`),
  ADD KEY `tags_site_id_foreign` (`site_id`);

--
-- Indexes for table `transfert_articles`
--
ALTER TABLE `transfert_articles`
  ADD PRIMARY KEY (`id`),
  ADD KEY `transfert_articles_from_article_foreign` (`from_article`),
  ADD KEY `transfert_articles_to_article_foreign` (`to_article`),
  ADD KEY `transfert_articles_site_dest_id_foreign` (`site_dest_id`),
  ADD KEY `transfert_articles_mouvement_article_id_foreign` (`mouvement_article_id`);

--
-- Indexes for table `user_menu_accesses`
--
ALTER TABLE `user_menu_accesses`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_menu_accesses_user_id_foreign` (`user_id`),
  ADD KEY `user_menu_accesses_menu_accesse_id_foreign` (`menu_access_id`);

--
-- Indexes for table `vente_articles`
--
ALTER TABLE `vente_articles`
  ADD PRIMARY KEY (`id`),
  ADD KEY `vente_articles_client_id_foreign` (`client_id`),
  ADD KEY `vente_articles_mouvement_article_id_foreign` (`mouvement_article_id`);

--
-- AUTO_INCREMENT for dumped tables
--

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

--
-- AUTO_INCREMENT for table `privileges`
--
ALTER TABLE `privileges`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

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

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

--
-- AUTO_INCREMENT for table `return_articles`
--
ALTER TABLE `return_articles`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

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

--
-- AUTO_INCREMENT for table `role_privileges`
--
ALTER TABLE `role_privileges`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

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

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

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

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

--
-- AUTO_INCREMENT for table `transfert_articles`
--
ALTER TABLE `transfert_articles`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

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

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `achat_articles`
--
ALTER TABLE `achat_articles`
  ADD CONSTRAINT `achat_articles_mouvement_article_id_foreign` FOREIGN KEY (`mouvement_article_id`) REFERENCES `mouvement_articles` (`id`),
  ADD CONSTRAINT `achat_articles_provider_id_foreign` FOREIGN KEY (`provider_id`) REFERENCES `providers` (`id`);

--
-- Constraints for table `articles`
--
ALTER TABLE `articles`
  ADD CONSTRAINT `articles_site_id_foreign` FOREIGN KEY (`site_id`) REFERENCES `sites` (`id`),
  ADD CONSTRAINT `articles_sub_category_article_id_foreign` FOREIGN KEY (`sub_category_article_id`) REFERENCES `sub_category_articles` (`id`),
  ADD CONSTRAINT `articles_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `category_articles`
--
ALTER TABLE `category_articles`
  ADD CONSTRAINT `category_articles_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `clients`
--
ALTER TABLE `clients`
  ADD CONSTRAINT `clients_site_id_foreign` FOREIGN KEY (`site_id`) REFERENCES `sites` (`id`),
  ADD CONSTRAINT `clients_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `client_tags`
--
ALTER TABLE `client_tags`
  ADD CONSTRAINT `client_tags_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`),
  ADD CONSTRAINT `client_tags_tag_id_foreign` FOREIGN KEY (`tag_id`) REFERENCES `tags` (`id`);

--
-- Constraints for table `contracts`
--
ALTER TABLE `contracts`
  ADD CONSTRAINT `contracts_personal_id_foreign` FOREIGN KEY (`personal_id`) REFERENCES `personals` (`id`);

--
-- Constraints for table `dossiers`
--
ALTER TABLE `dossiers`
  ADD CONSTRAINT `dossiers_personal_id_foreign` FOREIGN KEY (`personal_id`) REFERENCES `personals` (`id`);

--
-- Constraints for table `frais`
--
ALTER TABLE `frais`
  ADD CONSTRAINT `frais_personal_id_foreign` FOREIGN KEY (`personal_id`) REFERENCES `personals` (`id`);

--
-- Constraints for table `invoices`
--
ALTER TABLE `invoices`
  ADD CONSTRAINT `invoices_payment_method_id_foreign` FOREIGN KEY (`payment_method_id`) REFERENCES `payment_methods` (`id`),
  ADD CONSTRAINT `invoices_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `invoice_orders`
--
ALTER TABLE `invoice_orders`
  ADD CONSTRAINT `invoice_orders_invoice_id_foreign` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `invoice_orders_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `mouvement_articles`
--
ALTER TABLE `mouvement_articles`
  ADD CONSTRAINT `mouvement_articles_article_id_foreign` FOREIGN KEY (`article_id`) REFERENCES `articles` (`id`),
  ADD CONSTRAINT `mouvement_articles_site_id_foreign` FOREIGN KEY (`site_id`) REFERENCES `sites` (`id`),
  ADD CONSTRAINT `mouvement_articles_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `orders`
--
ALTER TABLE `orders`
  ADD CONSTRAINT `orders_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`),
  ADD CONSTRAINT `orders_site_id_foreign` FOREIGN KEY (`site_id`) REFERENCES `sites` (`id`),
  ADD CONSTRAINT `orders_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `order_items`
--
ALTER TABLE `order_items`
  ADD CONSTRAINT `order_items_article_id_foreign` FOREIGN KEY (`article_id`) REFERENCES `articles` (`id`),
  ADD CONSTRAINT `order_items_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `personals`
--
ALTER TABLE `personals`
  ADD CONSTRAINT `personals_site_id_foreign` FOREIGN KEY (`site_id`) REFERENCES `sites` (`id`),
  ADD CONSTRAINT `personals_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `providers`
--
ALTER TABLE `providers`
  ADD CONSTRAINT `providers_site_id_foreign` FOREIGN KEY (`site_id`) REFERENCES `sites` (`id`);

--
-- Constraints for table `reglements`
--
ALTER TABLE `reglements`
  ADD CONSTRAINT `reglements_frais_id_foreign` FOREIGN KEY (`frais_id`) REFERENCES `personals` (`id`),
  ADD CONSTRAINT `reglements_payment_method_id_foreign` FOREIGN KEY (`payment_method_id`) REFERENCES `payment_methods` (`id`);

--
-- Constraints for table `return_articles`
--
ALTER TABLE `return_articles`
  ADD CONSTRAINT `return_articles_mouvement_article_id_foreign` FOREIGN KEY (`mouvement_article_id`) REFERENCES `mouvement_articles` (`id`),
  ADD CONSTRAINT `return_articles_provider_id_foreign` FOREIGN KEY (`provider_id`) REFERENCES `providers` (`id`);

--
-- Constraints for table `role_privileges`
--
ALTER TABLE `role_privileges`
  ADD CONSTRAINT `role_privileges_privilege_id_foreign` FOREIGN KEY (`privilege_id`) REFERENCES `privileges` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `role_privileges_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `sale_articles`
--
ALTER TABLE `sale_articles`
  ADD CONSTRAINT `sale_articles_article_id_foreign` FOREIGN KEY (`article_id`) REFERENCES `articles` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `sub_category_articles`
--
ALTER TABLE `sub_category_articles`
  ADD CONSTRAINT `sub_category_articles_category_article_id_foreign` FOREIGN KEY (`category_article_id`) REFERENCES `category_articles` (`id`),
  ADD CONSTRAINT `sub_category_articles_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `tags`
--
ALTER TABLE `tags`
  ADD CONSTRAINT `tags_site_id_foreign` FOREIGN KEY (`site_id`) REFERENCES `sites` (`id`),
  ADD CONSTRAINT `tags_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `transfert_articles`
--
ALTER TABLE `transfert_articles`
  ADD CONSTRAINT `transfert_articles_from_article_foreign` FOREIGN KEY (`from_article`) REFERENCES `articles` (`id`),
  ADD CONSTRAINT `transfert_articles_mouvement_article_id_foreign` FOREIGN KEY (`mouvement_article_id`) REFERENCES `mouvement_articles` (`id`),
  ADD CONSTRAINT `transfert_articles_site_dest_id_foreign` FOREIGN KEY (`site_dest_id`) REFERENCES `sites` (`id`),
  ADD CONSTRAINT `transfert_articles_to_article_foreign` FOREIGN KEY (`to_article`) REFERENCES `articles` (`id`);

--
-- Constraints for table `user_menu_accesses`
--
ALTER TABLE `user_menu_accesses`
  ADD CONSTRAINT `user_menu_accesses_menu_accesse_id_foreign` FOREIGN KEY (`menu_access_id`) REFERENCES `menu_accesses` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `user_menu_accesses_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `vente_articles`
--
ALTER TABLE `vente_articles`
  ADD CONSTRAINT `vente_articles_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`),
  ADD CONSTRAINT `vente_articles_mouvement_article_id_foreign` FOREIGN KEY (`mouvement_article_id`) REFERENCES `mouvement_articles` (`id`);
COMMIT;

