-- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Hôte : localhost
-- Généré le :  lun. 27 fév. 2023 à 10:39
-- Version du serveur :  10.3.23-MariaDB-0+deb10u1
-- Version de PHP :  7.3.27-9+0~20210227.82+debian10~1.gbpa4a3d6

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

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

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

--
-- Structure de la table `mouvements_deleted`
--

CREATE TABLE `mouvements_deleted` (
  `id` int(10) UNSIGNED NOT NULL,
  `magasinier_code` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `depot_code` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `commercial_code` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `soussociete_code` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `caisse_code` varchar(191) COLLATE utf8_unicode_ci DEFAULT NULL,
  `produit_code` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `prix_achat_ht` double DEFAULT NULL,
  `prix_achat_ttc` double DEFAULT 0,
  `prix_ttc` double DEFAULT NULL,
  `p_tva` double DEFAULT NULL,
  `taux_tva` double DEFAULT NULL,
  `remise` double NOT NULL DEFAULT 0,
  `quantite` double NOT NULL DEFAULT 1,
  `qte_demande` double NOT NULL DEFAULT 0,
  `stk_before_inventaire` int(11) DEFAULT NULL,
  `stk_after_inventaire` int(11) DEFAULT NULL,
  `prix_ht` double DEFAULT NULL,
  `type` enum('dc','chargement','dechargement','bl','casse','retour','garantie','venteC','retourC','casseC','cadeauxC','gratuiteC','inventaire','demande_avoir','dlc','achat','casse_usine','dlc_usine','inventaire_stock','inventaire_dlc','inventaire_casse','inventaire_reservation','inventaire_securite','dlcC','Rgratuite','Cgratuite','Dgratuite') COLLATE utf8_unicode_ci NOT NULL,
  `from_stock` tinyint(1) NOT NULL DEFAULT 1,
  `num_serie` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `numero` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `configuration` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `etat` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `isSync` tinyint(1) NOT NULL DEFAULT 0,
  `wavesoft` varchar(1) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',
  `num_lot` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `cloture` tinyint(1) NOT NULL DEFAULT 0,
  `date` datetime DEFAULT NULL,
  `date_accept` datetime DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;



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

--
-- Index pour la table `mouvements_deleted`
--
ALTER TABLE `mouvements_deleted`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `produit_code` (`produit_code`,`num_serie`,`numero`,`configuration`,`from_stock`) USING BTREE,
  ADD UNIQUE KEY `commercial_code` (`commercial_code`,`produit_code`,`quantite`,`type`,`numero`,`from_stock`) USING BTREE,
  ADD KEY `mouvements_deleted_magasinier_code_foreign` (`magasinier_code`),
  ADD KEY `mouvements_deleted_depot_code_foreign` (`depot_code`),
  ADD KEY `mouvements_deleted_commercial_code_foreign` (`commercial_code`),
  ADD KEY `mouvements_deleted_produit_code_foreign` (`produit_code`),
  ADD KEY `mouvements_deleted_num_serie_foreign` (`num_serie`),
  ADD KEY `soussociete_code` (`soussociete_code`);

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

--
-- AUTO_INCREMENT pour la table `mouvements_deleted`
--
ALTER TABLE `mouvements_deleted`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

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

--
-- Contraintes pour la table `mouvements_deleted`
--
ALTER TABLE `mouvements_deleted`
  ADD CONSTRAINT `mouvements_deleted_commercial_code_foreign` FOREIGN KEY (`commercial_code`) REFERENCES `users` (`code`) ON DELETE CASCADE,
  ADD CONSTRAINT `mouvements_deleted_depot_code_foreign` FOREIGN KEY (`depot_code`) REFERENCES `depots` (`code`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `mouvements_deleted_ibfk_1` FOREIGN KEY (`soussociete_code`) REFERENCES `soussocietes` (`code`),
  ADD CONSTRAINT `mouvements_deleted_ibfk_2` FOREIGN KEY (`soussociete_code`) REFERENCES `soussocietes` (`code`),
  ADD CONSTRAINT `mouvements_deleted_ibfk_3` FOREIGN KEY (`soussociete_code`) REFERENCES `soussocietes` (`code`),
  ADD CONSTRAINT `mouvements_deleted_magasinier_code_foreign` FOREIGN KEY (`magasinier_code`) REFERENCES `users` (`code`) ON DELETE CASCADE,
  ADD CONSTRAINT `mouvements_deleted_num_serie_foreign` FOREIGN KEY (`num_serie`) REFERENCES `numeroseries` (`valeur`) ON DELETE CASCADE,
  ADD CONSTRAINT `mouvements_deleted_produit_code_foreign` FOREIGN KEY (`produit_code`) REFERENCES `produits` (`code`) ON DELETE CASCADE;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;