-- https://www.phpmyadmin.net/
--
-- Hôte : localhost
-- Généré le : ven. 24 avr. 2026 à 16:03
-- Version du serveur : 10.4.28-MariaDB
-- Version de PHP : 8.2.4

START TRANSACTION;



--
-- Base de données : `gestionstock`
--

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

--
-- Structure de la table `brands`
--

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

--
-- Déchargement des données de la table `brands`
--

INSERT INTO `brands` (`id`, `company_id`, `name`, `slug`, `image`, `created_at`, `updated_at`) VALUES
(1, 1, 'Puma', 'puma', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(2, 1, 'Reebok', 'reebok', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(3, 1, 'Allen Solly', 'allen-solly', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(4, 1, 'Red Chief', 'red-chief', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(5, 1, 'Lee Cooper', 'lee-cooper', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(6, 1, 'Nike', 'nike', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(7, 1, 'Lee', 'lee', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(8, 1, 'Samsung', 'samsung', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(9, 1, 'LG', 'lg', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(10, 1, 'Godrej', 'godrej', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(11, 1, 'Voltas', 'voltas', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(12, 1, 'Parle-G', 'parle-g', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(13, 1, 'Apple', 'apple', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(14, 1, 'Realme', 'realme', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(15, 1, 'Vivo', 'vivo', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(16, 1, 'RX', 'rx', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(17, 1, 'pampers', 'pampers', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(18, 1, 'ARG Clothes', 'arg-clothes', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(19, 1, 'Himalaya', 'himalaya', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(20, 1, 'Crompton', 'crompton', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(21, 1, 'Heniz', 'heniz', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(22, 1, 'TATA', 'tata', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(23, 1, 'Fortune', 'fortune', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14');

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

--
-- Structure de la table `categories`
--

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

--
-- Déchargement des données de la table `categories`
--

INSERT INTO `categories` (`id`, `company_id`, `name`, `slug`, `image`, `parent_id`, `created_at`, `updated_at`) VALUES
(1, 1, 'Electronics', 'electronics', NULL, NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(2, 1, 'Fashion', 'fashion', NULL, NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(3, 1, 'Grocery', 'grocery', NULL, NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(4, 1, 'Home and Furnitures', 'home-and-furnitures', NULL, NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(5, 1, 'Baby & Kids', 'baby-kids', NULL, NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(6, 1, 'Mobiles', 'mobiles', NULL, 1, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(7, 1, 'Televisions', 'televisions', NULL, 1, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(8, 1, 'Clothes', 'clothes', NULL, 2, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(9, 1, 'Shoes', 'shoes', NULL, 2, '2026-04-22 14:21:14', '2026-04-22 14:21:14');

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

--
-- Structure de la table `companies`
--

CREATE TABLE `companies` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `slug` varchar(191) NOT NULL,
  `subscription_plan` varchar(191) NOT NULL DEFAULT 'free',
  `subscription_status` varchar(191) NOT NULL DEFAULT 'active',
  `trial_ends_at` timestamp NULL DEFAULT NULL,
  `stripe_customer_id` varchar(191) DEFAULT NULL,
  `stripe_subscription_id` varchar(191) DEFAULT NULL,
  `max_warehouses` int(11) NOT NULL DEFAULT 1,
  `max_users` int(11) NOT NULL DEFAULT 3,
  `max_products` int(11) NOT NULL DEFAULT 100,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `is_demo` tinyint(1) NOT NULL DEFAULT 0,
  `demo_expires_at` timestamp NULL DEFAULT NULL,
  `name` varchar(191) NOT NULL,
  `short_name` varchar(191) DEFAULT NULL,
  `email` varchar(191) DEFAULT NULL,
  `phone` varchar(191) DEFAULT NULL,
  `website` varchar(191) DEFAULT NULL,
  `light_logo` varchar(191) DEFAULT NULL,
  `dark_logo` varchar(191) DEFAULT NULL,
  `small_dark_logo` varchar(191) DEFAULT NULL,
  `small_light_logo` varchar(191) DEFAULT NULL,
  `address` varchar(1000) DEFAULT NULL,
  `app_layout` varchar(10) NOT NULL DEFAULT 'sidebar',
  `currency_id` bigint(20) UNSIGNED DEFAULT NULL,
  `lang_id` bigint(20) UNSIGNED DEFAULT NULL,
  `warehouse_id` bigint(20) UNSIGNED DEFAULT NULL,
  `left_sidebar_theme` varchar(20) NOT NULL DEFAULT 'dark',
  `primary_color` varchar(20) NOT NULL DEFAULT '#1890ff',
  `date_format` varchar(20) NOT NULL DEFAULT 'DD-MM-YYYY',
  `time_format` varchar(20) NOT NULL DEFAULT 'hh:mm a',
  `auto_detect_timezone` tinyint(1) NOT NULL DEFAULT 1,
  `timezone` varchar(191) NOT NULL DEFAULT 'Africa/Abidjan',
  `session_driver` varchar(20) NOT NULL DEFAULT 'file',
  `app_debug` tinyint(1) NOT NULL DEFAULT 0,
  `update_app_notification` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Déchargement des données de la table `companies`
--

INSERT INTO `companies` (`id`, `slug`, `subscription_plan`, `subscription_status`, `trial_ends_at`, `stripe_customer_id`, `stripe_subscription_id`, `max_warehouses`, `max_users`, `max_products`, `is_active`, `is_demo`, `demo_expires_at`, `name`, `short_name`, `email`, `phone`, `website`, `light_logo`, `dark_logo`, `small_dark_logo`, `small_light_logo`, `address`, `app_layout`, `currency_id`, `lang_id`, `warehouse_id`, `left_sidebar_theme`, `primary_color`, `date_format`, `time_format`, `auto_detect_timezone`, `timezone`, `session_driver`, `app_debug`, `update_app_notification`, `created_at`, `updated_at`) VALUES
(1, 'default', 'enterprise', 'active', NULL, NULL, NULL, 999, 999, 999999, 1, 0, NULL, 'Welely', 'Welely', 'contact@welely.com', '+2250101054383', NULL, NULL, NULL, NULL, NULL, '', 'sidebar', NULL, 2, 1, 'dark', '#1890ff', 'DD-MM-YYYY', 'hh:mm a', 1, 'Africa/Abidjan', 'file', 0, 1, '2026-04-22 14:21:09', '2026-04-22 14:21:09');

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

--
-- Structure de la table `currencies`
--

CREATE TABLE `currencies` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED DEFAULT NULL,
  `name` varchar(191) NOT NULL,
  `code` varchar(191) NOT NULL,
  `symbol` varchar(191) NOT NULL,
  `position` varchar(191) NOT NULL,
  `is_deletable` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Déchargement des données de la table `currencies`
--

INSERT INTO `currencies` (`id`, `company_id`, `name`, `code`, `symbol`, `position`, `is_deletable`, `created_at`, `updated_at`) VALUES
(1, 1, 'Dollar US', 'USD', '$', 'front', 1, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(2, 1, 'Euro', 'EUR', '€', 'behind', 1, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(3, 1, 'Franc CFA', 'XOF', 'FCFA', 'behind', 1, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(4, 1, 'Livre Sterling', 'GBP', '£', 'front', 1, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(5, 1, 'Dirham Marocain', 'MAD', 'MAD', 'behind', 1, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(6, 1, 'Dinar Algérien', 'DZD', 'DA', 'behind', 1, '2026-04-22 14:21:14', '2026-04-22 14:21:14');

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

--
-- Structure de la table `custom_fields`
--

CREATE TABLE `custom_fields` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED DEFAULT NULL,
  `name` varchar(191) NOT NULL,
  `value` varchar(191) DEFAULT NULL,
  `type` varchar(191) NOT NULL DEFAULT 'text',
  `active` tinyint(1) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Déchargement des données de la table `custom_fields`
--

INSERT INTO `custom_fields` (`id`, `company_id`, `name`, `value`, `type`, `active`) VALUES
(1, 1, 'Expiry Date', NULL, 'date', 0);

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

--
-- Structure de la table `expenses`
--

CREATE TABLE `expenses` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED DEFAULT NULL,
  `bill` varchar(191) DEFAULT NULL,
  `expense_category_id` bigint(20) UNSIGNED DEFAULT NULL,
  `warehouse_id` bigint(20) UNSIGNED DEFAULT NULL,
  `amount` float NOT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `notes` varchar(1000) DEFAULT NULL,
  `date` date NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Structure de la table `expense_categories`
--

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

--
-- Déchargement des données de la table `expense_categories`
--

INSERT INTO `expense_categories` (`id`, `company_id`, `name`, `description`, `created_at`, `updated_at`) VALUES
(1, 1, 'Loyer', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(2, 1, 'Salaires', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(3, 1, 'Transport', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(4, 1, 'Fournitures de bureau', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(5, 1, 'Électricité', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(6, 1, 'Internet & Téléphone', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(7, 1, 'Maintenance & Réparations', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(8, 1, 'Marketing & Publicité', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(9, 1, 'Assurances', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(10, 1, 'Divers', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14');

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

--
-- Structure de la table `failed_jobs`
--

CREATE TABLE `failed_jobs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `uuid` varchar(191) NOT NULL,
  `connection` text NOT NULL,
  `queue` text NOT NULL,
  `payload` longtext NOT NULL,
  `exception` longtext NOT NULL,
  `failed_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Structure de la table `jobs`
--

CREATE TABLE `jobs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `queue` varchar(191) NOT NULL,
  `payload` longtext NOT NULL,
  `attempts` tinyint(3) UNSIGNED NOT NULL,
  `reserved_at` int(10) UNSIGNED DEFAULT NULL,
  `available_at` int(10) UNSIGNED NOT NULL,
  `created_at` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Structure de la table `migrations`
--

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

--
-- Déchargement des données de la table `migrations`
--

INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2019_08_19_000000_create_failed_jobs_table', 1),
(2, '2021_01_02_193004_create_langs_table', 1),
(3, '2021_01_02_193005_create_translations_table', 1),
(4, '2021_02_01_040700_create_payment_modes_table', 1),
(5, '2021_03_01_040700_create_currencies_table', 1),
(6, '2021_03_02_130932_create_warehouses_table', 1),
(7, '2021_03_03_114417_create_companies_table', 1),
(8, '2021_04_04_000000_create_users_table', 1),
(9, '2021_04_05_190756_entrust_setup_tables', 1),
(10, '2021_05_06_151454_create_brands_table', 1),
(11, '2021_05_06_162224_create_categories_table', 1),
(12, '2021_05_07_033806_create_taxes_table', 1),
(13, '2021_05_07_033823_create_units_table', 1),
(14, '2021_05_08_052842_create_expense_categories_table', 1),
(15, '2021_05_08_052858_create_expenses_table', 1),
(16, '2021_05_08_144116_custom_fields_table', 1),
(17, '2021_05_09_153334_create_products_table', 1),
(18, '2021_05_13_072501_create_orders_table', 1),
(19, '2021_05_13_072518_create_order_items_table', 1),
(20, '2021_05_23_060918_create_payments_table', 1),
(21, '2021_05_23_060919_create_order_payments_table', 1),
(22, '2021_05_28_120405_create_warehouse_stocks_table', 1),
(23, '2021_10_10_100006_create_stock_history_table', 1),
(24, '2022_01_10_115820_create_stock_adjustments_table', 1),
(25, '2022_02_01_094402_create_settings_table', 1),
(26, '2022_02_24_075933_create_notifications_table', 1),
(27, '2022_02_24_122754_create_jobs_table', 1),
(28, '2022_03_07_110707_create_warehouse_history_table', 1),
(29, '2026_02_14_000001_add_saas_multi_tenancy', 1),
(30, '2026_02_14_000002_add_is_superadmin_to_users', 1),
(31, '2026_02_14_000003_add_saas_translations', 1),
(32, '2026_02_14_000004_add_superadmin_frontend_translations', 1),
(33, '2026_04_16_151748_add_activation_fee_to_plans_table', 1),
(34, '2026_04_22_145037_add_is_demo_to_companies_table', 2);

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

--
-- Structure de la table `notifications`
--

CREATE TABLE `notifications` (
  `id` char(36) NOT NULL,
  `type` varchar(191) NOT NULL,
  `notifiable_type` varchar(191) NOT NULL,
  `notifiable_id` bigint(20) UNSIGNED NOT NULL,
  `data` text NOT NULL,
  `read_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;

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

--
-- Structure de la table `orders`
--

CREATE TABLE `orders` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED DEFAULT NULL,
  `unique_id` varchar(20) NOT NULL,
  `invoice_number` varchar(20) NOT NULL,
  `invoice_type` varchar(20) DEFAULT NULL,
  `order_type` varchar(20) NOT NULL DEFAULT 'sales',
  `order_date` datetime NOT NULL,
  `warehouse_id` bigint(20) UNSIGNED DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `tax_id` bigint(20) UNSIGNED DEFAULT NULL,
  `tax_rate` float DEFAULT NULL,
  `tax_amount` double NOT NULL DEFAULT 0,
  `discount` double DEFAULT NULL,
  `shipping` double DEFAULT NULL,
  `subtotal` double NOT NULL,
  `total` double NOT NULL,
  `paid_amount` double NOT NULL DEFAULT 0,
  `due_amount` double NOT NULL DEFAULT 0,
  `order_status` varchar(20) NOT NULL,
  `notes` text DEFAULT NULL,
  `document` varchar(191) DEFAULT NULL,
  `staff_user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `payment_status` varchar(20) NOT NULL DEFAULT 'unpaid',
  `total_items` float NOT NULL DEFAULT 0,
  `total_quantity` float NOT NULL DEFAULT 0,
  `terms_condition` text DEFAULT NULL,
  `is_deletable` tinyint(1) NOT NULL DEFAULT 1,
  `cancelled` tinyint(1) NOT NULL DEFAULT 0,
  `cancelled_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Structure de la table `order_custom_fields`
--

CREATE TABLE `order_custom_fields` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED DEFAULT NULL,
  `order_id` bigint(20) UNSIGNED NOT NULL,
  `field_name` varchar(191) NOT NULL,
  `field_value` varchar(191) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Structure de la table `order_items`
--

CREATE TABLE `order_items` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `order_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `unit_id` bigint(20) UNSIGNED DEFAULT NULL,
  `quantity` float NOT NULL,
  `unit_price` double NOT NULL,
  `single_unit_price` double NOT NULL,
  `tax_id` bigint(20) UNSIGNED DEFAULT NULL,
  `tax_rate` float NOT NULL DEFAULT 0,
  `tax_type` varchar(10) DEFAULT NULL,
  `discount_rate` float DEFAULT NULL,
  `total_tax` double DEFAULT NULL,
  `total_discount` double DEFAULT NULL,
  `subtotal` double NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Structure de la table `order_payments`
--

CREATE TABLE `order_payments` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED DEFAULT NULL,
  `payment_id` bigint(20) UNSIGNED NOT NULL,
  `order_id` bigint(20) UNSIGNED DEFAULT NULL,
  `amount` double NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Structure de la table `payments`
--

CREATE TABLE `payments` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED DEFAULT NULL,
  `warehouse_id` bigint(20) UNSIGNED DEFAULT NULL,
  `payment_type` varchar(20) NOT NULL DEFAULT 'out',
  `payment_number` varchar(191) DEFAULT NULL,
  `date` date NOT NULL,
  `amount` double NOT NULL DEFAULT 0,
  `unused_amount` double NOT NULL DEFAULT 0,
  `paid_amount` double NOT NULL DEFAULT 0,
  `payment_mode_id` bigint(20) UNSIGNED DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `payment_receipt` varchar(191) DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Structure de la table `payment_modes`
--

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

--
-- Déchargement des données de la table `payment_modes`
--

INSERT INTO `payment_modes` (`id`, `company_id`, `name`, `created_at`, `updated_at`) VALUES
(1, 1, 'Cash', '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(2, 1, 'Espèces', '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(3, 1, 'Carte Bancaire', '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(4, 1, 'Virement Bancaire', '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(5, 1, 'Chèque', '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(6, 1, 'Mobile Money', '2026-04-22 14:21:14', '2026-04-22 14:21:14');

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

--
-- Structure de la table `permissions`
--

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

--
-- Déchargement des données de la table `permissions`
--

INSERT INTO `permissions` (`id`, `name`, `display_name`, `description`, `module_name`, `created_at`, `updated_at`) VALUES
(1, 'brands_view', 'Brand View', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(2, 'brands_create', 'Brand Create', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(3, 'brands_edit', 'Brand Edit', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(4, 'brands_delete', 'Brand Delete', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(5, 'categories_view', 'Category View', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(6, 'categories_create', 'Category Create', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(7, 'categories_edit', 'Category Edit', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(8, 'categories_delete', 'Category Delete', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(9, 'products_view', 'Product View', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(10, 'products_create', 'Product Create', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(11, 'products_edit', 'Product Edit', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(12, 'products_delete', 'Product Delete', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(13, 'purchases_view', 'Purchase View', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(14, 'purchases_create', 'Purchase Create', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(15, 'purchases_edit', 'Purchase Edit', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(16, 'purchases_delete', 'Purchase Delete', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(17, 'purchase_returns_view', 'Purchase Return View', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(18, 'purchase_returns_create', 'Purchase Return Create', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(19, 'purchase_returns_edit', 'Purchase Return Edit', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(20, 'purchase_returns_delete', 'Purchase Return Delete', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(21, 'sales_view', 'Sales View', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(22, 'sales_create', 'Sales Create', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(23, 'sales_edit', 'Sales Edit', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(24, 'sales_delete', 'Sales Delete', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(25, 'sales_returns_view', 'Sales Return View', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(26, 'sales_returns_create', 'Sales Return Create', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(27, 'sales_returns_edit', 'Sales Return Edit', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(28, 'sales_returns_delete', 'Sales Return Delete', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(29, 'order_payments_view', 'Order Payments View', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(30, 'order_payments_create', 'Order Payments Create', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(31, 'order_payments_edit', 'Order Payments Edit', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(32, 'order_payments_delete', 'Order Payments Delete', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(33, 'stock_adjustments_view', 'Stock Adjustment View', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(34, 'stock_adjustments_create', 'Stock Adjustment Create', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(35, 'stock_adjustments_edit', 'Stock Adjustment Edit', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(36, 'stock_adjustments_delete', 'Stock Adjustment Delete', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(37, 'expense_categories_view', 'Expense Category View', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(38, 'expense_categories_create', 'Expense Category Create', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(39, 'expense_categories_edit', 'Expense Category Edit', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(40, 'expense_categories_delete', 'Expense Category Delete', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(41, 'expenses_view', 'Expense View', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(42, 'expenses_create', 'Expense Create', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(43, 'expenses_edit', 'Expense Edit', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(44, 'expenses_delete', 'Expense Delete', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(45, 'units_view', 'Unit View', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(46, 'units_create', 'Unit Create', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(47, 'units_edit', 'Unit Edit', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(48, 'units_delete', 'Unit Delete', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(49, 'custom_fields_view', 'Custom Field View', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(50, 'custom_fields_create', 'Custom Field Create', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(51, 'custom_fields_edit', 'Custom Field Edit', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(52, 'custom_fields_delete', 'Custom Field Delete', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(53, 'payment_modes_view', 'Payment Mode View', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(54, 'payment_modes_create', 'Payment Mode Create', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(55, 'payment_modes_edit', 'Payment Mode Edit', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(56, 'payment_modes_delete', 'Payment Mode Delete', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(57, 'currencies_view', 'Currency View', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(58, 'currencies_create', 'Currency Create', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(59, 'currencies_edit', 'Currency Edit', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(60, 'currencies_delete', 'Currency Delete', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(61, 'taxes_view', 'Tax View', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(62, 'taxes_create', 'Tax Create', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(63, 'taxes_edit', 'Tax Edit', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(64, 'taxes_delete', 'Tax Delete', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(65, 'modules_view', 'Modules View', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(66, 'roles_view', 'Role View', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(67, 'roles_create', 'Role Create', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(68, 'roles_edit', 'Role Edit', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(69, 'roles_delete', 'Role Delete', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(70, 'warehouses_view', 'Warehouse View', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(71, 'warehouses_create', 'Warehouse Create', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(72, 'warehouses_edit', 'Warehouse Edit', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(73, 'warehouses_delete', 'Warehouse Delete', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(74, 'companies_edit', 'Company Edit', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(75, 'translations_view', 'Translation View', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(76, 'translations_create', 'Translation Create', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(77, 'translations_edit', 'Translation Edit', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(78, 'translations_delete', 'Translation Delete', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(79, 'users_view', 'Staff Member View', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(80, 'users_create', 'Staff Member Create', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(81, 'users_edit', 'Staff Member Edit', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(82, 'users_delete', 'Staff Member Delete', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(83, 'customers_view', 'Customer View', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(84, 'customers_create', 'Customer Create', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(85, 'customers_edit', 'Customer Edit', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(86, 'customers_delete', 'Customer Delete', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(87, 'suppliers_view', 'Supplier View', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(88, 'suppliers_create', 'Supplier Create', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(89, 'suppliers_edit', 'Supplier Edit', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(90, 'suppliers_delete', 'Supplier Delete', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(91, 'storage_edit', 'Storage Settings Edit', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(92, 'email_edit', 'Email Settings Edit', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(93, 'pos_view', 'POS View', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(94, 'update_app', 'Update App', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09');

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

--
-- Structure de la table `permission_role`
--

CREATE TABLE `permission_role` (
  `permission_id` bigint(20) UNSIGNED NOT NULL,
  `role_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Déchargement des données de la table `permission_role`
--

INSERT INTO `permission_role` (`permission_id`, `role_id`) VALUES
(1, 1),
(1, 2),
(2, 1),
(3, 1),
(4, 1),
(5, 1),
(5, 2),
(6, 1),
(7, 1),
(8, 1),
(9, 1),
(9, 2),
(10, 1),
(11, 1),
(12, 1),
(13, 1),
(13, 2),
(14, 1),
(14, 2),
(15, 1),
(16, 1),
(17, 1),
(18, 1),
(19, 1),
(20, 1),
(21, 1),
(21, 2),
(22, 1),
(22, 2),
(23, 1),
(24, 1),
(25, 1),
(26, 1),
(27, 1),
(28, 1),
(29, 1),
(29, 2),
(30, 1),
(30, 2),
(31, 1),
(32, 1),
(33, 1),
(34, 1),
(35, 1),
(36, 1),
(37, 1),
(38, 1),
(39, 1),
(40, 1),
(41, 1),
(42, 1),
(43, 1),
(44, 1),
(45, 1),
(46, 1),
(47, 1),
(48, 1),
(49, 1),
(50, 1),
(51, 1),
(52, 1),
(53, 1),
(54, 1),
(55, 1),
(56, 1),
(57, 1),
(58, 1),
(59, 1),
(60, 1),
(61, 1),
(62, 1),
(63, 1),
(64, 1),
(65, 1),
(66, 1),
(67, 1),
(68, 1),
(69, 1),
(70, 1),
(71, 1),
(72, 1),
(73, 1),
(74, 1),
(75, 1),
(76, 1),
(77, 1),
(78, 1),
(79, 1),
(80, 1),
(81, 1),
(82, 1),
(83, 1),
(83, 2),
(84, 1),
(84, 2),
(85, 1),
(86, 1),
(87, 1),
(87, 2),
(88, 1),
(89, 1),
(90, 1),
(91, 1),
(92, 1),
(93, 1),
(93, 2),
(94, 1);

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

--
-- Structure de la table `permission_user`
--

CREATE TABLE `permission_user` (
  `permission_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `user_type` varchar(191) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Structure de la table `plans`
--

CREATE TABLE `plans` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(191) NOT NULL,
  `slug` varchar(191) NOT NULL,
  `stripe_price_id` varchar(191) DEFAULT NULL,
  `monthly_price` decimal(10,2) NOT NULL DEFAULT 0.00,
  `yearly_price` decimal(10,2) NOT NULL DEFAULT 0.00,
  `activation_fee` decimal(10,2) NOT NULL DEFAULT 0.00,
  `max_warehouses` int(11) NOT NULL DEFAULT 1,
  `max_users` int(11) NOT NULL DEFAULT 3,
  `max_products` int(11) NOT NULL DEFAULT 100,
  `max_brands` int(11) NOT NULL DEFAULT 10,
  `max_categories` int(11) NOT NULL DEFAULT 20,
  `has_reports` tinyint(1) NOT NULL DEFAULT 0,
  `has_pos` tinyint(1) NOT NULL DEFAULT 0,
  `has_stock_adjustment` tinyint(1) NOT NULL DEFAULT 0,
  `has_multi_warehouse` tinyint(1) NOT NULL DEFAULT 0,
  `description` text DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `sort_order` int(11) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Déchargement des données de la table `plans`
--

INSERT INTO `plans` (`id`, `name`, `slug`, `stripe_price_id`, `monthly_price`, `yearly_price`, `activation_fee`, `max_warehouses`, `max_users`, `max_products`, `max_brands`, `max_categories`, `has_reports`, `has_pos`, `has_stock_adjustment`, `has_multi_warehouse`, `description`, `is_active`, `sort_order`, `created_at`, `updated_at`) VALUES
(1, 'Gratuit', 'free', NULL, 0.00, 0.00, 0.00, 1, 1, 5, 1, 2, 0, 0, 0, 0, 'Pour tester et découvrir la plateforme', 1, 1, '2026-04-24 13:40:45', '2026-04-24 13:46:24'),
(2, 'Micro', 'micro', NULL, 4900.00, 49000.00, 30000.00, 1, 1, 20, 15, 15, 0, 0, 0, 0, 'Pour les vendeurs individuels et kiosques', 1, 2, '2026-04-24 13:40:45', '2026-04-24 13:46:24'),
(3, 'PME', 'pme', NULL, 14900.00, 149000.00, 100000.00, 1, 2, 50, 50, 20, 0, 1, 0, 0, 'Pour les petites boutiques structurées', 1, 3, '2026-04-24 13:40:45', '2026-04-24 13:46:24'),
(4, 'Business', 'business', NULL, 49900.00, 499000.00, 200000.00, 2, 3, 100, 50, 25, 1, 1, 1, 1, 'Pour les commerces en croissance', 1, 4, '2026-04-24 13:40:45', '2026-04-24 13:46:24'),
(5, 'Entreprise', 'enterprise', NULL, 99900.00, 999000.00, 500000.00, 9999, 9999, 9999999, 9999, 9999, 1, 1, 1, 1, 'Pour les grandes structures, avec accompagnement', 1, 5, '2026-04-24 13:40:45', '2026-04-24 13:46:24');

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

--
-- Structure de la table `products`
--

CREATE TABLE `products` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED DEFAULT NULL,
  `name` varchar(1000) NOT NULL,
  `slug` varchar(1000) NOT NULL,
  `barcode_symbology` varchar(10) NOT NULL,
  `item_code` varchar(191) NOT NULL,
  `image` varchar(191) DEFAULT NULL,
  `category_id` bigint(20) UNSIGNED DEFAULT NULL,
  `brand_id` bigint(20) UNSIGNED DEFAULT NULL,
  `unit_id` bigint(20) UNSIGNED DEFAULT NULL,
  `description` text DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Déchargement des données de la table `products`
--

INSERT INTO `products` (`id`, `company_id`, `name`, `slug`, `barcode_symbology`, `item_code`, `image`, `category_id`, `brand_id`, `unit_id`, `description`, `user_id`, `created_at`, `updated_at`) VALUES
(1, 1, 'Ordinateur Portable HP 15', 'ordinateur-portable-hp-15', 'C128', 'LQR3508', 'demo_laptop.jpg', 1, NULL, 1, NULL, NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(2, 1, 'Smartphone Samsung Galaxy A54', 'smartphone-samsung-galaxy-a54', 'C128', '7461916', 'demo_smartphone.jpg', 6, NULL, 1, NULL, NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(3, 1, 'Télévision LED 43 pouces', 'television-led-43-pouces', 'C128', 'AEU5907', 'demo_tv.jpg', 7, NULL, 1, NULL, NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(4, 1, 'Écouteurs Bluetooth', 'ecouteurs-bluetooth', 'C128', '73A1513', 'demo_earbuds.jpg', 1, NULL, 1, NULL, NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(5, 1, 'Chargeur USB-C 65W', 'chargeur-usb-c-65w', 'C128', 'S0F1379', 'demo_charger.jpg', 1, NULL, 1, NULL, NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(6, 1, 'Chemise Homme Classique', 'chemise-homme-classique', 'C128', '3RU5802', 'demo_shirt.jpg', 8, NULL, 1, NULL, NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(7, 1, 'Robe Femme Élégante', 'robe-femme-elegante', 'C128', '7AG5003', 'demo_dress.jpg', 8, NULL, 1, NULL, NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(8, 1, 'Baskets Sport Nike Air', 'baskets-sport-nike-air', 'C128', 'JHP5835', 'demo_sneakers.jpg', 9, NULL, 1, NULL, NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(9, 1, 'Riz Local 25kg', 'riz-local-25kg', 'C128', '50T3756', 'demo_rice.jpg', 3, NULL, 3, NULL, NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(10, 1, 'Huile de Palme 5L', 'huile-de-palme-5l', 'C128', 'JZK7570', 'demo_oil.jpg', 3, NULL, 4, NULL, NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(11, 1, 'Sucre Cristallisé 1kg', 'sucre-cristallise-1kg', 'C128', 'T5Z1008', 'demo_sugar.jpg', 3, NULL, 3, NULL, NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(12, 1, 'Ventilateur de Table 40cm', 'ventilateur-de-table-40cm', 'C128', 'UAY7241', 'demo_fan.jpg', 4, NULL, 1, NULL, NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(13, 1, 'Bouilloire Électrique 1.8L', 'bouilloire-electrique-18l', 'C128', 'W4S6842', 'demo_kettle.jpg', 4, NULL, 1, NULL, NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14');

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

--
-- Structure de la table `product_custom_fields`
--

CREATE TABLE `product_custom_fields` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED DEFAULT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `warehouse_id` bigint(20) UNSIGNED DEFAULT NULL,
  `field_name` varchar(191) NOT NULL,
  `field_value` varchar(191) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Structure de la table `product_details`
--

CREATE TABLE `product_details` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED DEFAULT NULL,
  `product_id` bigint(20) UNSIGNED DEFAULT NULL,
  `warehouse_id` bigint(20) UNSIGNED DEFAULT NULL,
  `current_stock` float NOT NULL DEFAULT 0,
  `mrp` double DEFAULT NULL,
  `purchase_price` double NOT NULL,
  `sales_price` double NOT NULL,
  `tax_id` bigint(20) UNSIGNED DEFAULT NULL,
  `purchase_tax_type` varchar(10) DEFAULT 'exclusive',
  `sales_tax_type` varchar(10) DEFAULT 'exclusive',
  `stock_quantitiy_alert` int(11) DEFAULT NULL,
  `opening_stock` int(11) DEFAULT NULL,
  `opening_stock_date` date DEFAULT NULL,
  `wholesale_price` double DEFAULT NULL,
  `wholesale_quantity` int(11) DEFAULT NULL,
  `status` varchar(191) NOT NULL DEFAULT 'in_stock',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Déchargement des données de la table `product_details`
--

INSERT INTO `product_details` (`id`, `company_id`, `product_id`, `warehouse_id`, `current_stock`, `mrp`, `purchase_price`, `sales_price`, `tax_id`, `purchase_tax_type`, `sales_tax_type`, `stock_quantitiy_alert`, `opening_stock`, `opening_stock_date`, `wholesale_price`, `wholesale_quantity`, `status`, `created_at`, `updated_at`) VALUES
(1, 1, 1, 1, 15, 350000, 250000, 320000, 2, 'exclusive', 'exclusive', NULL, 15, NULL, NULL, NULL, 'enabled', '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(2, 1, 2, 1, 30, 170000, 120000, 155000, 2, 'exclusive', 'exclusive', NULL, 30, NULL, NULL, NULL, 'enabled', '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(3, 1, 3, 1, 10, 250000, 180000, 230000, 2, 'exclusive', 'exclusive', NULL, 10, NULL, NULL, NULL, 'enabled', '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(4, 1, 4, 1, 50, 25000, 15000, 22000, 2, 'exclusive', 'exclusive', NULL, 50, NULL, NULL, NULL, 'enabled', '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(5, 1, 5, 1, 80, 14000, 8000, 12000, 2, 'exclusive', 'exclusive', NULL, 80, NULL, NULL, NULL, 'enabled', '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(6, 1, 6, 1, 40, 18000, 8000, 15000, 2, 'exclusive', 'exclusive', NULL, 40, NULL, NULL, NULL, 'enabled', '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(7, 1, 7, 1, 25, 25000, 12000, 22000, 2, 'exclusive', 'exclusive', NULL, 25, NULL, NULL, NULL, 'enabled', '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(8, 1, 8, 1, 20, 50000, 30000, 45000, 2, 'exclusive', 'exclusive', NULL, 20, NULL, NULL, NULL, 'enabled', '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(9, 1, 9, 1, 100, 16000, 12000, 15000, 6, 'exclusive', 'exclusive', NULL, 100, NULL, NULL, NULL, 'enabled', '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(10, 1, 10, 1, 60, 6500, 4500, 6000, 6, 'exclusive', 'exclusive', NULL, 60, NULL, NULL, NULL, 'enabled', '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(11, 1, 11, 1, 200, 900, 600, 800, 6, 'exclusive', 'exclusive', NULL, 200, NULL, NULL, NULL, 'enabled', '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(12, 1, 12, 1, 18, 28000, 18000, 25000, 2, 'exclusive', 'exclusive', NULL, 18, NULL, NULL, NULL, 'enabled', '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(13, 1, 13, 1, 22, 17000, 10000, 15000, 2, 'exclusive', 'exclusive', NULL, 22, NULL, NULL, NULL, 'enabled', '2026-04-22 14:21:14', '2026-04-22 14:21:14');

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

--
-- Structure de la table `roles`
--

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

--
-- Déchargement des données de la table `roles`
--

INSERT INTO `roles` (`id`, `company_id`, `name`, `display_name`, `description`, `created_at`, `updated_at`) VALUES
(1, 1, 'admin', 'Admin', 'Admin is allowed to manage everything of the app.', '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(2, 1, 'staff', 'Personnel', NULL, '2026-04-22 14:21:14', '2026-04-22 14:21:14');

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

--
-- Structure de la table `role_user`
--

CREATE TABLE `role_user` (
  `role_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `user_type` varchar(191) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Déchargement des données de la table `role_user`
--

INSERT INTO `role_user` (`role_id`, `user_id`, `user_type`) VALUES
(1, 1, 'App\\Models\\User'),
(1, 2, 'App\\Models\\User'),
(2, 3, 'App\\Models\\User');

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

--
-- Structure de la table `stock_adjustments`
--

CREATE TABLE `stock_adjustments` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED DEFAULT NULL,
  `warehouse_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `quantity` float NOT NULL,
  `adjustment_type` varchar(20) NOT NULL DEFAULT 'add',
  `notes` text DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Structure de la table `stock_history`
--

CREATE TABLE `stock_history` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED DEFAULT NULL,
  `warehouse_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `quantity` float NOT NULL,
  `old_quantity` float NOT NULL DEFAULT 0,
  `order_type` varchar(20) DEFAULT 'sales',
  `stock_type` varchar(20) NOT NULL DEFAULT 'in',
  `action_type` varchar(20) NOT NULL DEFAULT 'add',
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Structure de la table `subscriptions`
--

CREATE TABLE `subscriptions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `plan_id` bigint(20) UNSIGNED NOT NULL,
  `stripe_subscription_id` varchar(191) DEFAULT NULL,
  `stripe_customer_id` varchar(191) DEFAULT NULL,
  `status` varchar(191) NOT NULL DEFAULT 'active',
  `billing_cycle` varchar(191) NOT NULL DEFAULT 'monthly',
  `starts_at` timestamp NULL DEFAULT NULL,
  `ends_at` timestamp NULL DEFAULT NULL,
  `trial_ends_at` timestamp NULL DEFAULT NULL,
  `cancelled_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;

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

--
-- Structure de la table `subscription_invoices`
--

CREATE TABLE `subscription_invoices` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `subscription_id` bigint(20) UNSIGNED NOT NULL,
  `stripe_invoice_id` varchar(191) DEFAULT NULL,
  `invoice_number` varchar(191) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `currency` varchar(3) NOT NULL DEFAULT 'XOF',
  `status` varchar(191) NOT NULL DEFAULT 'pending',
  `paid_at` timestamp NULL DEFAULT NULL,
  `due_date` timestamp NULL DEFAULT NULL,
  `description` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Structure de la table `taxes`
--

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

--
-- Déchargement des données de la table `taxes`
--

INSERT INTO `taxes` (`id`, `company_id`, `name`, `rate`, `created_at`, `updated_at`) VALUES
(1, 1, 'TVA 20%', 20, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(2, 1, 'TVA 18%', 18, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(3, 1, 'TVA 10%', 10, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(4, 1, 'TVA 5.5%', 5.5, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(5, 1, 'TVA 2.1%', 2.1, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(6, 1, 'Exonéré', 0, '2026-04-22 14:21:14', '2026-04-22 14:21:14');

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

--
-- Structure de la table `units`
--

CREATE TABLE `units` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED DEFAULT NULL,
  `name` varchar(191) NOT NULL,
  `short_name` varchar(191) NOT NULL,
  `base_unit` varchar(191) DEFAULT NULL,
  `parent_id` bigint(20) UNSIGNED DEFAULT NULL,
  `operator` varchar(191) NOT NULL,
  `operator_value` varchar(191) NOT NULL,
  `is_deletable` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Déchargement des données de la table `units`
--

INSERT INTO `units` (`id`, `company_id`, `name`, `short_name`, `base_unit`, `parent_id`, `operator`, `operator_value`, `is_deletable`, `created_at`, `updated_at`) VALUES
(1, 1, 'piece', 'pc', NULL, NULL, 'multiply', '1', 0, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(2, 1, 'meter', 'm', NULL, NULL, 'multiply', '1', 0, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(3, 1, 'kilogram', 'kg', NULL, NULL, 'multiply', '1', 0, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(4, 1, 'liter', 'l', NULL, NULL, 'multiply', '1', 0, '2026-04-22 14:21:09', '2026-04-22 14:21:09'),
(5, 1, 'Gramme', 'g', NULL, NULL, 'divide', '1000', 1, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(6, 1, 'Centimètre', 'cm', NULL, NULL, 'divide', '100', 1, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(7, 1, 'Boîte', 'box', NULL, NULL, 'multiply', '1', 1, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(8, 1, 'Carton', 'ctn', NULL, NULL, 'multiply', '1', 1, '2026-04-22 14:21:14', '2026-04-22 14:21:14'),
(9, 1, 'Douzaine', 'dz', NULL, NULL, 'multiply', '12', 1, '2026-04-22 14:21:14', '2026-04-22 14:21:14');

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

--
-- Structure de la table `user_details`
--

CREATE TABLE `user_details` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED DEFAULT NULL,
  `warehouse_id` bigint(20) UNSIGNED DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `opening_balance` double NOT NULL DEFAULT 0,
  `opening_balance_type` varchar(20) NOT NULL DEFAULT 'receive',
  `credit_period` int(11) NOT NULL DEFAULT 0,
  `credit_limit` double NOT NULL DEFAULT 0,
  `purchase_order_count` int(11) NOT NULL DEFAULT 0,
  `purchase_return_count` int(11) NOT NULL DEFAULT 0,
  `sales_order_count` int(11) NOT NULL DEFAULT 0,
  `sales_return_count` int(11) NOT NULL DEFAULT 0,
  `total_amount` double NOT NULL DEFAULT 0,
  `paid_amount` double NOT NULL DEFAULT 0,
  `due_amount` double NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Déchargement des données de la table `user_details`
--

INSERT INTO `user_details` (`id`, `company_id`, `warehouse_id`, `user_id`, `opening_balance`, `opening_balance_type`, `credit_period`, `credit_limit`, `purchase_order_count`, `purchase_return_count`, `sales_order_count`, `sales_return_count`, `total_amount`, `paid_amount`, `due_amount`, `created_at`, `updated_at`) VALUES
(1, 1, 1, 1, 0, 'receive', 0, 0, 0, 0, 0, 0, 0, 0, 0, '2026-04-22 14:21:09', '2026-04-22 14:21:09');

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

--
-- Structure de la table `warehouses`
--

CREATE TABLE `warehouses` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED DEFAULT NULL,
  `logo` varchar(191) DEFAULT NULL,
  `name` varchar(191) NOT NULL,
  `email` varchar(191) NOT NULL,
  `phone` varchar(191) NOT NULL,
  `show_email_on_invoice` tinyint(1) NOT NULL DEFAULT 0,
  `show_phone_on_invoice` tinyint(1) NOT NULL DEFAULT 0,
  `address` varchar(191) DEFAULT NULL,
  `terms_condition` text DEFAULT NULL,
  `bank_details` text DEFAULT NULL,
  `signature` varchar(191) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Déchargement des données de la table `warehouses`
--

INSERT INTO `warehouses` (`id`, `company_id`, `logo`, `name`, `email`, `phone`, `show_email_on_invoice`, `show_phone_on_invoice`, `address`, `terms_condition`, `bank_details`, `signature`, `created_at`, `updated_at`) VALUES
(1, 1, NULL, 'Gestion Stock', 'contact@gestionstock.com', '9999999999', 0, 0, NULL, '1. Goods once sold will not be taken back or exchanged\n2. All disputes are subject to [ENTER_YOUR_CITY_NAME] jurisdiction only', NULL, NULL, '2026-04-22 14:21:09', '2026-04-22 14:21:09');

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

--
-- Structure de la table `warehouse_history`
--

CREATE TABLE `warehouse_history` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED DEFAULT NULL,
  `date` date NOT NULL,
  `warehouse_id` bigint(20) UNSIGNED DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `order_id` bigint(20) UNSIGNED DEFAULT NULL,
  `order_item_id` bigint(20) UNSIGNED DEFAULT NULL,
  `product_id` bigint(20) UNSIGNED DEFAULT NULL,
  `payment_id` bigint(20) UNSIGNED DEFAULT NULL,
  `expense_id` bigint(20) UNSIGNED DEFAULT NULL,
  `amount` double NOT NULL DEFAULT 0,
  `quantity` float NOT NULL DEFAULT 0,
  `status` varchar(191) DEFAULT NULL,
  `type` varchar(191) DEFAULT NULL,
  `transaction_number` varchar(191) DEFAULT NULL,
  `updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Structure de la table `warehouse_stocks`
--

CREATE TABLE `warehouse_stocks` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED DEFAULT NULL,
  `warehouse_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `stock_quantity` float NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Index pour les tables déchargées
--

--
-- Index pour la table `brands`
--
ALTER TABLE `brands`
  ADD PRIMARY KEY (`id`),
  ADD KEY `brands_company_id_index` (`company_id`);

--
-- Index pour la table `categories`
--
ALTER TABLE `categories`
  ADD PRIMARY KEY (`id`),
  ADD KEY `categories_parent_id_foreign` (`parent_id`),
  ADD KEY `categories_company_id_index` (`company_id`);

--
-- Index pour la table `companies`
--
ALTER TABLE `companies`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `companies_slug_unique` (`slug`),
  ADD KEY `companies_currency_id_foreign` (`currency_id`),
  ADD KEY `companies_lang_id_foreign` (`lang_id`),
  ADD KEY `companies_warehouse_id_foreign` (`warehouse_id`);

--
-- Index pour la table `currencies`
--
ALTER TABLE `currencies`
  ADD PRIMARY KEY (`id`),
  ADD KEY `currencies_company_id_index` (`company_id`);

--
-- Index pour la table `custom_fields`
--
ALTER TABLE `custom_fields`
  ADD PRIMARY KEY (`id`),
  ADD KEY `custom_fields_company_id_index` (`company_id`);

--
-- Index pour la table `expenses`
--
ALTER TABLE `expenses`
  ADD PRIMARY KEY (`id`),
  ADD KEY `expenses_expense_category_id_foreign` (`expense_category_id`),
  ADD KEY `expenses_warehouse_id_foreign` (`warehouse_id`),
  ADD KEY `expenses_user_id_foreign` (`user_id`),
  ADD KEY `expenses_company_id_index` (`company_id`);

--
-- Index pour la table `expense_categories`
--
ALTER TABLE `expense_categories`
  ADD PRIMARY KEY (`id`),
  ADD KEY `expense_categories_company_id_index` (`company_id`);

--
-- Index pour la table `failed_jobs`
--
ALTER TABLE `failed_jobs`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`);

--
-- Index pour la table `jobs`
--
ALTER TABLE `jobs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `jobs_queue_index` (`queue`);

--
-- Index pour la table `migrations`
--
ALTER TABLE `migrations`
  ADD PRIMARY KEY (`id`);

--
-- Index pour la table `notifications`
--
ALTER TABLE `notifications`
  ADD PRIMARY KEY (`id`),
  ADD KEY `notifications_notifiable_type_notifiable_id_index` (`notifiable_type`,`notifiable_id`);

--
-- Index pour la table `orders`
--
ALTER TABLE `orders`
  ADD PRIMARY KEY (`id`),
  ADD KEY `orders_warehouse_id_foreign` (`warehouse_id`),
  ADD KEY `orders_user_id_foreign` (`user_id`),
  ADD KEY `orders_tax_id_foreign` (`tax_id`),
  ADD KEY `orders_staff_user_id_foreign` (`staff_user_id`),
  ADD KEY `orders_cancelled_by_foreign` (`cancelled_by`),
  ADD KEY `orders_company_id_index` (`company_id`);

--
-- Index pour la table `order_custom_fields`
--
ALTER TABLE `order_custom_fields`
  ADD PRIMARY KEY (`id`),
  ADD KEY `order_custom_fields_order_id_foreign` (`order_id`),
  ADD KEY `order_custom_fields_company_id_index` (`company_id`);

--
-- Index pour la table `order_items`
--
ALTER TABLE `order_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `order_items_user_id_foreign` (`user_id`),
  ADD KEY `order_items_order_id_foreign` (`order_id`),
  ADD KEY `order_items_product_id_foreign` (`product_id`),
  ADD KEY `order_items_unit_id_foreign` (`unit_id`),
  ADD KEY `order_items_tax_id_foreign` (`tax_id`),
  ADD KEY `order_items_company_id_index` (`company_id`);

--
-- Index pour la table `order_payments`
--
ALTER TABLE `order_payments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `order_payments_payment_id_foreign` (`payment_id`),
  ADD KEY `order_payments_order_id_foreign` (`order_id`),
  ADD KEY `order_payments_company_id_index` (`company_id`);

--
-- Index pour la table `payments`
--
ALTER TABLE `payments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `payments_warehouse_id_foreign` (`warehouse_id`),
  ADD KEY `payments_payment_mode_id_foreign` (`payment_mode_id`),
  ADD KEY `payments_user_id_foreign` (`user_id`),
  ADD KEY `payments_company_id_index` (`company_id`);

--
-- Index pour la table `payment_modes`
--
ALTER TABLE `payment_modes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `payment_modes_company_id_index` (`company_id`);

--
-- Index pour la table `permissions`
--
ALTER TABLE `permissions`
  ADD PRIMARY KEY (`id`);

--
-- Index pour la table `permission_role`
--
ALTER TABLE `permission_role`
  ADD PRIMARY KEY (`permission_id`,`role_id`),
  ADD KEY `permission_role_role_id_foreign` (`role_id`);

--
-- Index pour la table `permission_user`
--
ALTER TABLE `permission_user`
  ADD PRIMARY KEY (`user_id`,`permission_id`,`user_type`),
  ADD KEY `permission_user_permission_id_foreign` (`permission_id`);

--
-- Index pour la table `plans`
--
ALTER TABLE `plans`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `plans_slug_unique` (`slug`);

--
-- Index pour la table `products`
--
ALTER TABLE `products`
  ADD PRIMARY KEY (`id`),
  ADD KEY `products_category_id_foreign` (`category_id`),
  ADD KEY `products_brand_id_foreign` (`brand_id`),
  ADD KEY `products_unit_id_foreign` (`unit_id`),
  ADD KEY `products_user_id_foreign` (`user_id`),
  ADD KEY `products_company_id_index` (`company_id`);

--
-- Index pour la table `product_custom_fields`
--
ALTER TABLE `product_custom_fields`
  ADD PRIMARY KEY (`id`),
  ADD KEY `product_custom_fields_product_id_foreign` (`product_id`),
  ADD KEY `product_custom_fields_warehouse_id_foreign` (`warehouse_id`),
  ADD KEY `product_custom_fields_company_id_index` (`company_id`);

--
-- Index pour la table `product_details`
--
ALTER TABLE `product_details`
  ADD PRIMARY KEY (`id`),
  ADD KEY `product_details_product_id_foreign` (`product_id`),
  ADD KEY `product_details_warehouse_id_foreign` (`warehouse_id`),
  ADD KEY `product_details_tax_id_foreign` (`tax_id`),
  ADD KEY `product_details_company_id_index` (`company_id`);

--
-- Index pour la table `roles`
--
ALTER TABLE `roles`
  ADD PRIMARY KEY (`id`),
  ADD KEY `roles_company_id_index` (`company_id`);

--
-- Index pour la table `role_user`
--
ALTER TABLE `role_user`
  ADD PRIMARY KEY (`user_id`,`role_id`,`user_type`),
  ADD KEY `role_user_role_id_foreign` (`role_id`);

--
-- Index pour la table `stock_adjustments`
--
ALTER TABLE `stock_adjustments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `stock_adjustments_warehouse_id_foreign` (`warehouse_id`),
  ADD KEY `stock_adjustments_product_id_foreign` (`product_id`),
  ADD KEY `stock_adjustments_created_by_foreign` (`created_by`),
  ADD KEY `stock_adjustments_company_id_index` (`company_id`);

--
-- Index pour la table `stock_history`
--
ALTER TABLE `stock_history`
  ADD PRIMARY KEY (`id`),
  ADD KEY `stock_history_warehouse_id_foreign` (`warehouse_id`),
  ADD KEY `stock_history_product_id_foreign` (`product_id`),
  ADD KEY `stock_history_created_by_foreign` (`created_by`),
  ADD KEY `stock_history_company_id_index` (`company_id`);

--
-- Index pour la table `subscriptions`
--
ALTER TABLE `subscriptions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `subscriptions_plan_id_foreign` (`plan_id`),
  ADD KEY `subscriptions_company_id_status_index` (`company_id`,`status`);

--
-- Index pour la table `subscription_invoices`
--
ALTER TABLE `subscription_invoices`
  ADD PRIMARY KEY (`id`),
  ADD KEY `subscription_invoices_company_id_foreign` (`company_id`),
  ADD KEY `subscription_invoices_subscription_id_foreign` (`subscription_id`);

--
-- Index pour la table `taxes`
--
ALTER TABLE `taxes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `taxes_company_id_index` (`company_id`);

--
-- Index pour la table `units`
--
ALTER TABLE `units`
  ADD PRIMARY KEY (`id`),
  ADD KEY `units_parent_id_foreign` (`parent_id`),
  ADD KEY `units_company_id_index` (`company_id`);

--
-- Index pour la table `user_details`
--
ALTER TABLE `user_details`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_details_warehouse_id_foreign` (`warehouse_id`),
  ADD KEY `user_details_user_id_foreign` (`user_id`),
  ADD KEY `user_details_company_id_index` (`company_id`);

--
-- Index pour la table `warehouses`
--
ALTER TABLE `warehouses`
  ADD PRIMARY KEY (`id`),
  ADD KEY `warehouses_company_id_index` (`company_id`);

--
-- Index pour la table `warehouse_history`
--
ALTER TABLE `warehouse_history`
  ADD PRIMARY KEY (`id`),
  ADD KEY `warehouse_history_warehouse_id_foreign` (`warehouse_id`),
  ADD KEY `warehouse_history_user_id_foreign` (`user_id`),
  ADD KEY `warehouse_history_order_id_foreign` (`order_id`),
  ADD KEY `warehouse_history_order_item_id_foreign` (`order_item_id`),
  ADD KEY `warehouse_history_product_id_foreign` (`product_id`),
  ADD KEY `warehouse_history_payment_id_foreign` (`payment_id`),
  ADD KEY `warehouse_history_expense_id_foreign` (`expense_id`),
  ADD KEY `warehouse_history_company_id_index` (`company_id`);

--
-- Index pour la table `warehouse_stocks`
--
ALTER TABLE `warehouse_stocks`
  ADD PRIMARY KEY (`id`),
  ADD KEY `warehouse_stocks_warehouse_id_foreign` (`warehouse_id`),
  ADD KEY `warehouse_stocks_product_id_foreign` (`product_id`),
  ADD KEY `warehouse_stocks_company_id_index` (`company_id`);

--
-- AUTO_INCREMENT pour les tables déchargées
--

--
-- AUTO_INCREMENT pour la table `brands`
--
ALTER TABLE `brands`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=24;

--
-- AUTO_INCREMENT pour la table `categories`
--
ALTER TABLE `categories`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT pour la table `companies`
--
ALTER TABLE `companies`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT pour la table `currencies`
--
ALTER TABLE `currencies`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;

--
-- AUTO_INCREMENT pour la table `custom_fields`
--
ALTER TABLE `custom_fields`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT pour la table `expenses`
--
ALTER TABLE `expenses`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT pour la table `expense_categories`
--
ALTER TABLE `expense_categories`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=31;

--
-- AUTO_INCREMENT pour la table `failed_jobs`
--
ALTER TABLE `failed_jobs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT pour la table `jobs`
--
ALTER TABLE `jobs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT pour la table `migrations`
--
ALTER TABLE `migrations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=35;

--
-- AUTO_INCREMENT pour la table `orders`
--
ALTER TABLE `orders`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT pour la table `order_custom_fields`
--
ALTER TABLE `order_custom_fields`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT pour la table `order_items`
--
ALTER TABLE `order_items`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT pour la table `order_payments`
--
ALTER TABLE `order_payments`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT pour la table `payments`
--
ALTER TABLE `payments`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT pour la table `payment_modes`
--
ALTER TABLE `payment_modes`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;

--
-- AUTO_INCREMENT pour la table `permissions`
--
ALTER TABLE `permissions`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=95;

--
-- AUTO_INCREMENT pour la table `plans`
--
ALTER TABLE `plans`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT pour la table `products`
--
ALTER TABLE `products`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=40;

--
-- AUTO_INCREMENT pour la table `product_custom_fields`
--
ALTER TABLE `product_custom_fields`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT pour la table `product_details`
--
ALTER TABLE `product_details`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=40;

--
-- AUTO_INCREMENT pour la table `roles`
--
ALTER TABLE `roles`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT pour la table `stock_adjustments`
--
ALTER TABLE `stock_adjustments`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT pour la table `stock_history`
--
ALTER TABLE `stock_history`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT pour la table `subscriptions`
--
ALTER TABLE `subscriptions`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT pour la table `subscription_invoices`
--
ALTER TABLE `subscription_invoices`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT pour la table `taxes`
--
ALTER TABLE `taxes`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;

--
-- AUTO_INCREMENT pour la table `units`
--
ALTER TABLE `units`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=28;

--
-- AUTO_INCREMENT pour la table `user_details`
--
ALTER TABLE `user_details`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22;

--
-- AUTO_INCREMENT pour la table `warehouses`
--
ALTER TABLE `warehouses`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT pour la table `warehouse_history`
--
ALTER TABLE `warehouse_history`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT pour la table `warehouse_stocks`
--
ALTER TABLE `warehouse_stocks`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- Contraintes pour les tables déchargées
--

--
-- Contraintes pour la table `categories`
--
ALTER TABLE `categories`
  ADD CONSTRAINT `categories_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `categories` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Contraintes pour la table `companies`
--
ALTER TABLE `companies`
  ADD CONSTRAINT `companies_currency_id_foreign` FOREIGN KEY (`currency_id`) REFERENCES `currencies` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `companies_lang_id_foreign` FOREIGN KEY (`lang_id`) REFERENCES `langs` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `companies_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Contraintes pour la table `expenses`
--
ALTER TABLE `expenses`
  ADD CONSTRAINT `expenses_expense_category_id_foreign` FOREIGN KEY (`expense_category_id`) REFERENCES `expense_categories` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `expenses_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `expenses_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Contraintes pour la table `orders`
--
ALTER TABLE `orders`
  ADD CONSTRAINT `orders_cancelled_by_foreign` FOREIGN KEY (`cancelled_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `orders_staff_user_id_foreign` FOREIGN KEY (`staff_user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `orders_tax_id_foreign` FOREIGN KEY (`tax_id`) REFERENCES `taxes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `orders_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `orders_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Contraintes pour la table `order_custom_fields`
--
ALTER TABLE `order_custom_fields`
  ADD CONSTRAINT `order_custom_fields_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Contraintes pour la table `order_items`
--
ALTER TABLE `order_items`
  ADD CONSTRAINT `order_items_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `order_items_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `order_items_tax_id_foreign` FOREIGN KEY (`tax_id`) REFERENCES `taxes` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `order_items_unit_id_foreign` FOREIGN KEY (`unit_id`) REFERENCES `units` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `order_items_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Contraintes pour la table `order_payments`
--
ALTER TABLE `order_payments`
  ADD CONSTRAINT `order_payments_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `order_payments_payment_id_foreign` FOREIGN KEY (`payment_id`) REFERENCES `payments` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Contraintes pour la table `payments`
--
ALTER TABLE `payments`
  ADD CONSTRAINT `payments_payment_mode_id_foreign` FOREIGN KEY (`payment_mode_id`) REFERENCES `payment_modes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `payments_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `payments_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Contraintes pour la table `permission_role`
--
ALTER TABLE `permission_role`
  ADD CONSTRAINT `permission_role_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `permission_role_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Contraintes pour la table `permission_user`
--
ALTER TABLE `permission_user`
  ADD CONSTRAINT `permission_user_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Contraintes pour la table `products`
--
ALTER TABLE `products`
  ADD CONSTRAINT `products_brand_id_foreign` FOREIGN KEY (`brand_id`) REFERENCES `brands` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `products_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `products_unit_id_foreign` FOREIGN KEY (`unit_id`) REFERENCES `units` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `products_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;

--
-- Contraintes pour la table `product_custom_fields`
--
ALTER TABLE `product_custom_fields`
  ADD CONSTRAINT `product_custom_fields_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `product_custom_fields_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Contraintes pour la table `product_details`
--
ALTER TABLE `product_details`
  ADD CONSTRAINT `product_details_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `product_details_tax_id_foreign` FOREIGN KEY (`tax_id`) REFERENCES `taxes` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `product_details_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Contraintes pour la table `role_user`
--
ALTER TABLE `role_user`
  ADD CONSTRAINT `role_user_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Contraintes pour la table `stock_adjustments`
--
ALTER TABLE `stock_adjustments`
  ADD CONSTRAINT `stock_adjustments_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `stock_adjustments_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `stock_adjustments_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Contraintes pour la table `stock_history`
--
ALTER TABLE `stock_history`
  ADD CONSTRAINT `stock_history_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `stock_history_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `stock_history_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Contraintes pour la table `subscriptions`
--
ALTER TABLE `subscriptions`
  ADD CONSTRAINT `subscriptions_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `subscriptions_plan_id_foreign` FOREIGN KEY (`plan_id`) REFERENCES `plans` (`id`);

--
-- Contraintes pour la table `subscription_invoices`
--
ALTER TABLE `subscription_invoices`
  ADD CONSTRAINT `subscription_invoices_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `subscription_invoices_subscription_id_foreign` FOREIGN KEY (`subscription_id`) REFERENCES `subscriptions` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `units`
--
ALTER TABLE `units`
  ADD CONSTRAINT `units_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `units` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Contraintes pour la table `user_details`
--
ALTER TABLE `user_details`
  ADD CONSTRAINT `user_details_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `user_details_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Contraintes pour la table `warehouse_history`
--
ALTER TABLE `warehouse_history`
  ADD CONSTRAINT `warehouse_history_expense_id_foreign` FOREIGN KEY (`expense_id`) REFERENCES `expenses` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `warehouse_history_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `warehouse_history_order_item_id_foreign` FOREIGN KEY (`order_item_id`) REFERENCES `order_items` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `warehouse_history_payment_id_foreign` FOREIGN KEY (`payment_id`) REFERENCES `payments` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `warehouse_history_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `warehouse_history_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `warehouse_history_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Contraintes pour la table `warehouse_stocks`
--
ALTER TABLE `warehouse_stocks`
  ADD CONSTRAINT `warehouse_stocks_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `warehouse_stocks_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;

