/*M!999999\- enable the sandbox mode */ -- MariaDB dump 10.19-11.4.5-MariaDB, for Linux (x86_64) -- -- Host: localhost Database: geo_app -- ------------------------------------------------------ -- Server version 11.4.5-MariaDB /*!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 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*M!100616 SET @OLD_NOTE_VERBOSITY=@@NOTE_VERBOSITY, NOTE_VERBOSITY=0 */; -- -- Table structure for table `chat_messages` -- DROP TABLE IF EXISTS `chat_messages`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `chat_messages` ( `id` varchar(36) NOT NULL COMMENT 'UUID du message', `room_id` varchar(36) NOT NULL COMMENT 'ID de la salle', `content` text NOT NULL COMMENT 'Contenu du message', `sender_id` int(11) unsigned NOT NULL COMMENT 'ID de l''expéditeur', `sent_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Date d''envoi', `edited_at` timestamp NULL DEFAULT NULL COMMENT 'Date de modification', `is_deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Message supprimé', PRIMARY KEY (`id`), KEY `idx_room_id` (`room_id`), KEY `idx_sender_id` (`sender_id`), KEY `idx_sent_at` (`sent_at`), KEY `idx_room_sent` (`room_id`,`sent_at`), CONSTRAINT `fk_chat_messages_room` FOREIGN KEY (`room_id`) REFERENCES `chat_rooms` (`id`) ON DELETE CASCADE, CONSTRAINT `fk_chat_messages_sender` FOREIGN KEY (`sender_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Messages du chat' `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `chat_participants` -- DROP TABLE IF EXISTS `chat_participants`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `chat_participants` ( `room_id` varchar(36) NOT NULL COMMENT 'ID de la salle', `user_id` int(11) unsigned NOT NULL COMMENT 'ID de l''utilisateur', `role` int(11) DEFAULT NULL COMMENT 'Rôle de l''utilisateur (fk_role)', `entite_id` int(11) unsigned DEFAULT NULL COMMENT 'ID de l''entité', `joined_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Date d''adhésion', `left_at` timestamp NULL DEFAULT NULL COMMENT 'Date de départ', `is_admin` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Admin de la salle', `can_write` tinyint(1) DEFAULT 1 COMMENT 'Permission d''écrire dans la room (FALSE pour les destinataires de broadcast)', `last_read_at` timestamp NULL DEFAULT NULL COMMENT 'Dernière lecture', PRIMARY KEY (`room_id`,`user_id`), KEY `idx_user_id` (`user_id`), KEY `idx_entite_id` (`entite_id`), KEY `idx_joined_at` (`joined_at`), KEY `idx_chat_user_rooms` (`user_id`,`left_at`,`joined_at` DESC), KEY `idx_can_write` (`can_write`), CONSTRAINT `fk_chat_participants_entite` FOREIGN KEY (`entite_id`) REFERENCES `entites` (`id`) ON DELETE SET NULL, CONSTRAINT `fk_chat_participants_room` FOREIGN KEY (`room_id`) REFERENCES `chat_rooms` (`id`) ON DELETE CASCADE, CONSTRAINT `fk_chat_participants_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Participants aux conversations' `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `chat_read_receipts` -- DROP TABLE IF EXISTS `chat_read_receipts`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `chat_read_receipts` ( `message_id` varchar(36) NOT NULL COMMENT 'ID du message', `user_id` int(11) unsigned NOT NULL COMMENT 'ID de l''utilisateur', `read_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Date de lecture', PRIMARY KEY (`message_id`,`user_id`), KEY `idx_user_id` (`user_id`), KEY `idx_read_at` (`read_at`), CONSTRAINT `fk_chat_read_message` FOREIGN KEY (`message_id`) REFERENCES `chat_messages` (`id`) ON DELETE CASCADE, CONSTRAINT `fk_chat_read_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Accusés de lecture' `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `chat_rooms` -- DROP TABLE IF EXISTS `chat_rooms`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `chat_rooms` ( `id` varchar(36) NOT NULL COMMENT 'UUID de la salle', `title` varchar(255) DEFAULT NULL COMMENT 'Titre de la conversation', `type` enum('private','group','broadcast') NOT NULL DEFAULT 'private' COMMENT 'Type de conversation', `created_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Date de création', `created_by` int(11) unsigned NOT NULL COMMENT 'ID du créateur', `updated_at` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() COMMENT 'Dernière modification', `is_active` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Conversation active', PRIMARY KEY (`id`), KEY `idx_created_by` (`created_by`), KEY `idx_type` (`type`), KEY `idx_created_at` (`created_at`), KEY `idx_chat_active_rooms` (`is_active`,`created_at` DESC), CONSTRAINT `fk_chat_rooms_creator` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Salles de conversation' `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Temporary table structure for view `chat_rooms_with_last_message` -- DROP TABLE IF EXISTS `chat_rooms_with_last_message`; /*!50001 DROP VIEW IF EXISTS `chat_rooms_with_last_message`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8mb4; /*!50001 CREATE VIEW `chat_rooms_with_last_message` AS SELECT 1 AS `id`, 1 AS `title`, 1 AS `type`, 1 AS `created_at`, 1 AS `created_by`, 1 AS `updated_at`, 1 AS `is_active`, 1 AS `last_message_content`, 1 AS `last_message_sender`, 1 AS `last_message_at`, 1 AS `last_message_sender_name` */; SET character_set_client = @saved_cs_client; -- -- Table structure for table `email_counter` -- DROP TABLE IF EXISTS `email_counter`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `email_counter` ( `id` int(10) unsigned NOT NULL DEFAULT 1, `hour_start` timestamp NULL DEFAULT NULL, `count` int(10) unsigned DEFAULT 0, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `email_queue` -- DROP TABLE IF EXISTS `email_queue`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `email_queue` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `fk_pass` int(10) unsigned NOT NULL DEFAULT 0, `to_email` varchar(255) DEFAULT NULL, `subject` varchar(255) DEFAULT NULL, `body` text DEFAULT NULL, `headers` text DEFAULT NULL, `created_at` timestamp NULL DEFAULT current_timestamp(), `status` enum('pending','sent','failed') DEFAULT 'pending', `sent_at` timestamp NULL DEFAULT NULL COMMENT 'Date/heure envoi effectif de l email', `attempts` int(10) unsigned DEFAULT 0, `error_message` text DEFAULT NULL COMMENT 'Message erreur en cas d échec', PRIMARY KEY (`id`), KEY `idx_status_attempts` (`status`,`attempts`), KEY `idx_sent_at` (`sent_at`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `entites` -- DROP TABLE IF EXISTS `entites`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `entites` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `encrypted_name` varchar(255) DEFAULT NULL, `adresse1` varchar(45) DEFAULT '', `adresse2` varchar(45) DEFAULT '', `code_postal` varchar(5) DEFAULT '', `ville` varchar(45) DEFAULT '', `fk_region` int(10) unsigned DEFAULT NULL, `fk_type` int(10) unsigned DEFAULT 1, `encrypted_phone` varchar(128) DEFAULT '', `encrypted_mobile` varchar(128) DEFAULT '', `encrypted_email` varchar(255) DEFAULT '', `gps_lat` varchar(20) NOT NULL DEFAULT '', `gps_lng` varchar(20) NOT NULL DEFAULT '', `chk_stripe` tinyint(1) unsigned DEFAULT 0, `encrypted_stripe_id` varchar(255) DEFAULT '', `encrypted_iban` varchar(255) DEFAULT '', `encrypted_bic` varchar(128) DEFAULT '', `chk_demo` tinyint(1) unsigned DEFAULT 1, `chk_mdp_manuel` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT 'Gestion des mots de passe manuelle (1) ou automatique (0)', `chk_username_manuel` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT 'Gestion des usernames manuelle (1) ou automatique (0)', `chk_user_delete_pass` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT 'Autoriser les membres à supprimer des passages (1) ou non (0)', `chk_copie_mail_recu` tinyint(1) unsigned NOT NULL DEFAULT 0, `chk_accept_sms` tinyint(1) unsigned NOT NULL DEFAULT 0, `chk_lot_actif` tinyint(1) unsigned NOT NULL DEFAULT 0, `created_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Date de création', `fk_user_creat` int(10) unsigned DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() COMMENT 'Date de modification', `fk_user_modif` int(10) unsigned DEFAULT NULL, `chk_active` tinyint(1) unsigned DEFAULT 1, PRIMARY KEY (`id`), KEY `entites_ibfk_1` (`fk_region`), KEY `entites_ibfk_2` (`fk_type`), CONSTRAINT `entites_ibfk_1` FOREIGN KEY (`fk_region`) REFERENCES `x_regions` (`id`) ON UPDATE CASCADE, CONSTRAINT `entites_ibfk_2` FOREIGN KEY (`fk_type`) REFERENCES `x_entites_types` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=1230 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `medias` -- DROP TABLE IF EXISTS `medias`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `medias` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `support` varchar(45) NOT NULL DEFAULT '', `support_id` int(10) unsigned NOT NULL DEFAULT 0, `fk_entite` int(10) unsigned DEFAULT NULL COMMENT 'ID de entité propriétaire', `fk_operation` int(10) unsigned DEFAULT NULL COMMENT 'ID de opération (pour passages)', `fichier` varchar(250) NOT NULL DEFAULT '', `file_type` varchar(50) DEFAULT NULL COMMENT 'Extension du fichier (pdf, jpg, xlsx, etc.)', `file_category` varchar(50) DEFAULT NULL COMMENT 'export, logo, carte', `file_size` int(10) unsigned DEFAULT NULL COMMENT 'Taille du fichier en octets', `mime_type` varchar(100) DEFAULT NULL COMMENT 'Type MIME du fichier', `original_name` varchar(255) DEFAULT NULL COMMENT 'Nom original du fichier uploadé', `file_path` varchar(500) DEFAULT NULL COMMENT 'Chemin complet du fichier', `original_width` int(10) unsigned DEFAULT NULL COMMENT 'Largeur originale de image', `original_height` int(10) unsigned DEFAULT NULL COMMENT 'Hauteur originale de image', `processed_width` int(10) unsigned DEFAULT NULL COMMENT 'Largeur après traitement', `processed_height` int(10) unsigned DEFAULT NULL COMMENT 'Hauteur après traitement', `is_processed` tinyint(1) unsigned DEFAULT 0 COMMENT 'Image redimensionnée (1) ou originale (0)', `description` varchar(100) NOT NULL DEFAULT '', `created_at` timestamp NOT NULL DEFAULT current_timestamp(), `fk_user_creat` int(10) unsigned NOT NULL DEFAULT 0, `updated_at` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp(), `fk_user_modif` int(10) unsigned NOT NULL DEFAULT 0, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`), KEY `idx_entite` (`fk_entite`), KEY `idx_operation` (`fk_operation`), KEY `idx_support_type` (`support`,`support_id`), KEY `idx_file_type` (`file_type`), KEY `idx_file_category` (`file_category`), CONSTRAINT `fk_medias_entite` FOREIGN KEY (`fk_entite`) REFERENCES `entites` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fk_medias_operation` FOREIGN KEY (`fk_operation`) REFERENCES `operations` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=184 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `ope_pass` -- DROP TABLE IF EXISTS `ope_pass`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `ope_pass` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `fk_operation` int(10) unsigned NOT NULL DEFAULT 0, `fk_sector` int(10) unsigned DEFAULT NULL, `fk_user` int(10) unsigned NOT NULL DEFAULT 0, `fk_adresse` varchar(25) DEFAULT '' COMMENT 'adresses.cp??.id', `passed_at` timestamp NULL DEFAULT NULL COMMENT 'Date du passage', `fk_type` int(10) unsigned DEFAULT 0, `numero` varchar(10) NOT NULL DEFAULT '', `rue` varchar(75) NOT NULL DEFAULT '', `rue_bis` varchar(1) NOT NULL DEFAULT '', `ville` varchar(75) NOT NULL DEFAULT '', `fk_habitat` int(10) unsigned DEFAULT 1, `appt` varchar(5) DEFAULT '', `niveau` varchar(5) DEFAULT '', `residence` varchar(75) DEFAULT '', `gps_lat` varchar(20) NOT NULL DEFAULT '', `gps_lng` varchar(20) NOT NULL DEFAULT '', `encrypted_name` varchar(255) NOT NULL DEFAULT '', `montant` decimal(7,2) NOT NULL DEFAULT 0.00, `fk_type_reglement` int(10) unsigned DEFAULT 4, `remarque` text DEFAULT '', `encrypted_email` varchar(255) DEFAULT '', `nom_recu` varchar(50) DEFAULT NULL, `date_recu` timestamp NULL DEFAULT NULL COMMENT 'Date de réception', `date_creat_recu` timestamp NULL DEFAULT NULL COMMENT 'Date de création du reçu', `date_sent_recu` timestamp NULL DEFAULT NULL COMMENT 'Date envoi du reçu', `email_erreur` varchar(30) DEFAULT '', `chk_email_sent` tinyint(1) unsigned NOT NULL DEFAULT 0, `encrypted_phone` varchar(128) NOT NULL DEFAULT '', `docremis` tinyint(1) unsigned DEFAULT 0, `date_repasser` timestamp NULL DEFAULT NULL COMMENT 'Date prévue pour repasser', `nb_passages` int(11) DEFAULT 1 COMMENT 'Nb passages pour les a repasser', `chk_gps_maj` tinyint(1) unsigned DEFAULT 0, `chk_map_create` tinyint(1) unsigned DEFAULT 0, `chk_mobile` tinyint(1) unsigned DEFAULT 0, `chk_synchro` tinyint(1) unsigned DEFAULT 1 COMMENT 'chk synchro entre web et appli', `chk_api_adresse` tinyint(1) unsigned DEFAULT 0, `chk_maj_adresse` tinyint(1) unsigned DEFAULT 0, `anomalie` tinyint(1) unsigned DEFAULT 0, `created_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Date de création', `fk_user_creat` int(10) unsigned DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() COMMENT 'Date de modification', `fk_user_modif` int(10) unsigned DEFAULT NULL, `chk_active` tinyint(1) unsigned NOT NULL DEFAULT 1, `stripe_payment_id` varchar(50) DEFAULT NULL COMMENT 'ID du PaymentIntent Stripe (pi_xxx)', PRIMARY KEY (`id`), KEY `fk_operation` (`fk_operation`), KEY `fk_sector` (`fk_sector`), KEY `fk_user` (`fk_user`), KEY `fk_type` (`fk_type`), KEY `fk_type_reglement` (`fk_type_reglement`), KEY `email` (`encrypted_email`), KEY `idx_fk_adresse` (`fk_adresse`), KEY `idx_address_lookup` (`fk_operation`,`numero`,`rue`,`ville`), KEY `idx_stripe_payment` (`stripe_payment_id`), CONSTRAINT `ope_pass_ibfk_1` FOREIGN KEY (`fk_operation`) REFERENCES `operations` (`id`) ON UPDATE CASCADE, CONSTRAINT `ope_pass_ibfk_2` FOREIGN KEY (`fk_sector`) REFERENCES `ope_sectors` (`id`) ON UPDATE CASCADE, CONSTRAINT `ope_pass_ibfk_3` FOREIGN KEY (`fk_user`) REFERENCES `users` (`id`) ON UPDATE CASCADE, CONSTRAINT `ope_pass_ibfk_4` FOREIGN KEY (`fk_type_reglement`) REFERENCES `x_types_reglements` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=19502730 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `ope_pass_histo` -- DROP TABLE IF EXISTS `ope_pass_histo`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `ope_pass_histo` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `fk_pass` int(10) unsigned NOT NULL DEFAULT 0, `date_histo` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Date historique', `sujet` varchar(50) DEFAULT NULL, `remarque` varchar(250) NOT NULL DEFAULT '', PRIMARY KEY (`id`), KEY `ope_pass_histo_fk_pass_IDX` (`fk_pass`) USING BTREE, KEY `ope_pass_histo_date_histo_IDX` (`date_histo`) USING BTREE, CONSTRAINT `ope_pass_histo_ibfk_1` FOREIGN KEY (`fk_pass`) REFERENCES `ope_pass` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=6752 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `ope_sectors` -- DROP TABLE IF EXISTS `ope_sectors`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `ope_sectors` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `fk_operation` int(10) unsigned NOT NULL DEFAULT 0, `fk_old_sector` int(10) unsigned DEFAULT NULL, `libelle` varchar(75) NOT NULL DEFAULT '', `sector` text NOT NULL DEFAULT '', `color` varchar(7) NOT NULL DEFAULT '#4B77BE', `created_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Date de création', `fk_user_creat` int(10) unsigned NOT NULL DEFAULT 0, `updated_at` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() COMMENT 'Date de modification', `fk_user_modif` int(10) unsigned NOT NULL DEFAULT 0, `chk_active` tinyint(1) unsigned NOT NULL DEFAULT 1, PRIMARY KEY (`id`), UNIQUE KEY `id` (`id`), KEY `fk_operation` (`fk_operation`), CONSTRAINT `ope_sectors_ibfk_1` FOREIGN KEY (`fk_operation`) REFERENCES `operations` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=27697 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `ope_users` -- DROP TABLE IF EXISTS `ope_users`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `ope_users` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `fk_operation` int(10) unsigned NOT NULL DEFAULT 0, `fk_user` int(10) unsigned NOT NULL DEFAULT 0, `fk_role` int(10) unsigned DEFAULT 1, `first_name` varchar(45) DEFAULT '', `encrypted_name` varchar(255) DEFAULT '', `sect_name` varchar(60) DEFAULT '', `created_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Date de création', `fk_user_creat` int(10) unsigned DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() COMMENT 'Date de modification', `fk_user_modif` int(10) unsigned DEFAULT NULL, `chk_active` tinyint(1) unsigned NOT NULL DEFAULT 1, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`), UNIQUE KEY `idx_operation_user` (`fk_operation`,`fk_user`), KEY `ope_users_ibfk_1` (`fk_operation`), KEY `ope_users_ibfk_2` (`fk_user`), CONSTRAINT `ope_users_ibfk_1` FOREIGN KEY (`fk_operation`) REFERENCES `operations` (`id`) ON UPDATE CASCADE, CONSTRAINT `ope_users_ibfk_2` FOREIGN KEY (`fk_user`) REFERENCES `users` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=199016 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `ope_users_sectors` -- DROP TABLE IF EXISTS `ope_users_sectors`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `ope_users_sectors` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `fk_operation` int(10) unsigned NOT NULL DEFAULT 0, `fk_user` int(10) unsigned NOT NULL DEFAULT 0, `fk_sector` int(10) unsigned NOT NULL DEFAULT 0, `created_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Date de création', `fk_user_creat` int(10) unsigned NOT NULL DEFAULT 0, `updated_at` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() COMMENT 'Date de modification', `fk_user_modif` int(10) unsigned DEFAULT NULL, `chk_active` tinyint(1) unsigned DEFAULT 1, PRIMARY KEY (`id`), UNIQUE KEY `id` (`id`), UNIQUE KEY `idx_operation_user_sector` (`fk_operation`,`fk_user`,`fk_sector`), KEY `fk_operation` (`fk_operation`), KEY `fk_user` (`fk_user`), KEY `fk_sector` (`fk_sector`), CONSTRAINT `ope_users_sectors_ibfk_1` FOREIGN KEY (`fk_operation`) REFERENCES `operations` (`id`) ON UPDATE CASCADE, CONSTRAINT `ope_users_sectors_ibfk_2` FOREIGN KEY (`fk_user`) REFERENCES `users` (`id`) ON UPDATE CASCADE, CONSTRAINT `ope_users_sectors_ibfk_3` FOREIGN KEY (`fk_sector`) REFERENCES `ope_sectors` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=48141 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `operations` -- DROP TABLE IF EXISTS `operations`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `operations` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `fk_entite` int(10) unsigned NOT NULL DEFAULT 1, `libelle` varchar(75) NOT NULL DEFAULT '', `date_deb` date NOT NULL DEFAULT '0000-00-00', `date_fin` date NOT NULL DEFAULT '0000-00-00', `chk_distinct_sectors` tinyint(1) unsigned NOT NULL DEFAULT 0, `created_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Date de création', `fk_user_creat` int(10) unsigned NOT NULL DEFAULT 0, `updated_at` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() COMMENT 'Date de modification', `fk_user_modif` int(10) unsigned NOT NULL DEFAULT 0, `chk_active` tinyint(1) unsigned NOT NULL DEFAULT 1, PRIMARY KEY (`id`), KEY `fk_entite` (`fk_entite`), KEY `date_deb` (`date_deb`), CONSTRAINT `operations_ibfk_1` FOREIGN KEY (`fk_entite`) REFERENCES `entites` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=3122 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `params` -- DROP TABLE IF EXISTS `params`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `params` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `libelle` varchar(35) NOT NULL DEFAULT '', `valeur` varchar(255) NOT NULL DEFAULT '', `aide` varchar(150) NOT NULL DEFAULT '', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `sec_alerts` -- DROP TABLE IF EXISTS `sec_alerts`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `sec_alerts` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `alert_type` varchar(50) NOT NULL COMMENT 'Type d''alerte (BRUTE_FORCE, SQL_ERROR, etc.)', `alert_level` enum('INFO','WARNING','ERROR','CRITICAL','SECURITY') NOT NULL DEFAULT 'INFO', `ip_address` varchar(45) DEFAULT NULL COMMENT 'Adresse IP source', `user_id` int(11) unsigned DEFAULT NULL COMMENT 'ID utilisateur si connecté', `username` varchar(255) DEFAULT NULL COMMENT 'Username tenté ou utilisé', `endpoint` varchar(255) DEFAULT NULL COMMENT 'Endpoint API concerné', `method` varchar(10) DEFAULT NULL COMMENT 'Méthode HTTP', `details` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'Détails additionnels en JSON' CHECK (json_valid(`details`)), `occurrences` int(11) DEFAULT 1 COMMENT 'Nombre d''occurrences', `first_seen` timestamp NOT NULL DEFAULT current_timestamp(), `last_seen` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `email_sent` tinyint(1) DEFAULT 0 COMMENT 'Email d''alerte envoyé', `email_sent_at` timestamp NULL DEFAULT NULL, `resolved` tinyint(1) DEFAULT 0 COMMENT 'Alerte résolue', `resolved_at` timestamp NULL DEFAULT NULL, `resolved_by` int(11) unsigned DEFAULT NULL COMMENT 'ID admin qui a résolu', `notes` text DEFAULT NULL COMMENT 'Notes de résolution', PRIMARY KEY (`id`), KEY `idx_ip` (`ip_address`), KEY `idx_type_time` (`alert_type`,`last_seen`), KEY `idx_level` (`alert_level`), KEY `idx_resolved` (`resolved`), KEY `idx_user` (`user_id`), KEY `fk_sec_alerts_resolver` (`resolved_by`), KEY `idx_sec_alerts_recent` (`last_seen` DESC,`alert_level`), CONSTRAINT `fk_sec_alerts_resolver` FOREIGN KEY (`resolved_by`) REFERENCES `users` (`id`) ON DELETE SET NULL, CONSTRAINT `fk_sec_alerts_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL ) ENGINE=InnoDB AUTO_INCREMENT=234 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Alertes de sécurité et monitoring' `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `sec_blocked_ips` -- DROP TABLE IF EXISTS `sec_blocked_ips`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `sec_blocked_ips` ( `ip_address` varchar(45) NOT NULL COMMENT 'Adresse IP bloquée', `reason` varchar(255) NOT NULL COMMENT 'Raison du blocage', `details` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'Détails additionnels' CHECK (json_valid(`details`)), `blocked_at` timestamp NOT NULL DEFAULT current_timestamp(), `blocked_until` timestamp NOT NULL COMMENT 'Bloqué jusqu''à', `blocked_by` varchar(50) DEFAULT 'system' COMMENT 'Qui a bloqué (system ou user ID)', `permanent` tinyint(1) DEFAULT 0 COMMENT 'Blocage permanent', `unblocked_at` timestamp NULL DEFAULT NULL COMMENT 'Date de déblocage effectif', `unblocked_by` int(11) unsigned DEFAULT NULL COMMENT 'Qui a débloqué', `block_count` int(11) DEFAULT 1 COMMENT 'Nombre de fois bloquée', PRIMARY KEY (`ip_address`), KEY `idx_blocked_until` (`blocked_until`), KEY `idx_permanent` (`permanent`), KEY `fk_sec_blocked_unblocked_by` (`unblocked_by`), CONSTRAINT `fk_sec_blocked_unblocked_by` FOREIGN KEY (`unblocked_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='IPs bloquées temporairement ou définitivement' `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `sec_failed_login_attempts` -- DROP TABLE IF EXISTS `sec_failed_login_attempts`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `sec_failed_login_attempts` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `username` varchar(255) DEFAULT NULL COMMENT 'Username tenté', `encrypted_username` varchar(255) DEFAULT NULL COMMENT 'Username chiffré si trouvé', `ip_address` varchar(45) NOT NULL COMMENT 'Adresse IP', `user_agent` text DEFAULT NULL COMMENT 'User Agent', `attempt_time` timestamp NOT NULL DEFAULT current_timestamp(), `error_type` varchar(50) DEFAULT NULL COMMENT 'Type d''erreur (invalid_password, user_not_found, etc.)', `country_code` varchar(2) DEFAULT NULL COMMENT 'Code pays de l''IP (si géoloc activée)', PRIMARY KEY (`id`), KEY `idx_ip_time` (`ip_address`,`attempt_time`), KEY `idx_username` (`username`), KEY `idx_encrypted_username` (`encrypted_username`), KEY `idx_time` (`attempt_time`), KEY `idx_sec_failed_recent` (`attempt_time` DESC,`ip_address`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Tentatives de connexion échouées' `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `sec_performance_metrics` -- DROP TABLE IF EXISTS `sec_performance_metrics`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `sec_performance_metrics` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `endpoint` varchar(255) NOT NULL COMMENT 'Endpoint API', `method` varchar(10) NOT NULL COMMENT 'Méthode HTTP', `response_time_ms` int(11) NOT NULL COMMENT 'Temps de réponse total en ms', `db_time_ms` int(11) DEFAULT 0 COMMENT 'Temps cumulé des requêtes DB en ms', `db_queries_count` int(11) DEFAULT 0 COMMENT 'Nombre de requêtes DB', `memory_peak_mb` float DEFAULT NULL COMMENT 'Pic mémoire en MB', `memory_start_mb` float DEFAULT NULL COMMENT 'Mémoire au début en MB', `http_status` int(11) DEFAULT NULL COMMENT 'Code HTTP de réponse', `user_id` int(11) unsigned DEFAULT NULL COMMENT 'ID utilisateur si connecté', `ip_address` varchar(45) DEFAULT NULL COMMENT 'Adresse IP', `user_agent` text DEFAULT NULL COMMENT 'User Agent complet', `request_size` int(11) DEFAULT NULL COMMENT 'Taille de la requête en octets', `response_size` int(11) DEFAULT NULL COMMENT 'Taille de la réponse en octets', `created_at` timestamp NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`), KEY `idx_endpoint_time` (`endpoint`,`created_at`), KEY `idx_response_time` (`response_time_ms`), KEY `idx_created` (`created_at`), KEY `idx_status` (`http_status`), KEY `idx_user` (`user_id`), KEY `idx_date_endpoint` (`created_at`,`endpoint`), KEY `idx_sec_metrics_recent` (`created_at` DESC,`endpoint`) ) ENGINE=InnoDB AUTO_INCREMENT=12348 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Métriques de performance des requêtes' `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `sectors_adresses` -- DROP TABLE IF EXISTS `sectors_adresses`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `sectors_adresses` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `fk_adresse` varchar(25) DEFAULT NULL COMMENT 'adresses.cp??.id', `osm_id` int(10) unsigned NOT NULL DEFAULT 0, `fk_sector` int(10) unsigned NOT NULL DEFAULT 0, `osm_name` varchar(50) NOT NULL DEFAULT '', `numero` varchar(5) NOT NULL DEFAULT '', `rue_bis` varchar(5) NOT NULL DEFAULT '', `rue` varchar(60) NOT NULL DEFAULT '', `cp` varchar(5) NOT NULL DEFAULT '', `ville` varchar(60) NOT NULL DEFAULT '', `gps_lat` varchar(20) NOT NULL DEFAULT '', `gps_lng` varchar(20) NOT NULL DEFAULT '', `osm_date_creat` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `created_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Date de création', `updated_at` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() COMMENT 'Date de modification', PRIMARY KEY (`id`), KEY `sectors_adresses_fk_sector_index` (`fk_sector`), KEY `sectors_adresses_numero_index` (`numero`), KEY `sectors_adresses_rue_index` (`rue`), KEY `sectors_adresses_ville_index` (`ville`), KEY `idx_fk_adresse` (`fk_adresse`), CONSTRAINT `sectors_adresses_ibfk_1` FOREIGN KEY (`fk_sector`) REFERENCES `ope_sectors` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=1570831 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `stripe_accounts` -- DROP TABLE IF EXISTS `stripe_accounts`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `stripe_accounts` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `fk_entite` int(10) unsigned NOT NULL, `stripe_account_id` varchar(255) DEFAULT NULL, `stripe_location_id` varchar(255) DEFAULT NULL, `charges_enabled` tinyint(1) DEFAULT 0, `payouts_enabled` tinyint(1) DEFAULT 0, `onboarding_completed` tinyint(1) DEFAULT 0, `created_at` timestamp NULL DEFAULT current_timestamp(), `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`), UNIQUE KEY `stripe_account_id` (`stripe_account_id`), KEY `idx_fk_entite` (`fk_entite`), KEY `idx_stripe_account_id` (`stripe_account_id`), CONSTRAINT `stripe_accounts_ibfk_1` FOREIGN KEY (`fk_entite`) REFERENCES `entites` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `stripe_android_certified_devices` -- DROP TABLE IF EXISTS `stripe_android_certified_devices`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `stripe_android_certified_devices` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `manufacturer` varchar(100) DEFAULT NULL, `model` varchar(200) DEFAULT NULL, `model_identifier` varchar(200) DEFAULT NULL, `tap_to_pay_certified` tinyint(1) DEFAULT 0, `certification_date` date DEFAULT NULL, `min_android_version` int(11) DEFAULT NULL, `country` varchar(2) DEFAULT 'FR', `notes` text DEFAULT NULL, `last_verified` timestamp NULL DEFAULT current_timestamp(), `created_at` timestamp NULL DEFAULT current_timestamp(), `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`), UNIQUE KEY `unique_device` (`manufacturer`,`model`,`model_identifier`), KEY `idx_manufacturer_model` (`manufacturer`,`model`), KEY `idx_certified` (`tap_to_pay_certified`,`country`) ) ENGINE=InnoDB AUTO_INCREMENT=78 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `stripe_payment_history` -- DROP TABLE IF EXISTS `stripe_payment_history`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `stripe_payment_history` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `stripe_payment_intent_id` varchar(255) DEFAULT NULL COMMENT 'ID du PaymentIntent Stripe', `event_type` varchar(50) DEFAULT NULL COMMENT 'created, processing, succeeded, failed, refunded', `event_data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`event_data`)), `webhook_id` varchar(255) DEFAULT NULL, `created_at` timestamp NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`), KEY `idx_event_type` (`event_type`), KEY `idx_created_at` (`created_at`), KEY `idx_stripe_payment_intent_id` (`stripe_payment_intent_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `stripe_refunds` -- DROP TABLE IF EXISTS `stripe_refunds`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `stripe_refunds` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `stripe_refund_id` varchar(255) DEFAULT NULL, `stripe_payment_intent_id` varchar(255) NOT NULL COMMENT 'ID du PaymentIntent Stripe', `amount` int(11) NOT NULL COMMENT 'Montant remboursé en centimes', `reason` varchar(100) DEFAULT NULL COMMENT 'duplicate, fraudulent, requested_by_customer', `status` varchar(50) DEFAULT NULL, `metadata` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`metadata`)), `created_at` timestamp NULL DEFAULT current_timestamp(), `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`), UNIQUE KEY `stripe_refund_id` (`stripe_refund_id`), KEY `idx_status` (`status`), KEY `idx_stripe_payment_intent_id` (`stripe_payment_intent_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `stripe_terminal_readers` -- DROP TABLE IF EXISTS `stripe_terminal_readers`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `stripe_terminal_readers` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `stripe_reader_id` varchar(255) DEFAULT NULL, `fk_entite` int(10) unsigned NOT NULL, `label` varchar(255) DEFAULT NULL, `location` varchar(255) DEFAULT NULL, `status` varchar(50) DEFAULT NULL, `device_type` varchar(50) DEFAULT NULL COMMENT 'ios_tap_to_pay, android_tap_to_pay', `device_info` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'Infos sur le device (modèle, OS, etc)' CHECK (json_valid(`device_info`)), `last_seen_at` timestamp NULL DEFAULT NULL, `created_at` timestamp NULL DEFAULT current_timestamp(), `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`), UNIQUE KEY `stripe_reader_id` (`stripe_reader_id`), KEY `idx_fk_entite` (`fk_entite`), KEY `idx_device_type` (`device_type`), CONSTRAINT `stripe_terminal_readers_ibfk_1` FOREIGN KEY (`fk_entite`) REFERENCES `entites` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `stripe_webhooks` -- DROP TABLE IF EXISTS `stripe_webhooks`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `stripe_webhooks` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `stripe_event_id` varchar(255) DEFAULT NULL, `event_type` varchar(100) DEFAULT NULL, `livemode` tinyint(1) DEFAULT 0, `payload` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`payload`)), `processed` tinyint(1) DEFAULT 0, `error_message` text DEFAULT NULL, `created_at` timestamp NULL DEFAULT current_timestamp(), `processed_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `stripe_event_id` (`stripe_event_id`), KEY `idx_event_type` (`event_type`), KEY `idx_processed` (`processed`), KEY `idx_created_at` (`created_at`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `user_devices` -- DROP TABLE IF EXISTS `user_devices`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `user_devices` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `fk_user` int(10) unsigned NOT NULL COMMENT 'Référence vers la table users', `platform` varchar(20) NOT NULL COMMENT 'Plateforme: iOS, Android, etc.', `device_model` varchar(100) DEFAULT NULL COMMENT 'Modèle du device (ex: iPhone13,2)', `device_name` varchar(255) DEFAULT NULL COMMENT 'Nom personnalisé du device', `device_manufacturer` varchar(100) DEFAULT NULL COMMENT 'Fabricant (Apple, Samsung, etc.)', `device_identifier` varchar(100) DEFAULT NULL COMMENT 'Identifiant unique du device', `device_ip_local` varchar(15) DEFAULT NULL COMMENT 'Adresse IP locale IPv4', `device_ip_public` varchar(15) DEFAULT NULL COMMENT 'Adresse IP publique IPv4', `device_wifi_name` varchar(255) DEFAULT NULL COMMENT 'Nom du réseau WiFi (SSID)', `device_wifi_bssid` varchar(17) DEFAULT NULL COMMENT 'BSSID du point d''accès (format\nXX:XX:XX:XX:XX:XX)', `ios_version` varchar(20) DEFAULT NULL COMMENT 'Version iOS/Android OS', `device_nfc_capable` tinyint(1) DEFAULT NULL COMMENT 'Support NFC (1=oui, 0=non)', `device_supports_tap_to_pay` tinyint(1) DEFAULT NULL COMMENT 'Support Tap to Pay (1=oui, 0=non)', `battery_level` tinyint(3) unsigned DEFAULT NULL COMMENT 'Niveau batterie en pourcentage (0-100)', `battery_charging` tinyint(1) DEFAULT NULL COMMENT 'En charge (1=oui, 0=non)', `battery_state` varchar(20) DEFAULT NULL COMMENT 'État batterie (charging, discharging, full)', `app_version` varchar(20) DEFAULT NULL COMMENT 'Version de l''application (ex: 3.2.8)', `app_build` varchar(20) DEFAULT NULL COMMENT 'Numéro de build (ex: 328)', `last_device_info_check` timestamp NULL DEFAULT NULL COMMENT 'Dernier check des infos device côté\napp', `created_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Date de création de\nl''enregistrement', `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'Date de dernière modification', PRIMARY KEY (`id`), UNIQUE KEY `unique_user_device` (`fk_user`,`device_identifier`) COMMENT 'Un seul enregistrement\npar device/user', KEY `idx_fk_user` (`fk_user`) COMMENT 'Index pour recherche par utilisateur', KEY `idx_updated_at` (`updated_at`) COMMENT 'Index pour tri par date de mise à jour', KEY `idx_last_check` (`last_device_info_check`) COMMENT 'Index pour recherche par dernière\nvérification', CONSTRAINT `fk_user_devices_user` FOREIGN KEY (`fk_user`) REFERENCES `users` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=56 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Informations des devices\nutilisateurs' `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `users` -- DROP TABLE IF EXISTS `users`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `users` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `fk_entite` int(10) unsigned DEFAULT 1, `fk_role` int(10) unsigned DEFAULT 1, `fk_titre` int(10) unsigned DEFAULT 1, `encrypted_name` varchar(255) DEFAULT NULL, `first_name` varchar(45) DEFAULT NULL, `sect_name` varchar(60) DEFAULT '', `encrypted_user_name` varchar(255) DEFAULT '' COMMENT 'Username chiffré - Supporte UTF-8 30 caractères maximum', `user_pass_hash` varchar(60) DEFAULT NULL, `encrypted_phone` varchar(128) DEFAULT NULL, `encrypted_mobile` varchar(128) DEFAULT NULL, `encrypted_email` varchar(255) DEFAULT '', `chk_alert_email` tinyint(1) unsigned DEFAULT 1, `chk_suivi` tinyint(1) unsigned DEFAULT 0, `date_naissance` date DEFAULT NULL, `date_embauche` date DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'Date de création', `fk_user_creat` int(10) unsigned DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() COMMENT 'Date de modification', `fk_user_modif` int(10) unsigned DEFAULT NULL, `chk_active` tinyint(1) unsigned DEFAULT 1, PRIMARY KEY (`id`), KEY `fk_entite` (`fk_entite`), KEY `username` (`encrypted_user_name`), KEY `users_ibfk_2` (`fk_role`), KEY `users_ibfk_3` (`fk_titre`), KEY `idx_encrypted_user_name` (`encrypted_user_name`), CONSTRAINT `users_ibfk_1` FOREIGN KEY (`fk_entite`) REFERENCES `entites` (`id`) ON UPDATE CASCADE, CONSTRAINT `users_ibfk_2` FOREIGN KEY (`fk_role`) REFERENCES `x_users_roles` (`id`) ON UPDATE CASCADE, CONSTRAINT `users_ibfk_3` FOREIGN KEY (`fk_titre`) REFERENCES `x_users_titres` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=10027766 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Temporary table structure for view `v_stripe_entite_stats` -- DROP TABLE IF EXISTS `v_stripe_entite_stats`; /*!50001 DROP VIEW IF EXISTS `v_stripe_entite_stats`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8mb4; /*!50001 CREATE VIEW `v_stripe_entite_stats` AS SELECT 1 AS `entite_id`, 1 AS `entite_name`, 1 AS `stripe_account_id`, 1 AS `charges_enabled`, 1 AS `payouts_enabled`, 1 AS `total_passages`, 1 AS `passages_stripe`, 1 AS `revenue_stripe`, 1 AS `revenue_total` */; SET character_set_client = @saved_cs_client; -- -- Temporary table structure for view `v_stripe_payment_stats` -- DROP TABLE IF EXISTS `v_stripe_payment_stats`; /*!50001 DROP VIEW IF EXISTS `v_stripe_payment_stats`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8mb4; /*!50001 CREATE VIEW `v_stripe_payment_stats` AS SELECT 1 AS `fk_entite`, 1 AS `entite_name`, 1 AS `fk_user`, 1 AS `user_name`, 1 AS `total_ventes`, 1 AS `ventes_stripe`, 1 AS `montant_stripe`, 1 AS `montant_autres`, 1 AS `date_vente` */; SET character_set_client = @saved_cs_client; -- -- Table structure for table `x_departements` -- DROP TABLE IF EXISTS `x_departements`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `x_departements` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `code` varchar(3) DEFAULT NULL, `fk_region` int(10) unsigned DEFAULT 1, `libelle` varchar(45) DEFAULT NULL, `dept_limitrophes` varchar(100) DEFAULT NULL COMMENT 'Liste des codes départements limitrophes séparés par des virgules', `contour` geometry DEFAULT NULL COMMENT 'Contour géographique du département', `chk_active` tinyint(1) unsigned DEFAULT 1, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`), KEY `x_departements_ibfk_1` (`fk_region`), CONSTRAINT `x_departements_ibfk_1` FOREIGN KEY (`fk_region`) REFERENCES `x_regions` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=105 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `x_departements_contours` -- DROP TABLE IF EXISTS `x_departements_contours`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `x_departements_contours` ( `id` int(11) NOT NULL AUTO_INCREMENT, `code_dept` varchar(3) NOT NULL COMMENT 'Code département (22, 2A, 971...)', `nom_dept` varchar(100) NOT NULL, `contour` geometry NOT NULL COMMENT 'Géométrie du contour du département (Polygon ou MultiPolygon)', `bbox_min_lat` decimal(10,0) DEFAULT NULL COMMENT 'Latitude min de la bounding box', `bbox_max_lat` decimal(10,0) DEFAULT NULL COMMENT 'Latitude max de la bounding box', `bbox_min_lng` decimal(11,0) DEFAULT NULL COMMENT 'Longitude min de la bounding box', `bbox_max_lng` decimal(11,0) DEFAULT NULL COMMENT 'Longitude max de la bounding box', `created_at` timestamp NOT NULL DEFAULT current_timestamp(), `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`), UNIQUE KEY `idx_code_dept` (`code_dept`), SPATIAL KEY `idx_contour` (`contour`), KEY `idx_dept_bbox` (`bbox_min_lat`,`bbox_max_lat`,`bbox_min_lng`,`bbox_max_lng`) ) ENGINE=InnoDB AUTO_INCREMENT=169 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Contours géographiques des départements français' `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `x_devises` -- DROP TABLE IF EXISTS `x_devises`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `x_devises` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `code` varchar(3) DEFAULT NULL, `symbole` varchar(6) DEFAULT NULL, `libelle` varchar(45) DEFAULT NULL, `chk_active` tinyint(1) unsigned DEFAULT 1, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `x_entites_types` -- DROP TABLE IF EXISTS `x_entites_types`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `x_entites_types` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `libelle` varchar(45) DEFAULT NULL, `chk_active` tinyint(1) unsigned DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `x_pays` -- DROP TABLE IF EXISTS `x_pays`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `x_pays` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `code` varchar(3) DEFAULT NULL, `fk_continent` int(10) unsigned DEFAULT NULL, `fk_devise` int(10) unsigned DEFAULT 1, `libelle` varchar(45) DEFAULT NULL, `chk_active` tinyint(1) unsigned DEFAULT 1, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`), KEY `x_pays_ibfk_1` (`fk_devise`), CONSTRAINT `x_pays_ibfk_1` FOREIGN KEY (`fk_devise`) REFERENCES `x_devises` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Table des pays avec leurs codes' `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `x_regions` -- DROP TABLE IF EXISTS `x_regions`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `x_regions` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `fk_pays` int(10) unsigned DEFAULT 1, `libelle` varchar(45) DEFAULT NULL, `libelle_long` varchar(45) DEFAULT NULL, `table_osm` varchar(45) DEFAULT NULL, `departements` varchar(45) DEFAULT NULL, `chk_active` tinyint(1) unsigned DEFAULT 1, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`), KEY `x_regions_ibfk_1` (`fk_pays`), CONSTRAINT `x_regions_ibfk_1` FOREIGN KEY (`fk_pays`) REFERENCES `x_pays` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `x_types_passages` -- DROP TABLE IF EXISTS `x_types_passages`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `x_types_passages` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `libelle` varchar(10) DEFAULT NULL, `color_button` varchar(15) DEFAULT NULL, `color_mark` varchar(15) DEFAULT NULL, `color_table` varchar(15) DEFAULT NULL, `chk_active` tinyint(1) unsigned NOT NULL DEFAULT 1, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `x_types_reglements` -- DROP TABLE IF EXISTS `x_types_reglements`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `x_types_reglements` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `libelle` varchar(45) DEFAULT NULL, `chk_active` tinyint(1) unsigned DEFAULT 1, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `x_users_roles` -- DROP TABLE IF EXISTS `x_users_roles`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `x_users_roles` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `libelle` varchar(45) DEFAULT NULL, `chk_active` tinyint(1) unsigned DEFAULT 1, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Les différents rôles des utilisateurs' `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `x_users_titres` -- DROP TABLE IF EXISTS `x_users_titres`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `x_users_titres` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `libelle` varchar(45) DEFAULT NULL, `chk_active` tinyint(1) unsigned DEFAULT 1, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Les différents titres des utilisateurs' `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `x_villes` -- DROP TABLE IF EXISTS `x_villes`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `x_villes` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `fk_departement` int(10) unsigned DEFAULT 1, `libelle` varchar(65) DEFAULT NULL, `code_postal` varchar(5) DEFAULT NULL, `code_insee` varchar(5) DEFAULT NULL, `chk_active` tinyint(1) unsigned DEFAULT 1, PRIMARY KEY (`id`), UNIQUE KEY `id_UNIQUE` (`id`), KEY `x_villes_ibfk_1` (`fk_departement`), CONSTRAINT `x_villes_ibfk_1` FOREIGN KEY (`fk_departement`) REFERENCES `x_departements` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=38950 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `z_sessions` -- DROP TABLE IF EXISTS `z_sessions`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8mb4 */; CREATE TABLE `z_sessions` ( `sid` text NOT NULL, `fk_user` int(11) NOT NULL, `role` varchar(10) DEFAULT NULL, `date_modified` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `ip` varchar(50) NOT NULL, `browser` varchar(150) NOT NULL, `data` mediumtext DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci `PAGE_COMPRESSED`='ON'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Final view structure for view `chat_rooms_with_last_message` -- /*!50001 DROP VIEW IF EXISTS `chat_rooms_with_last_message`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; /*!50001 SET character_set_client = utf8mb4 */; /*!50001 SET character_set_results = utf8mb4 */; /*!50001 SET collation_connection = utf8mb4_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`admin`@`13.23.33.1` SQL SECURITY DEFINER */ /*!50001 VIEW `chat_rooms_with_last_message` AS select `r`.`id` AS `id`,`r`.`title` AS `title`,`r`.`type` AS `type`,`r`.`created_at` AS `created_at`,`r`.`created_by` AS `created_by`,`r`.`updated_at` AS `updated_at`,`r`.`is_active` AS `is_active`,`m`.`content` AS `last_message_content`,`m`.`sender_id` AS `last_message_sender`,`m`.`sent_at` AS `last_message_at`,`u`.`encrypted_name` AS `last_message_sender_name` from ((`chat_rooms` `r` left join (select `m1`.`id` AS `id`,`m1`.`room_id` AS `room_id`,`m1`.`content` AS `content`,`m1`.`sender_id` AS `sender_id`,`m1`.`sent_at` AS `sent_at`,`m1`.`edited_at` AS `edited_at`,`m1`.`is_deleted` AS `is_deleted` from (`chat_messages` `m1` join (select `chat_messages`.`room_id` AS `room_id`,max(`chat_messages`.`sent_at`) AS `max_sent_at` from `chat_messages` where `chat_messages`.`is_deleted` = 0 group by `chat_messages`.`room_id`) `m2` on(`m1`.`room_id` = `m2`.`room_id` and `m1`.`sent_at` = `m2`.`max_sent_at`))) `m` on(`r`.`id` = `m`.`room_id`)) left join `users` `u` on(`m`.`sender_id` = `u`.`id`)) where `r`.`is_active` = 1 */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -- -- Final view structure for view `v_stripe_entite_stats` -- /*!50001 DROP VIEW IF EXISTS `v_stripe_entite_stats`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; /*!50001 SET character_set_client = utf8mb3 */; /*!50001 SET character_set_results = utf8mb3 */; /*!50001 SET collation_connection = utf8mb3_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ /*!50001 VIEW `v_stripe_entite_stats` AS select `e`.`id` AS `entite_id`,`e`.`encrypted_name` AS `entite_name`,`sa`.`stripe_account_id` AS `stripe_account_id`,`sa`.`charges_enabled` AS `charges_enabled`,`sa`.`payouts_enabled` AS `payouts_enabled`,count(distinct `p`.`id`) AS `total_passages`,count(distinct case when `p`.`stripe_payment_id` is not null then `p`.`id` end) AS `passages_stripe`,sum(case when `p`.`stripe_payment_id` is not null then `p`.`montant` else 0 end) AS `revenue_stripe`,sum(`p`.`montant`) AS `revenue_total` from (((`entites` `e` left join `stripe_accounts` `sa` on(`e`.`id` = `sa`.`fk_entite`)) left join `operations` `o` on(`e`.`id` = `o`.`fk_entite`)) left join `ope_pass` `p` on(`o`.`id` = `p`.`fk_operation`)) group by `e`.`id`,`e`.`encrypted_name`,`sa`.`stripe_account_id` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -- -- Final view structure for view `v_stripe_payment_stats` -- /*!50001 DROP VIEW IF EXISTS `v_stripe_payment_stats`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; /*!50001 SET character_set_client = utf8mb3 */; /*!50001 SET character_set_results = utf8mb3 */; /*!50001 SET collation_connection = utf8mb3_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ /*!50001 VIEW `v_stripe_payment_stats` AS select `o`.`fk_entite` AS `fk_entite`,`e`.`encrypted_name` AS `entite_name`,`p`.`fk_user` AS `fk_user`,concat(`u`.`first_name`,' ',`u`.`sect_name`) AS `user_name`,count(distinct `p`.`id`) AS `total_ventes`,count(distinct case when `p`.`stripe_payment_id` is not null then `p`.`id` end) AS `ventes_stripe`,sum(case when `p`.`stripe_payment_id` is not null then `p`.`montant` else 0 end) AS `montant_stripe`,sum(case when `p`.`stripe_payment_id` is null then `p`.`montant` else 0 end) AS `montant_autres`,cast(`p`.`created_at` as date) AS `date_vente` from (((`ope_pass` `p` left join `operations` `o` on(`p`.`fk_operation` = `o`.`id`)) left join `entites` `e` on(`o`.`fk_entite` = `e`.`id`)) left join `users` `u` on(`p`.`fk_user` = `u`.`id`)) where `p`.`fk_type` = 2 group by `o`.`fk_entite`,`p`.`fk_user`,cast(`p`.`created_at` as date) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!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 */; /*M!100616 SET NOTE_VERBOSITY=@OLD_NOTE_VERBOSITY */; -- Dump completed on 2025-10-06 16:59:27