CREATE TABLE `zone_scope_product` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `zone_scope_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `sort_order` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `presentation_kind` varchar(16) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `zone_scope_product` (`id`, `zone_scope_id`, `product_id`, `sort_order`, `presentation_kind`) VALUES
(131, 88, 4, 2, 'primaire'),
(132, 88, 8, 1, 'primaire'),
(139, 90, 8, 1, 'primaire'),
(140, 90, 4, 2, 'primaire'),
(141, 94, 8, 1, 'primaire'),
(142, 94, 4, 2, 'primaire');

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

--
-- Structure de la table `zone_scope_product_presentation`
--

CREATE TABLE `zone_scope_product_presentation` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `zone_scope_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `product_presentation_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `zone_scope_product_presentation` (`id`, `zone_scope_id`, `product_id`, `product_presentation_id`) VALUES
(161, 88, 4, 9),
(162, 94, 4, 9);

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

--
-- Structure de la table `zone_scope_realisateurs`
--

CREATE TABLE `zone_scope_realisateurs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `zone_scope_id` bigint(20) UNSIGNED NOT NULL,
  `target_key` varchar(32) NOT NULL,
  `zone_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;

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

--
-- Structure de la table `zone_scope_snapshots`
--

CREATE TABLE `zone_scope_snapshots` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `zone_scope_id` bigint(20) UNSIGNED NOT NULL,
  `client_id` bigint(20) UNSIGNED DEFAULT NULL,
  `organisation_id` bigint(20) UNSIGNED DEFAULT NULL,
  `field_interaction_mode` varchar(32) NOT NULL DEFAULT 'visites',
  `setup_step` tinyint(3) UNSIGNED NOT NULL DEFAULT 1,
  `is_prepared` tinyint(1) NOT NULL DEFAULT 0,
  `name` varchar(255) DEFAULT NULL,
  `scope_type_name` varchar(255) DEFAULT NULL,
  `cycle_name` varchar(255) DEFAULT NULL,
  `valid_from` date DEFAULT NULL,
  `valid_until` date DEFAULT NULL,
  `territory_wilaya_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `territory_commune_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `target_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `profession_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `speciality_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `product_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `presentation_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `form_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `active_goal_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `total_goal_count` int(10) UNSIGNED 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 `zone_scope_snapshots`
--

INSERT INTO `zone_scope_snapshots` (`id`, `zone_scope_id`, `client_id`, `organisation_id`, `field_interaction_mode`, `setup_step`, `is_prepared`, `name`, `scope_type_name`, `cycle_name`, `valid_from`, `valid_until`, `territory_wilaya_count`, `territory_commune_count`, `target_count`, `profession_count`, `speciality_count`, `product_count`, `presentation_count`, `form_count`, `active_goal_count`, `total_goal_count`, `created_at`, `updated_at`) VALUES
(1, 88, 4, 6, 'appels', 7, 1, 'test scope org 1', 'test type scope org 01', '2026', '2026-01-01', '2026-12-31', 32, 1158, 4, 4, 4, 2, 1, 4, 1, 1, '2026-03-28 12:45:55', '2026-04-01 00:32:06'),
(3, 90, 4, 6, 'appels', 5, 1, 'KOL', 'Par défaut', 'scope 2027', '2026-12-31', NULL, 32, 1158, 4, 4, 4, 2, 0, 9, 0, 0, '2026-04-05 19:32:08', '2026-04-08 10:16:32'),
(6, 93, 4, 17, 'visites', 5, 1, 'ramdane avril', 'Par défaut', '2026', '2026-01-01', '2026-12-31', 0, 0, 4, 0, 0, 0, 0, 2, 0, 0, '2026-04-08 09:25:41', '2026-04-13 01:16:11'),
(7, 94, 4, 6, 'visites', 5, 1, 'ramdane avril', 'Par défaut', '2026', '2026-01-01', '2026-12-31', 32, 1158, 4, 5, 6, 2, 1, 15, 49, 49, '2026-04-08 10:19:06', '2026-04-18 12:00:27');

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

--
-- Structure de la table `zone_scope_snapshot_forms`
--

CREATE TABLE `zone_scope_snapshot_forms` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `zone_scope_snapshot_id` bigint(20) UNSIGNED NOT NULL,
  `target_key` varchar(255) NOT NULL,
  `target_label` varchar(255) DEFAULT NULL,
  `form_kind` varchar(32) NOT NULL DEFAULT 'terrain_report',
  `organisation_node_id` bigint(20) UNSIGNED DEFAULT NULL,
  `organisation_node_label` varchar(255) DEFAULT NULL,
  `organisation_node_unit_id` bigint(20) UNSIGNED DEFAULT NULL,
  `organisation_node_unit_label` varchar(255) DEFAULT NULL,
  `client_form_id` bigint(20) UNSIGNED NOT NULL,
  `client_form_snapshot_id` bigint(20) UNSIGNED DEFAULT NULL,
  `form_name` varchar(255) NOT NULL,
  `form_type` varchar(255) DEFAULT NULL,
  `snapshot_payload` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`snapshot_payload`)),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `form_version` smallint(5) UNSIGNED NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `zone_scope_snapshot_forms` (`id`, `zone_scope_snapshot_id`, `target_key`, `target_label`, `form_kind`, `organisation_node_id`, `organisation_node_label`, `organisation_node_unit_id`, `organisation_node_unit_label`, `client_form_id`, `client_form_snapshot_id`, `form_name`, `form_type`, `snapshot_payload`, `created_at`, `updated_at`, `form_version`) VALUES
(329, 1, 'prescripteurs', 'Prescripteurs', 'terrain_report', NULL, NULL, NULL, NULL, 3, NULL, 'Paracétamol 2 questions', 'prescripteurs', NULL, '2026-04-01 00:32:06', '2026-04-01 00:32:06', 1),
(330, 1, 'dispensateurs', 'Dispensateurs', 'terrain_report', NULL, NULL, NULL, NULL, 4, NULL, 'pharmacie questionaire paracetamol', 'dispensateurs', NULL, '2026-04-01 00:32:06', '2026-04-01 00:32:06', 1),
(331, 1, 'distributeurs', 'Distributeurs', 'terrain_report', NULL, NULL, NULL, NULL, 5, NULL, 'grossiste formulaire paracetamol', 'distributeurs', NULL, '2026-04-01 00:32:06', '2026-04-01 00:32:06', 1),
(332, 1, 'centrales_achat', 'Centrales d\'achat', 'terrain_report', NULL, NULL, NULL, NULL, 6, NULL, 'super grop paracetamol', 'centrales_achat', NULL, '2026-04-01 00:32:06', '2026-04-01 00:32:06', 1),
(526, 3, '*', '*', 'coaching', 57, 'DC', NULL, NULL, 0, 5, 'Coaching DVM pour les DR', '', '{\"kind\":\"coaching\",\"type\":null,\"name\":\"Coaching DVM pour les DR\",\"description\":null,\"questions\":[{\"position\":1,\"question\":\"oui ou non\",\"question_template\":\"oui ou non\",\"question_placeholders\":[],\"question_preview\":\"oui ou non\",\"response_type\":\"boolean\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[],\"product_names\":[]}]}', '2026-04-08 10:16:32', '2026-04-08 10:16:32', 1),
(527, 3, 'centrales_achat', 'Centrales d\'achat', 'terrain_report', NULL, NULL, NULL, NULL, 0, 17, 'rapport centrale', '', '{\"kind\":\"formulaire\",\"type\":\"centrales_achat\",\"name\":\"rapport centrale\",\"description\":null,\"questions\":[{\"position\":1,\"question\":\"{{product}} oui ou non\",\"question_template\":\"{{product}} oui ou non\",\"question_placeholders\":[\"product\"],\"question_preview\":\"augmentin, paracetamol oui ou non\",\"response_type\":\"boolean\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[8,4],\"product_names\":[\"augmentin\",\"paracetamol\"]}]}', '2026-04-08 10:16:32', '2026-04-08 10:16:32', 1),
(528, 3, 'centrales_achat', 'Centrales d\'achat', 'kol', NULL, NULL, NULL, NULL, 0, 10, 'KOL centrale', '', '{\"kind\":\"kol\",\"type\":\"centrales_achat\",\"name\":\"KOL centrale\",\"description\":null,\"questions\":[{\"position\":1,\"question\":\"oui ou non\",\"question_template\":\"oui ou non\",\"question_placeholders\":[],\"question_preview\":\"oui ou non\",\"response_type\":\"boolean\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[],\"product_names\":[]}]}', '2026-04-08 10:16:32', '2026-04-08 10:16:32', 1),
(529, 3, 'dispensateurs', 'Dispensateurs', 'terrain_report', NULL, NULL, NULL, NULL, 0, 14, 'augmentin dispensateur', '', '{\"kind\":\"formulaire\",\"type\":\"dispensateurs\",\"name\":\"augmentin dispensateur\",\"description\":null,\"questions\":[{\"position\":1,\"question\":\"{{product}} text libre\",\"question_template\":\"{{product}} text libre\",\"question_placeholders\":[\"product\"],\"question_preview\":\"augmentin, paracetamol text libre\",\"response_type\":\"text\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[8,4],\"product_names\":[\"augmentin\",\"paracetamol\"]}]}', '2026-04-08 10:16:32', '2026-04-08 10:16:32', 1),
(530, 3, 'dispensateurs', 'Dispensateurs', 'kol', NULL, NULL, NULL, NULL, 0, 8, 'KOL dispensateur', '', '{\"kind\":\"kol\",\"type\":\"dispensateurs\",\"name\":\"KOL dispensateur\",\"description\":null,\"questions\":[{\"position\":1,\"question\":\"oui ou non\",\"question_template\":\"oui ou non\",\"question_placeholders\":[],\"question_preview\":\"oui ou non\",\"response_type\":\"boolean\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[],\"product_names\":[]}]}', '2026-04-08 10:16:32', '2026-04-08 10:16:32', 1),
(531, 3, 'distributeurs', 'Distributeurs', 'terrain_report', NULL, NULL, NULL, NULL, 0, 16, 'augmentin distributeur', '', '{\"kind\":\"formulaire\",\"type\":\"distributeurs\",\"name\":\"augmentin distributeur\",\"description\":null,\"questions\":[{\"position\":1,\"question\":\"{{product}} oui ou non\",\"question_template\":\"{{product}} oui ou non\",\"question_placeholders\":[\"product\"],\"question_preview\":\"augmentin, paracetamol oui ou non\",\"response_type\":\"boolean\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[8,4],\"product_names\":[\"augmentin\",\"paracetamol\"]}]}', '2026-04-08 10:16:32', '2026-04-08 10:16:32', 1),
(532, 3, 'distributeurs', 'Distributeurs', 'kol', NULL, NULL, NULL, NULL, 0, 9, 'KOL distributeurs', '', '{\"kind\":\"kol\",\"type\":\"distributeurs\",\"name\":\"KOL distributeurs\",\"description\":null,\"questions\":[{\"position\":1,\"question\":\"oui ou non\",\"question_template\":\"oui ou non\",\"question_placeholders\":[],\"question_preview\":\"oui ou non\",\"response_type\":\"boolean\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[],\"product_names\":[]}]}', '2026-04-08 10:16:32', '2026-04-08 10:16:32', 1),
(533, 3, 'prescripteurs', 'Prescripteurs', 'terrain_report', NULL, NULL, NULL, NULL, 0, 12, 'augentin prescripteur', '', '{\"kind\":\"formulaire\",\"type\":\"prescripteurs\",\"name\":\"augentin prescripteur\",\"description\":\"sqxqsx\",\"questions\":[{\"position\":1,\"question\":\"{{product}} rak mli7\",\"question_template\":\"{{product}} rak mli7\",\"question_placeholders\":[\"product\"],\"question_preview\":\"augmentin, paracetamol rak mli7\",\"response_type\":\"boolean\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[8,4],\"product_names\":[\"augmentin\",\"paracetamol\"]}]}', '2026-04-08 10:16:32', '2026-04-08 10:16:32', 1),
(534, 3, 'prescripteurs', 'Prescripteurs', 'kol', NULL, NULL, NULL, NULL, 0, 7, 'KOL prescripteur', '', '{\"kind\":\"kol\",\"type\":\"prescripteurs\",\"name\":\"KOL prescripteur\",\"description\":null,\"questions\":[{\"position\":1,\"question\":\"oui ou non\",\"question_template\":\"oui ou non\",\"question_placeholders\":[],\"question_preview\":\"oui ou non\",\"response_type\":\"boolean\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[],\"product_names\":[]}]}', '2026-04-08 10:16:32', '2026-04-08 10:16:32', 1),
(1506, 6, '*', '*', 'coaching', 141, 'DVM', NULL, NULL, 0, 5, 'Coaching DVM pour les DR', '', '{\"kind\":\"coaching\",\"type\":null,\"name\":\"Coaching DVM pour les DR\",\"description\":null,\"questions\":[{\"position\":1,\"question\":\"oui ou non\",\"question_template\":\"oui ou non\",\"question_placeholders\":[],\"question_preview\":\"oui ou non\",\"response_type\":\"boolean\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[],\"product_names\":[]}]}', '2026-04-13 01:16:11', '2026-04-13 01:16:11', 1),
(1507, 6, '*', '*', 'simple_report', 142, 'PM', NULL, NULL, 0, 6, 'Rapport simple', '', '{\"kind\":\"rapport_simple\",\"type\":null,\"name\":\"Rapport simple\",\"description\":null,\"questions\":[{\"position\":1,\"question\":\"oui ou non\",\"question_template\":\"oui ou non\",\"question_placeholders\":[],\"question_preview\":\"oui ou non\",\"response_type\":\"boolean\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[],\"product_names\":[]}]}', '2026-04-13 01:16:11', '2026-04-13 01:16:11', 1),
(1585, 7, '*', '*', 'coaching', 57, 'DC', NULL, NULL, 0, 5, 'Coaching DVM pour les DR', '', '{\"kind\":\"coaching\",\"type\":null,\"name\":\"Coaching DVM pour les DR\",\"description\":null,\"questions\":[{\"position\":1,\"question\":\"oui ou non\",\"question_template\":\"oui ou non\",\"question_placeholders\":[],\"question_preview\":\"oui ou non\",\"response_type\":\"boolean\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[],\"product_names\":[]}]}', '2026-04-18 12:00:27', '2026-04-18 12:00:27', 1),
(1586, 7, '*', '*', 'coaching', 58, 'DR Medicale', NULL, NULL, 0, 5, 'Coaching DVM pour les DR', '', '{\"kind\":\"coaching\",\"type\":null,\"name\":\"Coaching DVM pour les DR\",\"description\":null,\"questions\":[{\"position\":1,\"question\":\"oui ou non\",\"question_template\":\"oui ou non\",\"question_placeholders\":[],\"question_preview\":\"oui ou non\",\"response_type\":\"boolean\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[],\"product_names\":[]}]}', '2026-04-18 12:00:27', '2026-04-18 12:00:27', 1),
(1587, 7, '*', '*', 'simple_report', 59, 'VP', NULL, NULL, 0, 6, 'Rapport simple', '', '{\"kind\":\"rapport_simple\",\"type\":null,\"name\":\"Rapport simple\",\"description\":null,\"questions\":[{\"position\":1,\"question\":\"oui ou non\",\"question_template\":\"oui ou non\",\"question_placeholders\":[],\"question_preview\":\"oui ou non\",\"response_type\":\"boolean\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[],\"product_names\":[]}]}', '2026-04-18 12:00:27', '2026-04-18 12:00:27', 1),
(1588, 7, '*', '*', 'simple_report', 60, 'VMC', NULL, NULL, 0, 6, 'Rapport simple', '', '{\"kind\":\"rapport_simple\",\"type\":null,\"name\":\"Rapport simple\",\"description\":null,\"questions\":[{\"position\":1,\"question\":\"oui ou non\",\"question_template\":\"oui ou non\",\"question_placeholders\":[],\"question_preview\":\"oui ou non\",\"response_type\":\"boolean\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[],\"product_names\":[]}]}', '2026-04-18 12:00:27', '2026-04-18 12:00:27', 1),
(1589, 7, '*', '*', 'simple_report', 61, 'VM', NULL, NULL, 0, 6, 'Rapport simple', '', '{\"kind\":\"rapport_simple\",\"type\":null,\"name\":\"Rapport simple\",\"description\":null,\"questions\":[{\"position\":1,\"question\":\"oui ou non\",\"question_template\":\"oui ou non\",\"question_placeholders\":[],\"question_preview\":\"oui ou non\",\"response_type\":\"boolean\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[],\"product_names\":[]}]}', '2026-04-18 12:00:27', '2026-04-18 12:00:27', 1),
(1590, 7, '*', '*', 'simple_report', 56, 'DVM', NULL, NULL, 0, 6, 'Rapport simple', '', '{\"kind\":\"rapport_simple\",\"type\":null,\"name\":\"Rapport simple\",\"description\":null,\"questions\":[{\"position\":1,\"question\":\"oui ou non\",\"question_template\":\"oui ou non\",\"question_placeholders\":[],\"question_preview\":\"oui ou non\",\"response_type\":\"boolean\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[],\"product_names\":[]}]}', '2026-04-18 12:00:27', '2026-04-18 12:00:27', 1),
(1591, 7, '*', '*', 'simple_report', 57, 'DC', NULL, NULL, 0, 6, 'Rapport simple', '', '{\"kind\":\"rapport_simple\",\"type\":null,\"name\":\"Rapport simple\",\"description\":null,\"questions\":[{\"position\":1,\"question\":\"oui ou non\",\"question_template\":\"oui ou non\",\"question_placeholders\":[],\"question_preview\":\"oui ou non\",\"response_type\":\"boolean\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[],\"product_names\":[]}]}', '2026-04-18 12:00:27', '2026-04-18 12:00:27', 1),
(1592, 7, 'centrales_achat', 'Centrales d\'achat', 'terrain_report', NULL, NULL, NULL, NULL, 0, 17, 'rapport centrale', '', '{\"kind\":\"formulaire\",\"type\":\"centrales_achat\",\"name\":\"rapport centrale\",\"description\":null,\"questions\":[{\"position\":1,\"question\":\"{{product}} oui ou non\",\"question_template\":\"{{product}} oui ou non\",\"question_placeholders\":[\"product\"],\"question_preview\":\"augmentin, paracetamol oui ou non\",\"response_type\":\"boolean\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[8,4],\"product_names\":[\"augmentin\",\"paracetamol\"]}]}', '2026-04-18 12:00:27', '2026-04-18 12:00:27', 1),
(1593, 7, 'centrales_achat', 'Centrales d\'achat', 'kol', NULL, NULL, NULL, NULL, 0, 10, 'KOL centrale', '', '{\"kind\":\"kol\",\"type\":\"centrales_achat\",\"name\":\"KOL centrale\",\"description\":null,\"questions\":[{\"position\":1,\"question\":\"oui ou non\",\"question_template\":\"oui ou non\",\"question_placeholders\":[],\"question_preview\":\"oui ou non\",\"response_type\":\"boolean\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[],\"product_names\":[]}]}', '2026-04-18 12:00:27', '2026-04-18 12:00:27', 1),
(1594, 7, 'dispensateurs', 'Dispensateurs', 'terrain_report', NULL, NULL, NULL, NULL, 0, 13, 'paracetamol dispensateur', '', '{\"kind\":\"formulaire\",\"type\":\"dispensateurs\",\"name\":\"paracetamol dispensateur\",\"description\":null,\"questions\":[{\"position\":1,\"question\":\"{{product}} text libre\",\"question_template\":\"{{product}} text libre\",\"question_placeholders\":[\"product\"],\"question_preview\":\"augmentin, paracetamol text libre\",\"response_type\":\"text\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[8,4],\"product_names\":[\"augmentin\",\"paracetamol\"]}]}', '2026-04-18 12:00:27', '2026-04-18 12:00:27', 2),
(1595, 7, 'dispensateurs', 'Dispensateurs', 'kol', NULL, NULL, NULL, NULL, 0, 8, 'KOL dispensateur', '', '{\"kind\":\"kol\",\"type\":\"dispensateurs\",\"name\":\"KOL dispensateur\",\"description\":null,\"questions\":[{\"position\":1,\"question\":\"oui ou non\",\"question_template\":\"oui ou non\",\"question_placeholders\":[],\"question_preview\":\"oui ou non\",\"response_type\":\"boolean\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[],\"product_names\":[]}]}', '2026-04-18 12:00:27', '2026-04-18 12:00:27', 1),
(1596, 7, 'distributeurs', 'Distributeurs', 'terrain_report', NULL, NULL, NULL, NULL, 0, 15, 'paracetamol distributeur', '', '{\"kind\":\"formulaire\",\"type\":\"distributeurs\",\"name\":\"paracetamol distributeur\",\"description\":null,\"questions\":[{\"position\":1,\"question\":\"{{product}} oui ou non\",\"question_template\":\"{{product}} oui ou non\",\"question_placeholders\":[\"product\"],\"question_preview\":\"augmentin, paracetamol oui ou non\",\"response_type\":\"boolean\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[8,4],\"product_names\":[\"augmentin\",\"paracetamol\"]}]}', '2026-04-18 12:00:27', '2026-04-18 12:00:27', 2),
(1597, 7, 'distributeurs', 'Distributeurs', 'kol', NULL, NULL, NULL, NULL, 0, 9, 'KOL distributeurs', '', '{\"kind\":\"kol\",\"type\":\"distributeurs\",\"name\":\"KOL distributeurs\",\"description\":null,\"questions\":[{\"position\":1,\"question\":\"oui ou non\",\"question_template\":\"oui ou non\",\"question_placeholders\":[],\"question_preview\":\"oui ou non\",\"response_type\":\"boolean\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[],\"product_names\":[]}]}', '2026-04-18 12:00:27', '2026-04-18 12:00:27', 1),
(1598, 7, 'prescripteurs', 'Prescripteurs', 'terrain_report', NULL, NULL, NULL, NULL, 0, 11, 'Paracétamol Prescripteur', '', '{\"kind\":\"formulaire\",\"type\":\"prescripteurs\",\"name\":\"Paracétamol Prescripteur\",\"description\":null,\"questions\":[{\"position\":1,\"question\":\"{{product}} oui ou non\",\"question_template\":\"{{product}} oui ou non\",\"question_placeholders\":[\"product\"],\"question_preview\":\"augmentin, paracetamol oui ou non\",\"response_type\":\"boolean\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[8,4],\"product_names\":[\"augmentin\",\"paracetamol\"]},{\"position\":2,\"question\":\"text libre\",\"question_template\":\"text libre\",\"question_placeholders\":[],\"question_preview\":\"text libre\",\"response_type\":\"text\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[8,4],\"product_names\":[\"augmentin\",\"paracetamol\"]}]}', '2026-04-18 12:00:27', '2026-04-18 12:00:27', 2),
(1599, 7, 'prescripteurs', 'Prescripteurs', 'kol', NULL, NULL, NULL, NULL, 0, 7, 'KOL prescripteur', '', '{\"kind\":\"kol\",\"type\":\"prescripteurs\",\"name\":\"KOL prescripteur\",\"description\":null,\"questions\":[{\"position\":1,\"question\":\"oui ou non\",\"question_template\":\"oui ou non\",\"question_placeholders\":[],\"question_preview\":\"oui ou non\",\"response_type\":\"boolean\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[],\"product_names\":[]}]}', '2026-04-18 12:00:27', '2026-04-18 12:00:27', 1);

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

--
-- Structure de la table `zone_scope_snapshot_goals`
--

CREATE TABLE `zone_scope_snapshot_goals` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `zone_scope_snapshot_id` bigint(20) UNSIGNED NOT NULL,
  `zone_scope_goal_id` bigint(20) UNSIGNED DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `objective_code` varchar(80) DEFAULT NULL,
  `organisation_node_id` bigint(20) UNSIGNED DEFAULT NULL,
  `target_key` varchar(64) DEFAULT NULL,
  `dimension_payload` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`dimension_payload`)),
  `config_signature` varchar(80) DEFAULT NULL,
  `goal_type` varchar(255) DEFAULT NULL,
  `goal_unit` varchar(255) DEFAULT NULL,
  `goal_value` decimal(12,3) DEFAULT NULL,
  `period_type` varchar(255) DEFAULT NULL,
  `priority` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `is_required` tinyint(1) NOT NULL DEFAULT 0,
  `is_system_template` tinyint(1) NOT NULL DEFAULT 0,
  `is_active` 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 `zone_scope_snapshot_goals`
--

INSERT INTO `zone_scope_snapshot_goals` (`id`, `zone_scope_snapshot_id`, `zone_scope_goal_id`, `name`, `objective_code`, `organisation_node_id`, `target_key`, `dimension_payload`, `config_signature`, `goal_type`, `goal_unit`, `goal_value`, `period_type`, `priority`, `is_required`, `is_system_template`, `is_active`, `created_at`, `updated_at`) VALUES
(170, 1, 34, 'Ventes — canaux', NULL, NULL, NULL, NULL, NULL, 'sales', 'units', 100.000, 'scope_duration', 0, 0, 0, 1, '2026-04-01 00:32:06', '2026-04-01 00:32:06'),
(1720, 7, 35, 'Visites - VMC - Prescripteurs', 'field_interaction_count', 60, 'prescripteurs', '{\"dimension\":\"poste_target\",\"organisation_node_id\":60,\"organisation_node_label\":\"VMC\",\"target_key\":\"prescripteurs\",\"target_label\":\"Prescripteurs\",\"objective_code\":\"field_interaction_count\"}', '9191b0690807d60467d93eb4bce64fc880b493ff', 'activity', 'visits', 2.000, 'daily', 0, 1, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1721, 7, 36, 'Couverture - VMC - Prescripteurs', 'coverage_rate', 60, 'prescripteurs', '{\"dimension\":\"poste_target\",\"organisation_node_id\":60,\"organisation_node_label\":\"VMC\",\"target_key\":\"prescripteurs\",\"target_label\":\"Prescripteurs\",\"objective_code\":\"coverage_rate\"}', 'fdf15ae30c5216378592543ab9ffd5b17515e4fc', 'coverage', 'percentage', 80.000, 'monthly', 0, 1, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1722, 7, 37, 'Visites - VM - Prescripteurs', 'field_interaction_count', 61, 'prescripteurs', '{\"dimension\":\"poste_target\",\"organisation_node_id\":61,\"organisation_node_label\":\"VM\",\"target_key\":\"prescripteurs\",\"target_label\":\"Prescripteurs\",\"objective_code\":\"field_interaction_count\"}', '84be20f652be6220ee22fe7c11ca8723ab3e5b4e', 'activity', 'visits', 8.000, 'daily', 0, 1, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1723, 7, 38, 'Couverture - VM - Prescripteurs', 'coverage_rate', 61, 'prescripteurs', '{\"dimension\":\"poste_target\",\"organisation_node_id\":61,\"organisation_node_label\":\"VM\",\"target_key\":\"prescripteurs\",\"target_label\":\"Prescripteurs\",\"objective_code\":\"coverage_rate\"}', 'bd6fe60cf36d2a53b31bfc4219924d962206c611', 'coverage', 'percentage', 80.000, 'monthly', 0, 1, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1724, 7, 39, 'Visites - VP - Dispensateurs', 'field_interaction_count', 59, 'dispensateurs', '{\"dimension\":\"poste_target\",\"organisation_node_id\":59,\"organisation_node_label\":\"VP\",\"target_key\":\"dispensateurs\",\"target_label\":\"Dispensateurs\",\"objective_code\":\"field_interaction_count\"}', 'e8e127827b26451d6a9209e8ae51796f3c0da606', 'activity', 'visits', 7.000, 'daily', 0, 1, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1725, 7, 40, 'Couverture - VP - Dispensateurs', 'coverage_rate', 59, 'dispensateurs', '{\"dimension\":\"poste_target\",\"organisation_node_id\":59,\"organisation_node_label\":\"VP\",\"target_key\":\"dispensateurs\",\"target_label\":\"Dispensateurs\",\"objective_code\":\"coverage_rate\"}', 'c3da0e4316793f27ebac6e9d8aeb85743daf8c9c', 'coverage', 'percentage', 80.000, 'monthly', 0, 1, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1726, 7, 41, 'Visites - VMC - Dispensateurs', 'field_interaction_count', 60, 'dispensateurs', '{\"dimension\":\"poste_target\",\"organisation_node_id\":60,\"organisation_node_label\":\"VMC\",\"target_key\":\"dispensateurs\",\"target_label\":\"Dispensateurs\",\"objective_code\":\"field_interaction_count\"}', 'f684fb189d420cce5387f11a567cc56fea6967cb', 'activity', 'visits', 7.000, 'daily', 0, 1, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1727, 7, 42, 'Couverture - VMC - Dispensateurs', 'coverage_rate', 60, 'dispensateurs', '{\"dimension\":\"poste_target\",\"organisation_node_id\":60,\"organisation_node_label\":\"VMC\",\"target_key\":\"dispensateurs\",\"target_label\":\"Dispensateurs\",\"objective_code\":\"coverage_rate\"}', '7865d6e3159f2b1c7c5bf11e51c6613e5349350f', 'coverage', 'percentage', 80.000, 'monthly', 0, 1, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1728, 7, 43, 'Visites - VP - Distributeurs', 'field_interaction_count', 59, 'distributeurs', '{\"dimension\":\"poste_target\",\"organisation_node_id\":59,\"organisation_node_label\":\"VP\",\"target_key\":\"distributeurs\",\"target_label\":\"Distributeurs\",\"objective_code\":\"field_interaction_count\"}', '6e7675333d09711efc4514ffaaaaf9f89958f8ed', 'activity', 'visits', 1.000, 'daily', 0, 1, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1729, 7, 44, 'Couverture - VP - Distributeurs', 'coverage_rate', 59, 'distributeurs', '{\"dimension\":\"poste_target\",\"organisation_node_id\":59,\"organisation_node_label\":\"VP\",\"target_key\":\"distributeurs\",\"target_label\":\"Distributeurs\",\"objective_code\":\"coverage_rate\"}', '69d4fc67c1d7be921d86b4889b1cfeeb0e61c1ad', 'coverage', 'percentage', 80.000, 'monthly', 0, 1, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1730, 7, 45, 'Visites - VMC - Distributeurs', 'field_interaction_count', 60, 'distributeurs', '{\"dimension\":\"poste_target\",\"organisation_node_id\":60,\"organisation_node_label\":\"VMC\",\"target_key\":\"distributeurs\",\"target_label\":\"Distributeurs\",\"objective_code\":\"field_interaction_count\"}', '14144cf95c577c126845007bf2f219fe36ac9f0a', 'activity', 'visits', 2.000, 'daily', 0, 1, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1731, 7, 46, 'Couverture - VMC - Distributeurs', 'coverage_rate', 60, 'distributeurs', '{\"dimension\":\"poste_target\",\"organisation_node_id\":60,\"organisation_node_label\":\"VMC\",\"target_key\":\"distributeurs\",\"target_label\":\"Distributeurs\",\"objective_code\":\"coverage_rate\"}', '2bd847a05cbda4bf659044e09f3af41213c192cc', 'coverage', 'percentage', 80.000, 'monthly', 0, 1, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1732, 7, 48, 'Couverture - DC - Centrales d\'achat', 'coverage_rate', 57, 'centrales_achat', '{\"dimension\":\"poste_target\",\"organisation_node_id\":57,\"organisation_node_label\":\"DC\",\"target_key\":\"centrales_achat\",\"target_label\":\"Centrales d\'achat\",\"objective_code\":\"coverage_rate\"}', '18b745d69f5d7b21d41345c70a0908914966902a', 'coverage', 'percentage', 80.000, 'monthly', 0, 1, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1733, 7, 49, 'Commerce - VMC', 'sales_target', 60, NULL, '{\"dimension\":\"poste\",\"organisation_node_id\":60,\"organisation_node_label\":\"VMC\",\"objective_code\":\"sales_target\",\"target_key\":null,\"target_label\":null}', '1eaeaa3d4ae56512acc232396e8eff554bb520bf', 'sales', 'units', 50.000, 'monthly', 0, 1, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1734, 7, 50, 'Commerce - VM', 'sales_target', 61, NULL, '{\"dimension\":\"poste\",\"organisation_node_id\":61,\"organisation_node_label\":\"VM\",\"objective_code\":\"sales_target\",\"target_key\":null,\"target_label\":null}', 'e4f446b0fe480fefb8d4c049bcadc2d0f6f0bc80', 'sales', 'units', 50.000, 'monthly', 0, 1, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1735, 7, 51, 'Commerce - VP', 'sales_target', 59, NULL, '{\"dimension\":\"poste\",\"organisation_node_id\":59,\"organisation_node_label\":\"VP\",\"objective_code\":\"sales_target\",\"target_key\":null,\"target_label\":null}', 'b91cb3857bed01955fa3d5dc75d470c721d0e55a', 'sales', 'units', 50.000, 'monthly', 0, 1, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1736, 7, 52, 'Commerce - DC', 'sales_target', 57, NULL, '{\"dimension\":\"poste\",\"organisation_node_id\":57,\"organisation_node_label\":\"DC\",\"objective_code\":\"sales_target\",\"target_key\":null,\"target_label\":null}', '5169cbee83acb2bb860f24e1993f578bd46a64e2', 'sales', 'units', 50.000, 'monthly', 0, 1, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1737, 7, 53, 'Durée minimale de présentation', 'presentation_min_duration', NULL, NULL, '{\"dimension\":\"scope\",\"objective_code\":\"presentation_min_duration\",\"organisation_node_id\":null,\"organisation_node_label\":null,\"target_key\":null,\"target_label\":null}', '14400db185d9ab342f890907fc2ec2914461a94f', 'execution_quality', 'minutes', 3.000, 'scope_duration', 0, 1, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1738, 7, 54, 'KOL - VMC', 'kol_report_count', 60, NULL, '{\"dimension\":\"poste\",\"organisation_node_id\":60,\"organisation_node_label\":\"VMC\",\"objective_code\":\"kol_report_count\",\"target_key\":null,\"target_label\":null}', '14af02145b2c2916f08955ceaaa9d412c308c492', 'activity', 'reports', 1.000, 'weekly', 0, 1, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1739, 7, 55, 'KOL - VM', 'kol_report_count', 61, NULL, '{\"dimension\":\"poste\",\"organisation_node_id\":61,\"organisation_node_label\":\"VM\",\"objective_code\":\"kol_report_count\",\"target_key\":null,\"target_label\":null}', 'faba1d060d8b55a5bd69e653fff7402fab6fa3d3', 'activity', 'reports', 1.000, 'weekly', 0, 1, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1740, 7, 56, 'KOL - VP', 'kol_report_count', 59, NULL, '{\"dimension\":\"poste\",\"organisation_node_id\":59,\"organisation_node_label\":\"VP\",\"objective_code\":\"kol_report_count\",\"target_key\":null,\"target_label\":null}', 'df992bd4662ce0e8b0fcf4c8f1dd13defcaaf1a4', 'activity', 'reports', 1.000, 'weekly', 0, 1, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1741, 7, 57, 'KOL - DC', 'kol_report_count', 57, NULL, '{\"dimension\":\"poste\",\"organisation_node_id\":57,\"organisation_node_label\":\"DC\",\"objective_code\":\"kol_report_count\",\"target_key\":null,\"target_label\":null}', 'e5d3d2110844e71d8735c6be361fcd7c85bd54be', 'activity', 'reports', 1.000, 'weekly', 0, 1, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1742, 7, 59, 'Coaching par enfant - DC', 'coaching_per_child_count', 57, NULL, '{\"dimension\":\"poste\",\"organisation_node_id\":57,\"organisation_node_label\":\"DC\",\"per_child\":true,\"objective_code\":\"coaching_per_child_count\",\"target_key\":null,\"target_label\":null}', 'e54f4895e746a10a01149c88cf3b5c3a053016eb', 'activity', 'coachings', 1.000, 'weekly', 0, 1, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1743, 7, 60, 'Coaching par enfant - DR Medicale', 'coaching_per_child_count', 58, NULL, '{\"dimension\":\"poste\",\"organisation_node_id\":58,\"organisation_node_label\":\"DR Medicale\",\"per_child\":true,\"objective_code\":\"coaching_per_child_count\",\"target_key\":null,\"target_label\":null}', 'cca2fdfd1684d1bb2b8dcb8222c1014d8c82053f', 'activity', 'coachings', 1.000, 'weekly', 0, 1, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1744, 7, 61, 'Rapport simple - DVM', 'simple_report_count', 56, NULL, '{\"dimension\":\"poste\",\"organisation_node_id\":56,\"organisation_node_label\":\"DVM\",\"objective_code\":\"simple_report_count\",\"target_key\":null,\"target_label\":null}', '5e43f89411fed72339b7eac8d1d0100b6b8e25c6', 'activity', 'reports', 1.000, 'weekly', 0, 1, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1745, 7, 62, 'Rapport simple - DC', 'simple_report_count', 57, NULL, '{\"dimension\":\"poste\",\"organisation_node_id\":57,\"organisation_node_label\":\"DC\",\"objective_code\":\"simple_report_count\",\"target_key\":null,\"target_label\":null}', 'b20f525cafd3f44bd5732d394fc6e8be5a478a87', 'activity', 'reports', 1.000, 'weekly', 0, 1, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1746, 7, 63, 'Rapport simple - VP', 'simple_report_count', 59, NULL, '{\"dimension\":\"poste\",\"organisation_node_id\":59,\"organisation_node_label\":\"VP\",\"objective_code\":\"simple_report_count\",\"target_key\":null,\"target_label\":null}', '3eb150c75176aeacea4f219e718ea49bbf8cba5f', 'activity', 'reports', 1.000, 'weekly', 0, 1, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1747, 7, 64, 'Rapport simple - VMC', 'simple_report_count', 60, NULL, '{\"dimension\":\"poste\",\"organisation_node_id\":60,\"organisation_node_label\":\"VMC\",\"objective_code\":\"simple_report_count\",\"target_key\":null,\"target_label\":null}', '9f168d86e3d9a6f045354072b2beeb99178d87c8', 'activity', 'reports', 1.000, 'weekly', 0, 1, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1748, 7, 65, 'Rapport simple - VM', 'simple_report_count', 61, NULL, '{\"dimension\":\"poste\",\"organisation_node_id\":61,\"organisation_node_label\":\"VM\",\"objective_code\":\"simple_report_count\",\"target_key\":null,\"target_label\":null}', '8e3bdd6c1a25de6434b244b9911c83cb92a23eee', 'activity', 'reports', 1.000, 'weekly', 0, 1, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1749, 7, 66, 'Part minimale de visites avec présentation', 'presentation_share', NULL, NULL, '{\"dimension\":\"scope\",\"objective_code\":\"presentation_share\",\"organisation_node_id\":null,\"organisation_node_label\":null,\"target_key\":null,\"target_label\":null}', '10ef56296488a9fa0707e8f352e338bb61a34d33', 'product', 'percentage', 60.000, 'monthly', 0, 0, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1750, 7, 67, 'Part minimale de visites avec commande', 'commande_share', NULL, NULL, '{\"dimension\":\"scope\",\"objective_code\":\"commande_share\",\"organisation_node_id\":null,\"organisation_node_label\":null,\"target_key\":null,\"target_label\":null}', 'ad4cbedd438c83ab9a0f7fcc85bff6f551e169f0', 'sales', 'percentage', 30.000, 'monthly', 0, 0, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1751, 7, 68, 'Conversion KOL vers interaction liée', 'kol_conversion_rate', NULL, NULL, '{\"dimension\":\"scope\",\"objective_code\":\"kol_conversion_rate\",\"organisation_node_id\":null,\"organisation_node_label\":null,\"target_key\":null,\"target_label\":null}', '7bd0f02562d69ca5ac7ac95b637b9fb474f3a259', 'execution_quality', 'percentage', 50.000, 'monthly', 0, 0, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1752, 7, 71, 'Visites - DC - Centrales d\'achat', 'field_interaction_count', 57, 'centrales_achat', '{\"dimension\":\"poste_target\",\"organisation_node_id\":57,\"organisation_node_label\":\"DC\",\"target_key\":\"centrales_achat\",\"target_label\":\"Centrales d\'achat\",\"objective_code\":\"field_interaction_count\"}', '01d2d387f806d829d84fdec0067630b90d01ef58', 'activity', 'visits', 19.000, 'monthly', 0, 1, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1753, 7, 72, 'Visites - DC - Centrales d\'achat', 'field_interaction_count', 57, 'centrales_achat', '{\"dimension\":\"poste_target\",\"organisation_node_id\":57,\"organisation_node_label\":\"DC\",\"target_key\":\"centrales_achat\",\"target_label\":\"Centrales d\'achat\",\"objective_code\":\"field_interaction_count\"}', '3bb7fbfec299690bf5acb576b08f9e704e1062ec', 'activity', 'visits', 2.000, 'weekly', 0, 1, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1754, 7, 73, 'Coaching par enfant - DVM', 'coaching_per_child_count', 56, NULL, '{\"dimension\":\"poste\",\"organisation_node_id\":56,\"organisation_node_label\":\"DVM\",\"per_child\":true,\"objective_code\":\"coaching_per_child_count\",\"target_key\":null,\"target_label\":null}', '528c39dbdd0040c71fd3735c83f92f8149a67c4f', 'activity', 'coachings', 3.000, 'monthly', 0, 1, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1755, 7, 74, 'Taux de complétion des visites', 'completion_rate', NULL, NULL, '{\"dimension\":\"scope\",\"objective_code\":\"completion_rate\",\"organisation_node_id\":null,\"organisation_node_label\":null,\"target_key\":null,\"target_label\":null}', '5d56426efb0a344b22791d642a7e3ca798a00d22', 'execution_quality', 'percentage', 90.000, 'monthly', 0, 0, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1756, 7, 75, 'Délai maximal de complétion', 'completion_delay', NULL, NULL, '{\"dimension\":\"scope\",\"objective_code\":\"completion_delay\",\"organisation_node_id\":null,\"organisation_node_label\":null,\"target_key\":null,\"target_label\":null}', '65e66a6fbe828a6889ae07c8e524ce5798fd8480', 'execution_quality', 'minutes', 60.000, 'scope_duration', 0, 0, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1757, 7, 76, 'Part minimale de visites avec présentation', 'presentation_share', NULL, NULL, '{\"dimension\":\"scope\",\"objective_code\":\"presentation_share\",\"organisation_node_id\":null,\"organisation_node_label\":null,\"target_key\":null,\"target_label\":null}', '10ef56296488a9fa0707e8f352e338bb61a34d33', 'product', 'percentage', 60.000, 'monthly', 0, 0, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1758, 7, 77, 'Part minimale de visites avec commande', 'commande_share', NULL, NULL, '{\"dimension\":\"scope\",\"objective_code\":\"commande_share\",\"organisation_node_id\":null,\"organisation_node_label\":null,\"target_key\":null,\"target_label\":null}', 'ad4cbedd438c83ab9a0f7fcc85bff6f551e169f0', 'sales', 'percentage', 30.000, 'monthly', 0, 0, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1759, 7, 78, 'Conversion KOL vers interaction liée', 'kol_conversion_rate', NULL, NULL, '{\"dimension\":\"scope\",\"objective_code\":\"kol_conversion_rate\",\"organisation_node_id\":null,\"organisation_node_label\":null,\"target_key\":null,\"target_label\":null}', '7bd0f02562d69ca5ac7ac95b637b9fb474f3a259', 'execution_quality', 'percentage', 50.000, 'monthly', 0, 0, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1760, 7, 79, 'Répartition équilibrée du coaching', 'coaching_balance', NULL, NULL, '{\"dimension\":\"scope\",\"objective_code\":\"coaching_balance\",\"organisation_node_id\":null,\"organisation_node_label\":null,\"target_key\":null,\"target_label\":null}', '1400e31c0d6e605a6bf73696d04968f3b96c6b5e', 'execution_quality', 'percentage', 80.000, 'monthly', 0, 0, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1761, 7, 80, 'Taux de réponse sondage', 'survey_response_rate', NULL, NULL, '{\"dimension\":\"scope\",\"objective_code\":\"survey_response_rate\",\"organisation_node_id\":null,\"organisation_node_label\":null,\"target_key\":null,\"target_label\":null}', '6b2c09bfe1e1acd8e091d5fae604c39cfe727e94', 'coverage', 'percentage', 40.000, 'monthly', 0, 0, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1762, 7, 81, 'Taux de complétion des visites', 'completion_rate', NULL, NULL, '{\"dimension\":\"scope\",\"objective_code\":\"completion_rate\",\"organisation_node_id\":null,\"organisation_node_label\":null,\"target_key\":null,\"target_label\":null}', '5d56426efb0a344b22791d642a7e3ca798a00d22', 'execution_quality', 'percentage', 90.000, 'monthly', 0, 0, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1763, 7, 82, 'Délai maximal de complétion', 'completion_delay', NULL, NULL, '{\"dimension\":\"scope\",\"objective_code\":\"completion_delay\",\"organisation_node_id\":null,\"organisation_node_label\":null,\"target_key\":null,\"target_label\":null}', '65e66a6fbe828a6889ae07c8e524ce5798fd8480', 'execution_quality', 'minutes', 60.000, 'scope_duration', 0, 0, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1764, 7, 83, 'Part minimale de visites avec présentation', 'presentation_share', NULL, NULL, '{\"dimension\":\"scope\",\"objective_code\":\"presentation_share\",\"organisation_node_id\":null,\"organisation_node_label\":null,\"target_key\":null,\"target_label\":null}', '10ef56296488a9fa0707e8f352e338bb61a34d33', 'product', 'percentage', 60.000, 'monthly', 0, 0, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1765, 7, 84, 'Part minimale de visites avec commande', 'commande_share', NULL, NULL, '{\"dimension\":\"scope\",\"objective_code\":\"commande_share\",\"organisation_node_id\":null,\"organisation_node_label\":null,\"target_key\":null,\"target_label\":null}', 'ad4cbedd438c83ab9a0f7fcc85bff6f551e169f0', 'sales', 'percentage', 30.000, 'monthly', 0, 0, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1766, 7, 85, 'Conversion KOL vers interaction liée', 'kol_conversion_rate', NULL, NULL, '{\"dimension\":\"scope\",\"objective_code\":\"kol_conversion_rate\",\"organisation_node_id\":null,\"organisation_node_label\":null,\"target_key\":null,\"target_label\":null}', '7bd0f02562d69ca5ac7ac95b637b9fb474f3a259', 'execution_quality', 'percentage', 50.000, 'monthly', 0, 0, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1767, 7, 86, 'Répartition équilibrée du coaching', 'coaching_balance', NULL, NULL, '{\"dimension\":\"scope\",\"objective_code\":\"coaching_balance\",\"organisation_node_id\":null,\"organisation_node_label\":null,\"target_key\":null,\"target_label\":null}', '1400e31c0d6e605a6bf73696d04968f3b96c6b5e', 'execution_quality', 'percentage', 80.000, 'monthly', 0, 0, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1768, 7, 87, 'Taux de réponse sondage', 'survey_response_rate', NULL, NULL, '{\"dimension\":\"scope\",\"objective_code\":\"survey_response_rate\",\"organisation_node_id\":null,\"organisation_node_label\":null,\"target_key\":null,\"target_label\":null}', '6b2c09bfe1e1acd8e091d5fae604c39cfe727e94', 'coverage', 'percentage', 40.000, 'monthly', 0, 0, 1, 1, '2026-04-18 12:00:27', '2026-04-18 12:00:27');

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

--
-- Structure de la table `zone_scope_snapshot_presentations`
--

CREATE TABLE `zone_scope_snapshot_presentations` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `zone_scope_snapshot_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED DEFAULT NULL,
  `product_name` varchar(255) DEFAULT NULL,
  `product_presentation_id` bigint(20) UNSIGNED NOT NULL,
  `presentation_title` varchar(255) NOT NULL,
  `presentation_status` varchar(255) DEFAULT NULL,
  `presentation_format` varchar(255) 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 `zone_scope_snapshot_presentations`
--

INSERT INTO `zone_scope_snapshot_presentations` (`id`, `zone_scope_snapshot_id`, `product_id`, `product_name`, `product_presentation_id`, `presentation_title`, `presentation_status`, `presentation_format`, `created_at`, `updated_at`) VALUES
(156, 1, 4, 'paracetamol', 9, 'Présentation - paracetamol', 'approved', 'images', '2026-04-01 00:32:06', '2026-04-01 00:32:06'),
(228, 7, 4, 'paracetamol', 9, 'Présentation - paracetamol', 'approved', 'images', '2026-04-18 12:00:27', '2026-04-18 12:00:27');

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

--
-- Structure de la table `zone_scope_snapshot_products`
--

CREATE TABLE `zone_scope_snapshot_products` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `zone_scope_snapshot_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `product_name` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `sort_order` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `presentation_kind` varchar(16) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `zone_scope_snapshot_products` (`id`, `zone_scope_snapshot_id`, `product_id`, `product_name`, `created_at`, `updated_at`, `sort_order`, `presentation_kind`) VALUES
(225, 1, 8, 'augmentin', '2026-04-01 00:32:06', '2026-04-01 00:32:06', 1, 'primaire'),
(226, 1, 4, 'paracetamol', '2026-04-01 00:32:06', '2026-04-01 00:32:06', 2, 'primaire'),
(332, 3, 8, 'augmentin', '2026-04-08 10:16:32', '2026-04-08 10:16:32', 1, 'primaire'),
(333, 3, 4, 'paracetamol', '2026-04-08 10:16:32', '2026-04-08 10:16:32', 2, 'primaire'),
(492, 7, 8, 'augmentin', '2026-04-18 12:00:27', '2026-04-18 12:00:27', 1, 'primaire'),
(493, 7, 4, 'paracetamol', '2026-04-18 12:00:27', '2026-04-18 12:00:27', 2, 'primaire');

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

--
-- Structure de la table `zone_scope_snapshot_surveys`
--

CREATE TABLE `zone_scope_snapshot_surveys` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `zone_scope_snapshot_id` bigint(20) UNSIGNED NOT NULL,
  `zone_scope_survey_campaign_id` bigint(20) UNSIGNED DEFAULT NULL,
  `campaign_name` varchar(255) DEFAULT NULL,
  `target_key` varchar(64) NOT NULL,
  `client_form_snapshot_id` bigint(20) UNSIGNED NOT NULL,
  `survey_name` varchar(255) DEFAULT NULL,
  `starts_at` date DEFAULT NULL,
  `ends_at` date DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `campaign_sort_order` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `snapshot_payload` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`snapshot_payload`)),
  `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 `zone_scope_snapshot_surveys`
--

INSERT INTO `zone_scope_snapshot_surveys` (`id`, `zone_scope_snapshot_id`, `zone_scope_survey_campaign_id`, `campaign_name`, `target_key`, `client_form_snapshot_id`, `survey_name`, `starts_at`, `ends_at`, `is_active`, `campaign_sort_order`, `snapshot_payload`, `created_at`, `updated_at`) VALUES
(4, 1, 2, 'test sondage 2', 'prescripteurs', 1, 'Sondage prescripteur', '2026-04-01', NULL, 1, 0, '{\"kind\":\"sondage\",\"type\":\"prescripteurs\",\"name\":\"Sondage prescripteur\",\"description\":\"Sondage prescripteur\",\"questions\":[{\"position\":1,\"question\":\"Sondage prescripteur\",\"question_template\":\"Sondage prescripteur\",\"question_placeholders\":[],\"question_preview\":\"Sondage prescripteur\",\"response_type\":\"boolean\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[],\"product_names\":[]}]}', '2026-04-01 00:32:06', '2026-04-01 00:32:06'),
(5, 1, 1, 'test sondage', 'dispensateurs', 2, 'Sondage dispensateur', '2026-04-01', NULL, 1, 0, '{\"kind\":\"sondage\",\"type\":\"dispensateurs\",\"name\":\"Sondage dispensateur\",\"description\":\"Sondage dispensateur\",\"questions\":[{\"position\":1,\"question\":\"Sondage dispensateur\",\"question_template\":\"Sondage dispensateur\",\"question_placeholders\":[],\"question_preview\":\"Sondage dispensateur\",\"response_type\":\"boolean\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[],\"product_names\":[]}]}', '2026-04-01 00:32:06', '2026-04-01 00:32:06'),
(6, 1, 1, 'test sondage', 'distributeurs', 3, 'Sondage distributeur', '2026-04-01', NULL, 1, 0, '{\"kind\":\"sondage\",\"type\":\"distributeurs\",\"name\":\"Sondage distributeur\",\"description\":\"Sondage distributeur\",\"questions\":[{\"position\":1,\"question\":\"Sondage distributeur\",\"question_template\":\"Sondage distributeur\",\"question_placeholders\":[],\"question_preview\":\"Sondage distributeur\",\"response_type\":\"boolean\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[],\"product_names\":[]}]}', '2026-04-01 00:32:06', '2026-04-01 00:32:06'),
(7, 1, 1, 'test sondage', 'prescripteurs', 1, 'Sondage prescripteur', '2026-04-01', NULL, 1, 0, '{\"kind\":\"sondage\",\"type\":\"prescripteurs\",\"name\":\"Sondage prescripteur\",\"description\":\"Sondage prescripteur\",\"questions\":[{\"position\":1,\"question\":\"Sondage prescripteur\",\"question_template\":\"Sondage prescripteur\",\"question_placeholders\":[],\"question_preview\":\"Sondage prescripteur\",\"response_type\":\"boolean\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[],\"product_names\":[]}]}', '2026-04-01 00:32:06', '2026-04-01 00:32:06'),
(182, 7, 5, 'test 2', 'prescripteurs', 1, 'Sondage prescripteur', '2026-04-11', NULL, 1, 0, '{\"kind\":\"sondage\",\"type\":\"prescripteurs\",\"name\":\"Sondage prescripteur\",\"description\":\"Sondage prescripteur\",\"questions\":[{\"position\":1,\"question\":\"Sondage prescripteur\",\"question_template\":\"Sondage prescripteur\",\"question_placeholders\":[],\"question_preview\":\"Sondage prescripteur\",\"response_type\":\"boolean\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[],\"product_names\":[]}]}', '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(183, 7, 4, 'test sondage 1', 'prescripteurs', 1, 'Sondage prescripteur', '2026-04-11', NULL, 1, 1, '{\"kind\":\"sondage\",\"type\":\"prescripteurs\",\"name\":\"Sondage prescripteur\",\"description\":\"Sondage prescripteur\",\"questions\":[{\"position\":1,\"question\":\"Sondage prescripteur\",\"question_template\":\"Sondage prescripteur\",\"question_placeholders\":[],\"question_preview\":\"Sondage prescripteur\",\"response_type\":\"boolean\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[],\"product_names\":[]}]}', '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(184, 7, 6, 'zefqsd<x', 'prescripteurs', 1, 'Sondage prescripteur', '2026-04-11', NULL, 0, 3, '{\"kind\":\"sondage\",\"type\":\"prescripteurs\",\"name\":\"Sondage prescripteur\",\"description\":\"Sondage prescripteur\",\"questions\":[{\"position\":1,\"question\":\"Sondage prescripteur\",\"question_template\":\"Sondage prescripteur\",\"question_placeholders\":[],\"question_preview\":\"Sondage prescripteur\",\"response_type\":\"boolean\",\"options\":[],\"range_min\":null,\"range_max\":null,\"product_ids\":[],\"product_names\":[]}]}', '2026-04-18 12:00:27', '2026-04-18 12:00:27');

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

--
-- Structure de la table `zone_scope_snapshot_targets`
--

CREATE TABLE `zone_scope_snapshot_targets` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `zone_scope_snapshot_id` bigint(20) UNSIGNED NOT NULL,
  `target_key` varchar(255) NOT NULL,
  `target_label` varchar(255) DEFAULT NULL,
  `profession_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `speciality_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `form_count` int(10) UNSIGNED 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 `zone_scope_snapshot_targets`
--

INSERT INTO `zone_scope_snapshot_targets` (`id`, `zone_scope_snapshot_id`, `target_key`, `target_label`, `profession_count`, `speciality_count`, `form_count`, `created_at`, `updated_at`) VALUES
(1025, 1, 'prescripteurs', 'Prescripteurs', 1, 1, 1, '2026-04-01 00:32:06', '2026-04-01 00:32:06'),
(1026, 1, 'dispensateurs', 'Dispensateurs', 1, 1, 1, '2026-04-01 00:32:06', '2026-04-01 00:32:06'),
(1027, 1, 'distributeurs', 'Distributeurs', 1, 1, 1, '2026-04-01 00:32:06', '2026-04-01 00:32:06'),
(1028, 1, 'centrales_achat', 'Centrales d\'achat', 1, 1, 1, '2026-04-01 00:32:06', '2026-04-01 00:32:06'),
(1477, 3, 'prescripteurs', 'Prescripteurs', 1, 1, 2, '2026-04-08 10:16:32', '2026-04-08 10:16:32'),
(1478, 3, 'dispensateurs', 'Dispensateurs', 1, 1, 2, '2026-04-08 10:16:32', '2026-04-08 10:16:32'),
(1479, 3, 'distributeurs', 'Distributeurs', 1, 1, 2, '2026-04-08 10:16:32', '2026-04-08 10:16:32'),
(1480, 3, 'centrales_achat', 'Centrales d\'achat', 1, 1, 2, '2026-04-08 10:16:32', '2026-04-08 10:16:32'),
(1881, 6, 'prescripteurs', 'Prescripteurs', 0, 0, 0, '2026-04-13 01:16:11', '2026-04-13 01:16:11'),
(1882, 6, 'dispensateurs', 'Dispensateurs', 0, 0, 0, '2026-04-13 01:16:11', '2026-04-13 01:16:11'),
(1883, 6, 'distributeurs', 'Distributeurs', 0, 0, 0, '2026-04-13 01:16:11', '2026-04-13 01:16:11'),
(1884, 6, 'centrales_achat', 'Centrales d\'achat', 0, 0, 0, '2026-04-13 01:16:11', '2026-04-13 01:16:11'),
(1905, 7, 'prescripteurs', 'Prescripteurs', 2, 3, 2, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1906, 7, 'dispensateurs', 'Dispensateurs', 1, 1, 2, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1907, 7, 'distributeurs', 'Distributeurs', 1, 1, 2, '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1908, 7, 'centrales_achat', 'Centrales d\'achat', 1, 1, 2, '2026-04-18 12:00:27', '2026-04-18 12:00:27');

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

--
-- Structure de la table `zone_scope_snapshot_target_professions`
--

CREATE TABLE `zone_scope_snapshot_target_professions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `zone_scope_snapshot_target_id` bigint(20) UNSIGNED NOT NULL,
  `profession_id` bigint(20) UNSIGNED DEFAULT NULL,
  `profession_name` varchar(255) 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 `zone_scope_snapshot_target_professions`
--

INSERT INTO `zone_scope_snapshot_target_professions` (`id`, `zone_scope_snapshot_target_id`, `profession_id`, `profession_name`, `created_at`, `updated_at`) VALUES
(1016, 1025, 1, 'Medecin', '2026-04-01 00:32:06', '2026-04-01 00:32:06'),
(1017, 1026, 2, 'Pharmacien', '2026-04-01 00:32:06', '2026-04-01 00:32:06'),
(1018, 1027, 3, 'Grossiste', '2026-04-01 00:32:06', '2026-04-01 00:32:06'),
(1019, 1028, 4, 'Super gros', '2026-04-01 00:32:06', '2026-04-01 00:32:06'),
(1032, 1041, 1, 'Medecin', '2026-04-02 01:05:35', '2026-04-02 01:05:35'),
(1033, 1042, 2, 'Pharmacien', '2026-04-02 01:05:35', '2026-04-02 01:05:35'),
(1034, 1043, 3, 'Grossiste', '2026-04-02 01:05:35', '2026-04-02 01:05:35'),
(1035, 1044, 4, 'Super gros', '2026-04-02 01:05:36', '2026-04-02 01:05:36'),
(1364, 1477, 6, 'Dentiste', '2026-04-08 10:16:32', '2026-04-08 10:16:32'),
(1365, 1478, 2, 'Pharmacien', '2026-04-08 10:16:32', '2026-04-08 10:16:32'),
(1366, 1479, 3, 'Grossiste', '2026-04-08 10:16:32', '2026-04-08 10:16:32'),
(1367, 1480, 4, 'Super gros', '2026-04-08 10:16:32', '2026-04-08 10:16:32'),
(1554, 1669, 6, 'Dentiste', '2026-04-12 11:03:26', '2026-04-12 11:03:26'),
(1555, 1670, 2, 'Pharmacien', '2026-04-12 11:03:26', '2026-04-12 11:03:26'),
(1556, 1671, 3, 'Grossiste', '2026-04-12 11:03:26', '2026-04-12 11:03:26'),
(1557, 1672, 4, 'Super gros', '2026-04-12 11:03:26', '2026-04-12 11:03:26'),
(1793, 1905, 6, 'Dentiste', '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1794, 1905, 1, 'Medecin', '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1795, 1906, 2, 'Pharmacien', '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1796, 1907, 3, 'Grossiste', '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1797, 1908, 4, 'Super gros', '2026-04-18 12:00:27', '2026-04-18 12:00:27');

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

--
-- Structure de la table `zone_scope_snapshot_target_specialities`
--

CREATE TABLE `zone_scope_snapshot_target_specialities` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `zone_scope_snapshot_target_id` bigint(20) UNSIGNED NOT NULL,
  `speciality_id` bigint(20) UNSIGNED DEFAULT NULL,
  `speciality_name` varchar(255) NOT NULL,
  `profession_id` bigint(20) UNSIGNED DEFAULT NULL,
  `profession_name` varchar(255) 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 `zone_scope_snapshot_target_specialities`
--

INSERT INTO `zone_scope_snapshot_target_specialities` (`id`, `zone_scope_snapshot_target_id`, `speciality_id`, `speciality_name`, `profession_id`, `profession_name`, `created_at`, `updated_at`) VALUES
(739, 1025, 5, 'Cardiologue', 1, 'Medecin', '2026-04-01 00:32:06', '2026-04-01 00:32:06'),
(740, 1026, 2, 'Pharmaciens', 2, 'Pharmacien', '2026-04-01 00:32:06', '2026-04-01 00:32:06'),
(741, 1027, 3, 'Grossiste', 3, 'Grossiste', '2026-04-01 00:32:06', '2026-04-01 00:32:06'),
(742, 1028, 4, 'Super gros', 4, 'Super gros', '2026-04-01 00:32:06', '2026-04-01 00:32:06'),
(1091, 1477, 6, 'Dentiste', 6, 'Dentiste', '2026-04-08 10:16:32', '2026-04-08 10:16:32'),
(1092, 1478, 2, 'Pharmaciens', 2, 'Pharmacien', '2026-04-08 10:16:32', '2026-04-08 10:16:32'),
(1093, 1479, 3, 'Grossiste', 3, 'Grossiste', '2026-04-08 10:16:32', '2026-04-08 10:16:32'),
(1094, 1480, 4, 'Super gros', 4, 'Super gros', '2026-04-08 10:16:32', '2026-04-08 10:16:32'),
(1593, 1905, 1, 'Generaliste', 1, 'Medecin', '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1594, 1905, 5, 'Cardiologue', 1, 'Medecin', '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1595, 1905, 6, 'Dentiste', 6, 'Dentiste', '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1596, 1906, 2, 'Pharmaciens', 2, 'Pharmacien', '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1597, 1907, 3, 'Grossiste', 3, 'Grossiste', '2026-04-18 12:00:27', '2026-04-18 12:00:27'),
(1598, 1908, 4, 'Super gros', 4, 'Super gros', '2026-04-18 12:00:27', '2026-04-18 12:00:27');

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

--
-- Structure de la table `zone_scope_survey_campaigns`
--

CREATE TABLE `zone_scope_survey_campaigns` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `zone_scope_id` bigint(20) UNSIGNED NOT NULL,
  `created_by_client_user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `name` varchar(255) DEFAULT NULL,
  `starts_at` date NOT NULL,
  `ends_at` date DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `activated_at` timestamp NULL DEFAULT NULL,
  `archived_at` timestamp NULL DEFAULT NULL,
  `sort_order` int(10) UNSIGNED 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 `zone_scope_survey_campaigns`
--

INSERT INTO `zone_scope_survey_campaigns` (`id`, `zone_scope_id`, `created_by_client_user_id`, `name`, `starts_at`, `ends_at`, `is_active`, `activated_at`, `archived_at`, `sort_order`, `created_at`, `updated_at`) VALUES
(1, 88, 10, 'test sondage', '2026-04-01', NULL, 1, '2026-04-01 00:27:01', NULL, 1, '2026-04-01 00:27:01', '2026-04-01 00:27:01'),
(2, 88, 10, 'test sondage 2', '2026-04-01', NULL, 1, '2026-04-01 00:32:05', NULL, 0, '2026-04-01 00:32:05', '2026-04-01 00:32:05'),
(4, 94, 10, 'test sondage 1', '2026-04-11', NULL, 1, '2026-04-11 12:23:55', NULL, 1, '2026-04-11 12:23:55', '2026-04-11 12:40:34'),
(5, 94, 10, 'test 2', '2026-04-11', NULL, 1, '2026-04-11 12:25:21', NULL, 0, '2026-04-11 12:25:21', '2026-04-11 12:40:34'),
(6, 94, 10, 'zefqsd<x', '2026-04-11', NULL, 0, '2026-04-11 12:40:49', '2026-04-11 12:41:08', 3, '2026-04-11 12:39:47', '2026-04-11 12:41:08');

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

--
-- Structure de la table `zone_scope_survey_campaign_targets`
--

CREATE TABLE `zone_scope_survey_campaign_targets` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `zone_scope_survey_campaign_id` bigint(20) UNSIGNED NOT NULL,
  `target_key` varchar(64) NOT NULL,
  `client_form_snapshot_id` bigint(20) UNSIGNED NOT NULL,
  `survey_name` varchar(255) 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 `zone_scope_survey_campaign_targets`
--

INSERT INTO `zone_scope_survey_campaign_targets` (`id`, `zone_scope_survey_campaign_id`, `target_key`, `client_form_snapshot_id`, `survey_name`, `created_at`, `updated_at`) VALUES
(1, 1, 'prescripteurs', 1, 'Sondage prescripteur', '2026-04-01 00:27:01', '2026-04-01 00:27:01'),
(2, 1, 'dispensateurs', 2, 'Sondage dispensateur', '2026-04-01 00:27:01', '2026-04-01 00:27:01'),
(3, 1, 'distributeurs', 3, 'Sondage distributeur', '2026-04-01 00:27:01', '2026-04-01 00:27:01'),
(4, 2, 'prescripteurs', 1, 'Sondage prescripteur', '2026-04-01 00:32:06', '2026-04-01 00:32:06'),
(6, 4, 'prescripteurs', 1, 'Sondage prescripteur', '2026-04-11 12:23:55', '2026-04-11 12:23:55'),
(7, 5, 'prescripteurs', 1, 'Sondage prescripteur', '2026-04-11 12:25:21', '2026-04-11 12:25:21'),
(8, 6, 'prescripteurs', 1, 'Sondage prescripteur', '2026-04-11 12:39:47', '2026-04-11 12:39:47');

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

--
-- Structure de la table `zone_scope_target_forms`
--

CREATE TABLE `zone_scope_target_forms` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `zone_scope_id` bigint(20) UNSIGNED NOT NULL,
  `target_key` varchar(32) NOT NULL,
  `form_kind` varchar(32) NOT NULL DEFAULT 'terrain_report',
  `organisation_node_id` bigint(20) UNSIGNED DEFAULT NULL,
  `organisation_node_unit_id` bigint(20) UNSIGNED DEFAULT NULL,
  `client_form_id` bigint(20) UNSIGNED DEFAULT NULL,
  `client_form_snapshot_id` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `form_version` smallint(5) UNSIGNED NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `zone_scope_target_forms` (`id`, `zone_scope_id`, `target_key`, `form_kind`, `organisation_node_id`, `organisation_node_unit_id`, `client_form_id`, `client_form_snapshot_id`, `created_at`, `updated_at`, `form_version`) VALUES
(128, 88, 'prescripteurs', 'terrain_report', NULL, NULL, 3, NULL, '2026-03-31 00:41:42', '2026-03-31 00:41:42', 1),
(129, 88, 'dispensateurs', 'terrain_report', NULL, NULL, 4, NULL, '2026-03-31 00:41:42', '2026-03-31 00:41:42', 1),
(130, 88, 'distributeurs', 'terrain_report', NULL, NULL, 5, NULL, '2026-03-31 00:41:42', '2026-03-31 00:41:42', 1),
(131, 88, 'centrales_achat', 'terrain_report', NULL, NULL, 6, NULL, '2026-03-31 00:41:42', '2026-03-31 00:41:42', 1),
(132, 90, 'prescripteurs', 'terrain_report', NULL, NULL, NULL, 12, '2026-04-07 14:10:33', '2026-04-07 14:10:33', 1),
(133, 90, 'prescripteurs', 'kol', NULL, NULL, NULL, 7, '2026-04-07 14:10:33', '2026-04-07 14:10:33', 1),
(134, 90, 'dispensateurs', 'terrain_report', NULL, NULL, NULL, 14, '2026-04-07 14:10:33', '2026-04-07 14:10:33', 1),
(135, 90, 'dispensateurs', 'kol', NULL, NULL, NULL, 8, '2026-04-07 14:10:33', '2026-04-07 14:10:33', 1),
(136, 90, 'distributeurs', 'terrain_report', NULL, NULL, NULL, 16, '2026-04-07 14:10:33', '2026-04-07 14:10:33', 1),
(137, 90, 'distributeurs', 'kol', NULL, NULL, NULL, 9, '2026-04-07 14:10:33', '2026-04-07 14:10:33', 1),
(138, 90, 'centrales_achat', 'terrain_report', NULL, NULL, NULL, 17, '2026-04-07 14:10:33', '2026-04-07 14:10:33', 1),
(139, 90, 'centrales_achat', 'kol', NULL, NULL, NULL, 10, '2026-04-07 14:10:33', '2026-04-07 14:10:33', 1),
(140, 90, '*', 'coaching', 57, NULL, NULL, 5, '2026-04-07 14:10:33', '2026-04-07 14:10:33', 1),
(141, 93, '*', 'coaching', 141, NULL, NULL, 5, '2026-04-08 09:30:06', '2026-04-08 09:30:06', 1),
(142, 94, 'prescripteurs', 'terrain_report', NULL, NULL, NULL, 12, '2026-04-08 10:21:33', '2026-04-08 10:21:33', 1),
(143, 94, 'prescripteurs', 'kol', NULL, NULL, NULL, 7, '2026-04-08 10:21:33', '2026-04-08 10:21:33', 1),
(144, 94, 'dispensateurs', 'terrain_report', NULL, NULL, NULL, 14, '2026-04-08 10:21:33', '2026-04-08 10:21:33', 1),
(145, 94, 'dispensateurs', 'kol', NULL, NULL, NULL, 8, '2026-04-08 10:21:33', '2026-04-08 10:21:33', 1),
(146, 94, 'distributeurs', 'terrain_report', NULL, NULL, NULL, 16, '2026-04-08 10:21:33', '2026-04-08 10:21:33', 1),
(147, 94, 'distributeurs', 'kol', NULL, NULL, NULL, 9, '2026-04-08 10:21:33', '2026-04-08 10:21:33', 1),
(148, 94, 'centrales_achat', 'terrain_report', NULL, NULL, NULL, 17, '2026-04-08 10:21:33', '2026-04-08 10:21:33', 1),
(149, 94, 'centrales_achat', 'kol', NULL, NULL, NULL, 10, '2026-04-08 10:21:33', '2026-04-08 10:21:33', 1),
(150, 94, '*', 'coaching', 56, NULL, NULL, 5, '2026-04-08 10:21:33', '2026-04-08 10:21:33', 1),
(151, 94, '*', 'coaching', 57, NULL, NULL, 5, '2026-04-08 10:21:33', '2026-04-08 10:21:33', 1),
(152, 94, '*', 'coaching', 58, NULL, NULL, 5, '2026-04-08 10:21:33', '2026-04-08 10:21:33', 1),
(153, 94, '*', 'simple_report', 59, NULL, NULL, 6, '2026-04-08 10:21:33', '2026-04-08 10:21:33', 1),
(154, 94, '*', 'simple_report', 60, NULL, NULL, 6, '2026-04-08 10:21:33', '2026-04-08 10:21:33', 1),
(155, 94, '*', 'simple_report', 61, NULL, NULL, 6, '2026-04-08 10:21:33', '2026-04-08 10:21:33', 1),
(156, 94, 'prescripteurs', 'terrain_report', NULL, NULL, NULL, 11, '2026-04-11 12:15:26', '2026-04-11 12:15:26', 2),
(157, 94, 'dispensateurs', 'terrain_report', NULL, NULL, NULL, 13, '2026-04-11 12:15:26', '2026-04-11 12:15:26', 2),
(158, 94, 'distributeurs', 'terrain_report', NULL, NULL, NULL, 15, '2026-04-11 12:15:26', '2026-04-11 12:15:26', 2),
(159, 94, '*', 'simple_report', 56, NULL, NULL, 6, '2026-04-11 12:34:08', '2026-04-11 12:34:08', 1),
(160, 94, '*', 'simple_report', 57, NULL, NULL, 6, '2026-04-11 12:34:08', '2026-04-11 12:34:08', 1),
(161, 94, '*', 'coaching', 56, NULL, NULL, NULL, '2026-04-13 00:20:30', '2026-04-13 00:20:30', 2),
(162, 93, '*', 'simple_report', 142, NULL, NULL, 6, '2026-04-13 01:16:04', '2026-04-13 01:16:04', 1),
(163, 94, '*', 'coaching', 56, NULL, NULL, 5, '2026-04-13 02:22:57', '2026-04-13 02:22:57', 3),
(164, 94, '*', 'coaching', 56, NULL, NULL, NULL, '2026-04-13 02:23:41', '2026-04-13 02:23:41', 4);

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

--
-- Structure de la table `zone_scope_target_specialities`
--

CREATE TABLE `zone_scope_target_specialities` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `zone_scope_id` bigint(20) UNSIGNED NOT NULL,
  `target_key` varchar(32) NOT NULL,
  `speciality_id` bigint(20) UNSIGNED 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 `zone_scope_target_specialities`
--

INSERT INTO `zone_scope_target_specialities` (`id`, `zone_scope_id`, `target_key`, `speciality_id`, `created_at`, `updated_at`) VALUES
(217, 88, 'prescripteurs', 5, '2026-03-29 22:44:24', '2026-03-29 22:44:24'),
(218, 88, 'dispensateurs', 2, '2026-03-29 22:44:24', '2026-03-29 22:44:24'),
(219, 88, 'distributeurs', 3, '2026-03-29 22:44:24', '2026-03-29 22:44:24'),
(220, 88, 'centrales_achat', 4, '2026-03-29 22:44:24', '2026-03-29 22:44:24'),
(246, 90, 'prescripteurs', 6, '2026-04-07 12:49:03', '2026-04-07 12:49:03'),
(247, 90, 'dispensateurs', 2, '2026-04-07 12:49:03', '2026-04-07 12:49:03'),
(248, 90, 'distributeurs', 3, '2026-04-07 12:49:03', '2026-04-07 12:49:03'),
(249, 90, 'centrales_achat', 4, '2026-04-07 12:49:03', '2026-04-07 12:49:03'),
(250, 94, 'prescripteurs', 1, '2026-04-08 10:19:56', '2026-04-08 10:19:56'),
(251, 94, 'prescripteurs', 5, '2026-04-08 10:19:56', '2026-04-08 10:19:56'),
(252, 94, 'prescripteurs', 6, '2026-04-08 10:19:56', '2026-04-08 10:19:56'),
(253, 94, 'dispensateurs', 2, '2026-04-08 10:19:56', '2026-04-08 10:19:56'),
(254, 94, 'distributeurs', 3, '2026-04-08 10:19:56', '2026-04-08 10:19:56'),
(255, 94, 'centrales_achat', 4, '2026-04-08 10:19:56', '2026-04-08 10:19:56');

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

--
-- Structure de la table `zone_scope_target_surveys`
--

CREATE TABLE `zone_scope_target_surveys` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `zone_scope_id` bigint(20) UNSIGNED NOT NULL,
  `target_key` varchar(64) NOT NULL,
  `client_form_snapshot_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) DEFAULT NULL,
  `starts_at` date DEFAULT NULL,
  `ends_at` date DEFAULT NULL,
  `is_active` 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;

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

--
-- Structure de la table `zone_scope_types`
--

CREATE TABLE `zone_scope_types` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `client_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `created_by_client_user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `allow_all_paths` tinyint(1) NOT NULL DEFAULT 1,
  `targets_mask` smallint(5) UNSIGNED NOT NULL DEFAULT 15,
  `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 `zone_scope_types`
--

INSERT INTO `zone_scope_types` (`id`, `client_id`, `name`, `created_by_client_user_id`, `allow_all_paths`, `targets_mask`, `created_at`, `updated_at`) VALUES
(1, 3, 'Par défaut', NULL, 1, 15, '2026-02-13 00:13:52', '2026-02-13 00:13:52'),
(2, 3, 'DGBU', 1, 0, 15, '2026-02-13 00:22:11', '2026-02-13 00:22:11'),
(3, 3, 'BUDC', 1, 0, 15, '2026-02-13 00:23:07', '2026-02-13 00:23:07'),
(5, 3, 'Fahd', 1, 1, 15, '2026-02-13 17:55:09', '2026-02-13 17:55:09'),
(6, 3, 'ligne therapeutique', 4, 1, 15, '2026-02-17 12:42:58', '2026-02-17 12:42:58'),
(7, 3, 'prospect', 4, 1, 15, '2026-02-17 12:43:22', '2026-02-17 12:43:22'),
(8, 3, 'ligne thera', 1, 1, 1, '2026-02-18 13:28:50', '2026-02-18 13:28:50'),
(10, 3, 'ramdane', 1, 1, 12, '2026-02-19 13:56:15', '2026-02-19 13:56:15'),
(11, 3, 'pas pharmacie', 1, 1, 13, '2026-02-21 23:12:41', '2026-02-21 23:12:41'),
(12, 4, 'Par défaut', NULL, 1, 15, '2026-02-23 03:12:17', '2026-02-23 03:12:17'),
(13, 4, 'type scope org 1', 10, 1, 7, '2026-03-27 15:29:59', '2026-03-27 15:29:59'),
(14, 4, 'test type scope org 1', 10, 1, 7, '2026-03-27 15:51:55', '2026-03-27 15:51:55'),
(16, 4, 'test type scope org 01', 10, 1, 15, '2026-03-27 16:12:12', '2026-03-27 16:12:12');

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

--
-- Structure de la table `zone_scope_type_edges`
--

CREATE TABLE `zone_scope_type_edges` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `zone_scope_type_id` bigint(20) UNSIGNED NOT NULL,
  `parent_org_node_id` bigint(20) UNSIGNED NOT NULL,
  `child_org_node_id` bigint(20) UNSIGNED 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 `zone_scope_type_edges`
--

INSERT INTO `zone_scope_type_edges` (`id`, `zone_scope_type_id`, `parent_org_node_id`, `child_org_node_id`, `created_at`, `updated_at`) VALUES
(1, 2, 2, 3, '2026-02-13 00:22:11', '2026-02-13 00:22:11'),
(2, 3, 3, 6, '2026-02-13 00:23:07', '2026-02-13 00:23:07');

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

--
-- Structure de la table `zone_scope_type_node_targets`
--

CREATE TABLE `zone_scope_type_node_targets` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `zone_scope_type_id` bigint(20) UNSIGNED NOT NULL,
  `org_node_id` bigint(20) UNSIGNED NOT NULL,
  `targets_mask` smallint(5) UNSIGNED 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 `zone_scope_type_node_targets`
--

INSERT INTO `zone_scope_type_node_targets` (`id`, `zone_scope_type_id`, `org_node_id`, `targets_mask`, `created_at`, `updated_at`) VALUES
(1, 1, 2, 15, '2026-02-13 00:13:52', '2026-02-13 00:13:52'),
(2, 1, 3, 15, '2026-02-13 00:13:52', '2026-02-13 00:13:52'),
(3, 1, 6, 15, '2026-02-13 00:13:52', '2026-02-13 00:13:52'),
(4, 1, 11, 15, '2026-02-13 00:13:52', '2026-02-13 00:13:52'),
(5, 1, 15, 15, '2026-02-13 00:13:52', '2026-02-13 00:13:52'),
(6, 2, 2, 15, '2026-02-13 00:22:11', '2026-02-13 00:22:11'),
(7, 2, 3, 15, '2026-02-13 00:22:11', '2026-02-13 00:22:11'),
(8, 2, 6, 15, '2026-02-13 00:22:11', '2026-02-13 00:22:11'),
(9, 2, 11, 15, '2026-02-13 00:22:11', '2026-02-13 00:22:11'),
(10, 2, 15, 15, '2026-02-13 00:22:11', '2026-02-13 00:22:11'),
(11, 3, 2, 15, '2026-02-13 00:23:07', '2026-02-13 00:23:07'),
(12, 3, 3, 15, '2026-02-13 00:23:07', '2026-02-13 00:23:07'),
(13, 3, 6, 15, '2026-02-13 00:23:07', '2026-02-13 00:23:07'),
(14, 3, 11, 15, '2026-02-13 00:23:07', '2026-02-13 00:23:07'),
(15, 3, 15, 15, '2026-02-13 00:23:07', '2026-02-13 00:23:07');

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

--
-- Structure de la table `zone_wilaya`
--

CREATE TABLE `zone_wilaya` (
  `zone_id` bigint(20) UNSIGNED NOT NULL,
  `wilaya_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `zone_wilaya` (`zone_id`, `wilaya_id`) VALUES
(87, 2),
(87, 5),
(87, 6),
(87, 7),
(87, 9),
(87, 10),
(87, 12),
(87, 13),
(87, 15),
(87, 17),
(87, 18),
(87, 19),
(87, 20),
(87, 21),
(87, 22),
(87, 23),
(87, 24),
(87, 25),
(87, 26),
(87, 27),
(87, 28),
(87, 29),
(87, 31),
(87, 34),
(87, 36),
(87, 39),
(87, 40),
(87, 41),
(87, 43),
(87, 44),
(87, 48),
(88, 2),
(88, 5),
(88, 6),
(88, 7),
(88, 9),
(88, 10),
(88, 12),
(88, 13),
(88, 15),
(88, 17),
(88, 18),
(88, 19),
(88, 20),
(88, 21),
(88, 22),
(88, 23),
(88, 24),
(88, 25),
(88, 26),
(88, 27),
(88, 28),
(88, 29),
(88, 31),
(88, 34),
(88, 36),
(88, 39),
(88, 40),
(88, 41),
(88, 43),
(88, 44),
(88, 48),
(89, 2),
(89, 5),
(89, 6),
(89, 7),
(89, 9),
(89, 10),
(89, 12),
(89, 13),
(89, 15),
(89, 17),
(89, 18),
(89, 19),
(89, 20),
(89, 21),
(89, 22),
(89, 23),
(89, 24),
(89, 25),
(89, 26),
(89, 27),
(89, 28),
(89, 29),
(89, 31),
(89, 34),
(89, 36),
(89, 39),
(89, 40),
(89, 41),
(89, 43),
(89, 44),
(89, 48);

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

--
-- Index pour la table `activity_logs`
--
ALTER TABLE `activity_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `activity_logs_admin_id_index` (`admin_id`),
  ADD KEY `activity_logs_type_index` (`type`);

--
-- Index pour la table `admins`
--
ALTER TABLE `admins`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `admins_email_unique` (`email`),
  ADD UNIQUE KEY `admins_username_unique` (`username`),
  ADD KEY `admins_invite_token_index` (`invite_token`);

--
-- Index pour la table `admin_devices`
--
ALTER TABLE `admin_devices`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `admin_devices_admin_id_device_hash_unique` (`admin_id`,`device_hash`);

--
-- Index pour la table `admin_password_reset_tokens`
--
ALTER TABLE `admin_password_reset_tokens`
  ADD PRIMARY KEY (`email`);

--
-- Index pour la table `appels_associations_patients`
--
ALTER TABLE `appels_associations_patients`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_client_org_idx` (`client_id`,`organisation_id`),
  ADD KEY `visit_scope_status_idx` (`zone_scope_id`,`status`),
  ADD KEY `visit_user_status_idx` (`client_user_id`,`status`),
  ADD KEY `visit_target_idx` (`target_table`,`target_id`);

--
-- Index pour la table `appels_centrales_achat`
--
ALTER TABLE `appels_centrales_achat`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_client_org_idx` (`client_id`,`organisation_id`),
  ADD KEY `visit_scope_status_idx` (`zone_scope_id`,`status`),
  ADD KEY `visit_user_status_idx` (`client_user_id`,`status`),
  ADD KEY `visit_target_idx` (`target_table`,`target_id`);

--
-- Index pour la table `appels_dispensateurs`
--
ALTER TABLE `appels_dispensateurs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_client_org_idx` (`client_id`,`organisation_id`),
  ADD KEY `visit_scope_status_idx` (`zone_scope_id`,`status`),
  ADD KEY `visit_user_status_idx` (`client_user_id`,`status`),
  ADD KEY `visit_target_idx` (`target_table`,`target_id`);

--
-- Index pour la table `appels_distributeurs`
--
ALTER TABLE `appels_distributeurs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_client_org_idx` (`client_id`,`organisation_id`),
  ADD KEY `visit_scope_status_idx` (`zone_scope_id`,`status`),
  ADD KEY `visit_user_status_idx` (`client_user_id`,`status`),
  ADD KEY `visit_target_idx` (`target_table`,`target_id`);

--
-- Index pour la table `appels_influenceurs_decideurs`
--
ALTER TABLE `appels_influenceurs_decideurs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_client_org_idx` (`client_id`,`organisation_id`),
  ADD KEY `visit_scope_status_idx` (`zone_scope_id`,`status`),
  ADD KEY `visit_user_status_idx` (`client_user_id`,`status`),
  ADD KEY `visit_target_idx` (`target_table`,`target_id`);

--
-- Index pour la table `appels_institutions_sante`
--
ALTER TABLE `appels_institutions_sante`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_client_org_idx` (`client_id`,`organisation_id`),
  ADD KEY `visit_scope_status_idx` (`zone_scope_id`,`status`),
  ADD KEY `visit_user_status_idx` (`client_user_id`,`status`),
  ADD KEY `visit_target_idx` (`target_table`,`target_id`);

--
-- Index pour la table `appels_organismes_formation_medicale`
--
ALTER TABLE `appels_organismes_formation_medicale`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_client_org_idx` (`client_id`,`organisation_id`),
  ADD KEY `visit_scope_status_idx` (`zone_scope_id`,`status`),
  ADD KEY `visit_user_status_idx` (`client_user_id`,`status`),
  ADD KEY `visit_target_idx` (`target_table`,`target_id`);

--
-- Index pour la table `appels_partenaires_commerciaux`
--
ALTER TABLE `appels_partenaires_commerciaux`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_client_org_idx` (`client_id`,`organisation_id`),
  ADD KEY `visit_scope_status_idx` (`zone_scope_id`,`status`),
  ADD KEY `visit_user_status_idx` (`client_user_id`,`status`),
  ADD KEY `visit_target_idx` (`target_table`,`target_id`);

--
-- Index pour la table `appels_prescripteurs`
--
ALTER TABLE `appels_prescripteurs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_client_org_idx` (`client_id`,`organisation_id`),
  ADD KEY `visit_scope_status_idx` (`zone_scope_id`,`status`),
  ADD KEY `visit_user_status_idx` (`client_user_id`,`status`),
  ADD KEY `visit_target_idx` (`target_table`,`target_id`);

--
-- Index pour la table `appels_structures_soins`
--
ALTER TABLE `appels_structures_soins`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_client_org_idx` (`client_id`,`organisation_id`),
  ADD KEY `visit_scope_status_idx` (`zone_scope_id`,`status`),
  ADD KEY `visit_user_status_idx` (`client_user_id`,`status`),
  ADD KEY `visit_target_idx` (`target_table`,`target_id`);

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

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

--
-- Index pour la table `clients`
--
ALTER TABLE `clients`
  ADD PRIMARY KEY (`id`),
  ADD KEY `clients_default_client_user_id_foreign` (`default_client_user_id`);

--
-- Index pour la table `client_access`
--
ALTER TABLE `client_access`
  ADD PRIMARY KEY (`id`),
  ADD KEY `client_access_client_id_foreign` (`client_id`);

--
-- Index pour la table `client_devices`
--
ALTER TABLE `client_devices`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `client_devices_client_user_id_device_hash_unique` (`client_user_id`,`device_hash`);

--
-- Index pour la table `client_forms`
--
ALTER TABLE `client_forms`
  ADD PRIMARY KEY (`id`),
  ADD KEY `client_forms_created_by_foreign` (`created_by`);

--
-- Index pour la table `client_form_questions`
--
ALTER TABLE `client_form_questions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `client_form_questions_client_form_id_foreign` (`client_form_id`);

--
-- Index pour la table `client_form_requests`
--
ALTER TABLE `client_form_requests`
  ADD PRIMARY KEY (`id`),
  ADD KEY `client_form_requests_client_id_foreign` (`client_id`),
  ADD KEY `client_form_requests_client_form_id_foreign` (`client_form_id`),
  ADD KEY `client_form_requests_requested_by_client_user_id_foreign` (`requested_by_client_user_id`);

--
-- Index pour la table `client_form_request_assignees`
--
ALTER TABLE `client_form_request_assignees`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `cfra_request_user_unique` (`request_id`,`client_user_id`),
  ADD KEY `client_form_request_assignees_client_user_id_foreign` (`client_user_id`);

--
-- Index pour la table `client_form_snapshots`
--
ALTER TABLE `client_form_snapshots`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `cfs_client_snapshot_hash_unique` (`client_id`,`snapshot_hash`),
  ADD KEY `cfs_creator_fk` (`created_by_client_user_id`);

--
-- Index pour la table `client_geo_bricks`
--
ALTER TABLE `client_geo_bricks`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `cgb_unique` (`client_id`,`wilaya_id`,`name`),
  ADD KEY `cgb_client_active_idx` (`client_id`,`is_active`),
  ADD KEY `cgb_wilaya_idx` (`wilaya_id`),
  ADD KEY `client_geo_bricks_created_by_client_user_id_foreign` (`created_by_client_user_id`);

--
-- Index pour la table `client_geo_brick_commune`
--
ALTER TABLE `client_geo_brick_commune`
  ADD PRIMARY KEY (`client_geo_brick_id`,`commune_id`),
  ADD KEY `cgbc_commune_idx` (`commune_id`);

--
-- Index pour la table `client_geo_settings`
--
ALTER TABLE `client_geo_settings`
  ADD PRIMARY KEY (`client_id`);

--
-- Index pour la table `client_geo_zones`
--
ALTER TABLE `client_geo_zones`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `client_geo_zones_client_id_name_unique` (`client_id`,`name`),
  ADD KEY `cgz_client_active_idx` (`client_id`,`is_active`),
  ADD KEY `client_geo_zones_created_by_client_user_id_foreign` (`created_by_client_user_id`);

--
-- Index pour la table `client_geo_zone_wilaya`
--
ALTER TABLE `client_geo_zone_wilaya`
  ADD PRIMARY KEY (`client_geo_zone_id`,`wilaya_id`),
  ADD KEY `cgzw_wilaya_idx` (`wilaya_id`);

--
-- Index pour la table `client_org_groups`
--
ALTER TABLE `client_org_groups`
  ADD PRIMARY KEY (`id`),
  ADD KEY `client_org_groups_org_node_id_foreign` (`org_node_id`),
  ADD KEY `client_org_groups_parent_group_id_foreign` (`parent_group_id`),
  ADD KEY `client_org_groups_client_id_org_node_id_index` (`client_id`,`org_node_id`),
  ADD KEY `client_org_groups_client_id_parent_group_id_index` (`client_id`,`parent_group_id`);

--
-- Index pour la table `client_pf_contact_assignments`
--
ALTER TABLE `client_pf_contact_assignments`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `cpf_contact_assignment_unique` (`client_id`,`organisation_id`,`organisation_node_unit_id`,`entity_type`,`entity_id`),
  ADD KEY `cpf_contact_assignment_entity_idx` (`client_id`,`entity_type`,`entity_id`),
  ADD KEY `client_pf_contact_assignments_organisation_id_foreign` (`organisation_id`),
  ADD KEY `client_pf_contact_assignments_assigned_by_client_user_id_foreign` (`assigned_by_client_user_id`),
  ADD KEY `cpf_contact_assignment_unit_scope_idx` (`client_id`,`organisation_id`,`organisation_node_unit_id`),
  ADD KEY `client_pf_contact_assignments_organisation_node_unit_id_foreign` (`organisation_node_unit_id`);

--
-- Index pour la table `client_pf_imports`
--
ALTER TABLE `client_pf_imports`
  ADD PRIMARY KEY (`id`),
  ADD KEY `cpf_import_client_type_idx` (`client_id`,`entity_type`),
  ADD KEY `cpf_import_status_idx` (`status`),
  ADD KEY `client_pf_imports_uploaded_by_client_user_id_foreign` (`uploaded_by_client_user_id`);

--
-- Index pour la table `client_pf_import_rows`
--
ALTER TABLE `client_pf_import_rows`
  ADD PRIMARY KEY (`id`),
  ADD KEY `cpf_row_import_idx` (`import_id`),
  ADD KEY `cpf_row_status_idx` (`match_status`),
  ADD KEY `cpf_row_decision_idx` (`admin_decision`),
  ADD KEY `client_pf_import_rows_decided_by_admin_id_foreign` (`decided_by_admin_id`),
  ADD KEY `cpf_row_entity_type_idx` (`entity_type`);

--
-- Index pour la table `client_pf_memberships`
--
ALTER TABLE `client_pf_memberships`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `cpf_membership_unique` (`client_id`,`entity_type`,`entity_id`),
  ADD KEY `cpf_membership_client_type_idx` (`client_id`,`entity_type`),
  ADD KEY `cpf_membership_entity_idx` (`entity_type`,`entity_id`),
  ADD KEY `client_pf_memberships_source_import_id_foreign` (`source_import_id`),
  ADD KEY `client_pf_memberships_created_by_client_user_id_foreign` (`created_by_client_user_id`),
  ADD KEY `cpf_membership_freq_idx` (`client_id`,`entity_type`,`frequence`);

--
-- Index pour la table `client_portal_impact_notifications`
--
ALTER TABLE `client_portal_impact_notifications`
  ADD PRIMARY KEY (`id`),
  ADD KEY `cp_impact_notif_user_read_idx` (`target_client_user_id`,`read_at`),
  ADD KEY `cp_impact_notif_client_created_idx` (`client_id`,`created_at`);

--
-- Index pour la table `client_roles`
--
ALTER TABLE `client_roles`
  ADD PRIMARY KEY (`id`),
  ADD KEY `client_roles_org_node_id_index` (`org_node_id`);

--
-- Index pour la table `client_territories`
--
ALTER TABLE `client_territories`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `ct_client_name_unique` (`client_id`,`name`),
  ADD KEY `ct_client_idx` (`client_id`);

--
-- Index pour la table `client_territory_bricks`
--
ALTER TABLE `client_territory_bricks`
  ADD PRIMARY KEY (`client_territory_id`,`client_geo_brick_id`),
  ADD KEY `client_territory_bricks_client_geo_brick_id_foreign` (`client_geo_brick_id`);

--
-- Index pour la table `client_territory_communes`
--
ALTER TABLE `client_territory_communes`
  ADD PRIMARY KEY (`client_territory_id`,`commune_id`),
  ADD KEY `ctc_commune_idx` (`commune_id`);

--
-- Index pour la table `client_territory_wilayas`
--
ALTER TABLE `client_territory_wilayas`
  ADD PRIMARY KEY (`client_territory_id`,`wilaya_id`),
  ADD KEY `ctw_wilaya_idx` (`wilaya_id`);

--
-- Index pour la table `client_territory_zones`
--
ALTER TABLE `client_territory_zones`
  ADD PRIMARY KEY (`client_territory_id`,`client_geo_zone_id`),
  ADD KEY `client_territory_zones_client_geo_zone_id_foreign` (`client_geo_zone_id`);

--
-- Index pour la table `client_users`
--
ALTER TABLE `client_users`
  ADD PRIMARY KEY (`id`),
  ADD KEY `client_users_client_id_foreign` (`client_id`),
  ADD KEY `client_users_client_role_id_foreign` (`client_role_id`),
  ADD KEY `client_users_invite_token_index` (`invite_token`);

--
-- Index pour la table `client_user_organisations`
--
ALTER TABLE `client_user_organisations`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `cuo_user_org_node_unit_uidx` (`client_user_id`,`organisation_id`,`organisation_node_id`,`organisation_node_unit_id`),
  ADD KEY `client_user_organisations_organisation_node_id_foreign` (`organisation_node_id`),
  ADD KEY `cuo_org_node_idx` (`organisation_id`,`organisation_node_id`),
  ADD KEY `client_user_organisations_organisation_node_unit_id_foreign` (`organisation_node_unit_id`),
  ADD KEY `cuo_invitation_token_idx` (`invitation_token`),
  ADD KEY `cuo_user_org_idx` (`client_user_id`,`organisation_id`),
  ADD KEY `client_user_organisations_substitute_client_user_id_foreign` (`substitute_client_user_id`),
  ADD KEY `client_user_organisations_covers_assignment_id_foreign` (`covers_assignment_id`);

--
-- Index pour la table `client_user_org_groups`
--
ALTER TABLE `client_user_org_groups`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `client_user_org_groups_client_user_id_unique` (`client_user_id`),
  ADD KEY `client_user_org_groups_client_org_group_id_index` (`client_org_group_id`);

--
-- Index pour la table `client_user_org_nodes`
--
ALTER TABLE `client_user_org_nodes`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `client_user_org_nodes_client_user_id_org_node_id_unique` (`client_user_id`,`org_node_id`),
  ADD KEY `client_user_org_nodes_org_node_id_index` (`org_node_id`);

--
-- Index pour la table `client_user_org_replacement_schedules`
--
ALTER TABLE `client_user_org_replacement_schedules`
  ADD PRIMARY KEY (`id`),
  ADD KEY `cuo_repl_sched_applied_apply_idx` (`applied_at`,`apply_at`);

--
-- Index pour la table `client_user_portal_activity_logs`
--
ALTER TABLE `client_user_portal_activity_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `client_user_portal_activity_logs_actor_client_user_id_foreign` (`actor_client_user_id`),
  ADD KEY `cup_activity_client_occurred_idx` (`client_user_id`,`occurred_at`);

--
-- Index pour la table `client_user_territories`
--
ALTER TABLE `client_user_territories`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `cut_user_commune_unique` (`client_user_id`,`commune_id`),
  ADD KEY `cut_commune_idx` (`commune_id`);

--
-- Index pour la table `coaching_entries`
--
ALTER TABLE `coaching_entries`
  ADD PRIMARY KEY (`id`),
  ADD KEY `coaching_entries_user_status_idx` (`client_user_id`,`status`),
  ADD KEY `coaching_entries_scope_form_idx` (`zone_scope_id`,`zone_scope_target_form_id`),
  ADD KEY `coaching_entries_nodes_idx` (`organisation_node_id`,`coached_organisation_node_id`),
  ADD KEY `coaching_entries_organisation_node_unit_id_index` (`organisation_node_unit_id`);

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

--
-- Index pour la table `cycle_plans`
--
ALTER TABLE `cycle_plans`
  ADD PRIMARY KEY (`id`),
  ADD KEY `cycle_plans_client_id_start_date_index` (`client_id`,`start_date`);

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

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

--
-- Index pour la table `distributeurs`
--
ALTER TABLE `distributeurs`
  ADD PRIMARY KEY (`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 `goal_types`
--
ALTER TABLE `goal_types`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `goal_types_code_unique` (`code`),
  ADD KEY `goal_types_code_index` (`code`);

--
-- Index pour la table `goal_type_units`
--
ALTER TABLE `goal_type_units`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `goal_type_unit_unique` (`goal_type_id`,`goal_unit_id`),
  ADD KEY `goal_type_units_goal_unit_id_foreign` (`goal_unit_id`);

--
-- Index pour la table `goal_units`
--
ALTER TABLE `goal_units`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `goal_units_code_unique` (`code`),
  ADD KEY `goal_units_code_index` (`code`);

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

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

--
-- Index pour la table `kol_entries`
--
ALTER TABLE `kol_entries`
  ADD PRIMARY KEY (`id`),
  ADD KEY `kol_entries_user_validated_idx` (`client_user_id`,`validated_at`),
  ADD KEY `kol_entries_scope_target_idx` (`zone_scope_id`,`target_key`),
  ADD KEY `kol_entries_organisation_node_id_index` (`organisation_node_id`),
  ADD KEY `kol_entries_organisation_node_unit_id_index` (`organisation_node_unit_id`);

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

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

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

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

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

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

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

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

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

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

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

--
-- Index pour la table `organisations`
--
ALTER TABLE `organisations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `org_client_idx` (`client_id`),
  ADD KEY `organisations_supreme_parent_node_id_foreign` (`supreme_parent_node_id`);

--
-- Index pour la table `organisation_absences`
--
ALTER TABLE `organisation_absences`
  ADD PRIMARY KEY (`id`),
  ADD KEY `organisation_absences_organisation_evenement_id_foreign` (`organisation_evenement_id`),
  ADD KEY `organisation_absences_organisation_id_starts_at_index` (`organisation_id`,`starts_at`),
  ADD KEY `organisation_absences_created_by_client_user_id_starts_at_index` (`created_by_client_user_id`,`starts_at`);

--
-- Index pour la table `organisation_admins`
--
ALTER TABLE `organisation_admins`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `organisation_admins_organisation_id_admin_id_unique` (`organisation_id`,`admin_id`),
  ADD KEY `organisation_admins_admin_id_foreign` (`admin_id`);

--
-- Index pour la table `organisation_cible_parent_assignments`
--
ALTER TABLE `organisation_cible_parent_assignments`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `ocpa_org_cible_node_unique` (`organisation_id`,`cible`,`organisation_node_id`);

--
-- Index pour la table `organisation_evenements`
--
ALTER TABLE `organisation_evenements`
  ADD PRIMARY KEY (`id`),
  ADD KEY `organisation_evenements_created_by_client_user_id_foreign` (`created_by_client_user_id`),
  ADD KEY `organisation_evenements_superviseur_client_user_id_foreign` (`superviseur_client_user_id`),
  ADD KEY `organisation_evenements_client_form_id_foreign` (`client_form_id`),
  ADD KEY `organisation_evenements_organisation_id_starts_at_index` (`organisation_id`,`starts_at`);

--
-- Index pour la table `organisation_evenement_declarations`
--
ALTER TABLE `organisation_evenement_declarations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `oed_created_by_fk` (`created_by_client_user_id`),
  ADD KEY `oed_approved_by_fk` (`approved_by_client_user_id`),
  ADD KEY `oed_org_starts_idx` (`organisation_id`,`starts_at`),
  ADD KEY `oed_evt_starts_idx` (`organisation_evenement_id`,`starts_at`);

--
-- Index pour la table `organisation_geo_bricks`
--
ALTER TABLE `organisation_geo_bricks`
  ADD PRIMARY KEY (`id`),
  ADD KEY `organisation_geo_bricks_organisation_id_wilaya_id_index` (`organisation_id`,`wilaya_id`),
  ADD KEY `organisation_geo_bricks_wilaya_id_index` (`wilaya_id`);

--
-- Index pour la table `organisation_geo_brick_commune`
--
ALTER TABLE `organisation_geo_brick_commune`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `org_brick_commune_unique` (`organisation_geo_brick_id`,`commune_id`),
  ADD KEY `organisation_geo_brick_commune_commune_id_foreign` (`commune_id`);

--
-- Index pour la table `organisation_geo_zones`
--
ALTER TABLE `organisation_geo_zones`
  ADD PRIMARY KEY (`id`),
  ADD KEY `organisation_geo_zones_organisation_id_index` (`organisation_id`);

--
-- Index pour la table `organisation_geo_zone_wilaya`
--
ALTER TABLE `organisation_geo_zone_wilaya`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `org_zone_wilaya_unique` (`organisation_geo_zone_id`,`wilaya_id`),
  ADD KEY `organisation_geo_zone_wilaya_wilaya_id_index` (`wilaya_id`);

--
-- Index pour la table `organisation_links`
--
ALTER TABLE `organisation_links`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `ol_org_linked_unique` (`organisation_id`,`linked_organisation_id`),
  ADD KEY `ol_linked_idx` (`linked_organisation_id`);

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

--
-- Index pour la table `organisation_modification_sessions`
--
ALTER TABLE `organisation_modification_sessions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `organisation_modification_sessions_organisation_id_status_index` (`organisation_id`,`status`),
  ADD KEY `org_mod_sess_user_fk` (`initiated_by_client_user_id`);

--
-- Index pour la table `organisation_nodes`
--
ALTER TABLE `organisation_nodes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `on_org_parent_idx` (`organisation_id`,`parent_id`),
  ADD KEY `organisation_nodes_parent_id_foreign` (`parent_id`),
  ADD KEY `organisation_nodes_org_node_id_foreign` (`org_node_id`),
  ADD KEY `on_catalog_source_idx` (`catalog_source_org_node_id`);

--
-- Index pour la table `organisation_node_parents`
--
ALTER TABLE `organisation_node_parents`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `onp_node_parent_unique` (`organisation_node_id`,`parent_organisation_node_id`),
  ADD KEY `organisation_node_parents_parent_organisation_node_id_foreign` (`parent_organisation_node_id`);

--
-- Index pour la table `organisation_node_units`
--
ALTER TABLE `organisation_node_units`
  ADD PRIMARY KEY (`id`),
  ADD KEY `onu_node_sort_idx` (`organisation_node_id`,`sort_order`),
  ADD KEY `organisation_node_units_parent_organisation_node_id_foreign` (`parent_organisation_node_id`),
  ADD KEY `organisation_node_units_parent_organisation_node_unit_id_foreign` (`parent_organisation_node_unit_id`);

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

--
-- Index pour la table `organisation_node_user_territories`
--
ALTER TABLE `organisation_node_user_territories`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `onut_node_user_commune_cible_unique` (`organisation_node_id`,`client_user_id`,`commune_id`,`cible`),
  ADD KEY `organisation_node_user_territories_client_user_id_foreign` (`client_user_id`),
  ADD KEY `organisation_node_user_territories_commune_id_foreign` (`commune_id`);

--
-- Index pour la table `organisation_terrain_unit_snapshots`
--
ALTER TABLE `organisation_terrain_unit_snapshots`
  ADD PRIMARY KEY (`id`),
  ADD KEY `organisation_terrain_unit_snapshots_organisation_id_foreign` (`organisation_id`);

--
-- Index pour la table `organisation_territories`
--
ALTER TABLE `organisation_territories`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `ot_org_commune_unique` (`organisation_id`,`commune_id`),
  ADD KEY `ot_commune_idx` (`commune_id`);

--
-- Index pour la table `organisation_territory_assignments`
--
ALTER TABLE `organisation_territory_assignments`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `ota_org_territory_unique` (`organisation_id`,`client_territory_id`),
  ADD KEY `organisation_territory_assignments_client_territory_id_foreign` (`client_territory_id`);

--
-- Index pour la table `organisation_territory_coverage_notes`
--
ALTER TABLE `organisation_territory_coverage_notes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `organisation_territory_coverage_notes_organisation_id_foreign` (`organisation_id`);

--
-- Index pour la table `organisation_territory_repartitions`
--
ALTER TABLE `organisation_territory_repartitions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `otr_org_commune_cible_unique` (`organisation_id`,`commune_id`,`cible`),
  ADD KEY `organisation_territory_repartitions_organisation_node_id_foreign` (`organisation_node_id`),
  ADD KEY `organisation_territory_repartitions_commune_id_foreign` (`commune_id`),
  ADD KEY `otr_org_cible_idx` (`organisation_id`,`cible`);

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

--
-- Index pour la table `org_evt_internal_users`
--
ALTER TABLE `org_evt_internal_users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `org_evt_int_uq` (`organisation_evenement_id`,`client_user_id`),
  ADD KEY `org_evt_int_cu_fk` (`client_user_id`);

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

--
-- Index pour la table `org_nodes`
--
ALTER TABLE `org_nodes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `org_nodes_name_index` (`name`);

--
-- Index pour la table `org_node_client_roles`
--
ALTER TABLE `org_node_client_roles`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `org_node_client_roles_org_node_id_client_role_id_unique` (`org_node_id`,`client_role_id`),
  ADD KEY `org_node_client_roles_client_role_id_index` (`client_role_id`);

--
-- Index pour la table `org_node_edges`
--
ALTER TABLE `org_node_edges`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `org_node_edges_parent_node_id_child_node_id_unique` (`parent_node_id`,`child_node_id`),
  ADD KEY `org_node_edges_child_node_id_foreign` (`child_node_id`);

--
-- Index pour la table `org_node_org_functional_group`
--
ALTER TABLE `org_node_org_functional_group`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `org_node_func_grp_unique` (`org_node_id`,`org_functional_group_id`),
  ADD KEY `org_node_org_functional_group_org_functional_group_id_foreign` (`org_functional_group_id`);

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

--
-- Index pour la table `password_resets`
--
ALTER TABLE `password_resets`
  ADD KEY `password_resets_email_index` (`email`);

--
-- Index pour la table `password_reset_tokens`
--
ALTER TABLE `password_reset_tokens`
  ADD PRIMARY KEY (`email`);

--
-- Index pour la table `personal_access_tokens`
--
ALTER TABLE `personal_access_tokens`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `personal_access_tokens_token_unique` (`token`),
  ADD KEY `personal_access_tokens_tokenable_type_tokenable_id_index` (`tokenable_type`,`tokenable_id`);

--
-- Index pour la table `planned_visits`
--
ALTER TABLE `planned_visits`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `pv_unique_month_slot_entity` (`client_id`,`organisation_id`,`organisation_node_unit_id`,`client_user_id`,`program_month`,`week_index`,`weekday`,`entity_type`,`entity_id`),
  ADD KEY `pv_user_date_idx` (`client_id`,`client_user_id`,`scheduled_date`),
  ADD KEY `pv_unit_idx` (`client_id`,`organisation_id`,`organisation_node_unit_id`),
  ADD KEY `pv_entity_idx` (`entity_type`,`entity_id`),
  ADD KEY `planned_visits_organisation_id_foreign` (`organisation_id`),
  ADD KEY `planned_visits_organisation_node_unit_id_foreign` (`organisation_node_unit_id`),
  ADD KEY `planned_visits_client_user_id_foreign` (`client_user_id`);

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

--
-- Index pour la table `platform_country_admin_units`
--
ALTER TABLE `platform_country_admin_units`
  ADD PRIMARY KEY (`id`),
  ADD KEY `platform_country_admin_units_geo_import_id_foreign` (`geo_import_id`),
  ADD KEY `pc_admin_units_country_level_idx` (`platform_country_id`,`admin_level`),
  ADD KEY `pc_admin_units_parent_idx` (`parent_id`);

--
-- Index pour la table `platform_country_admin_unit_translations`
--
ALTER TABLE `platform_country_admin_unit_translations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `pc_admin_unit_trans_unit_locale_idx` (`admin_unit_id`,`locale`);

--
-- Index pour la table `platform_country_geo_imports`
--
ALTER TABLE `platform_country_geo_imports`
  ADD PRIMARY KEY (`id`),
  ADD KEY `pc_geo_imports_country_idx` (`platform_country_id`);

--
-- Index pour la table `platform_country_geo_import_level_stats`
--
ALTER TABLE `platform_country_geo_import_level_stats`
  ADD PRIMARY KEY (`id`),
  ADD KEY `pc_geo_level_stats_import_level_idx` (`geo_import_id`,`admin_level`);

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

--
-- Index pour la table `products`
--
ALTER TABLE `products`
  ADD PRIMARY KEY (`id`),
  ADD KEY `products_created_by_client_user_id_foreign` (`created_by_client_user_id`);

--
-- Index pour la table `product_lots`
--
ALTER TABLE `product_lots`
  ADD PRIMARY KEY (`id`),
  ADD KEY `product_lot_product_active_idx` (`product_id`,`is_active`);

--
-- Index pour la table `product_presentations`
--
ALTER TABLE `product_presentations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `product_presentations_product_id_foreign` (`product_id`),
  ADD KEY `product_presentations_created_by_client_user_id_foreign` (`created_by_client_user_id`),
  ADD KEY `product_presentations_reviewed_by_client_user_id_foreign` (`reviewed_by_client_user_id`),
  ADD KEY `product_presentations_client_id_product_id_index` (`client_id`,`product_id`),
  ADD KEY `product_presentations_client_id_status_index` (`client_id`,`status`),
  ADD KEY `product_presentations_request_id_index` (`request_id`);

--
-- Index pour la table `product_presentation_requests`
--
ALTER TABLE `product_presentation_requests`
  ADD PRIMARY KEY (`id`),
  ADD KEY `product_presentation_requests_client_id_foreign` (`client_id`),
  ADD KEY `product_presentation_requests_product_id_foreign` (`product_id`);

--
-- Index pour la table `product_presentation_request_assignees`
--
ALTER TABLE `product_presentation_request_assignees`
  ADD PRIMARY KEY (`id`),
  ADD KEY `product_presentation_request_assignees_request_id_foreign` (`request_id`),
  ADD KEY `product_presentation_request_assignees_client_user_id_foreign` (`client_user_id`);

--
-- Index pour la table `product_presentation_views`
--
ALTER TABLE `product_presentation_views`
  ADD PRIMARY KEY (`id`),
  ADD KEY `product_presentation_views_client_user_id_foreign` (`client_user_id`),
  ADD KEY `product_presentation_views_presentation_id_client_user_id_index` (`presentation_id`,`client_user_id`),
  ADD KEY `product_presentation_views_presentation_id_slide_index_index` (`presentation_id`,`slide_index`);

--
-- Index pour la table `professions`
--
ALTER TABLE `professions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `professions_name_type_unique` (`name`,`type`),
  ADD KEY `professions_type_index` (`type`);

--
-- Index pour la table `reseau_favorites`
--
ALTER TABLE `reseau_favorites`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `reseau_fav_unique` (`client_id`,`organisation_id`,`organisation_node_unit_id`,`client_user_id`,`entity_type`,`entity_id`),
  ADD KEY `reseau_fav_user_idx` (`client_id`,`client_user_id`),
  ADD KEY `reseau_fav_unit_idx` (`client_id`,`organisation_id`,`organisation_node_unit_id`),
  ADD KEY `reseau_fav_entity_idx` (`entity_type`,`entity_id`),
  ADD KEY `reseau_favorites_organisation_id_foreign` (`organisation_id`),
  ADD KEY `reseau_favorites_organisation_node_unit_id_foreign` (`organisation_node_unit_id`),
  ADD KEY `reseau_favorites_client_user_id_foreign` (`client_user_id`);

--
-- Index pour la table `roles`
--
ALTER TABLE `roles`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `roles_name_unique` (`name`);

--
-- Index pour la table `scope_assignments`
--
ALTER TABLE `scope_assignments`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `scope_assignments_scope_user_target_zone_unique` (`zone_scope_id`,`client_user_id`,`target_type`,`zone_id`),
  ADD KEY `scope_assignments_zone_id_foreign` (`zone_id`),
  ADD KEY `scope_assignments_client_user_id_foreign` (`client_user_id`);

--
-- Index pour la table `sessions`
--
ALTER TABLE `sessions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sessions_user_id_index` (`user_id`),
  ADD KEY `sessions_last_activity_index` (`last_activity`);

--
-- Index pour la table `simple_report_entries`
--
ALTER TABLE `simple_report_entries`
  ADD PRIMARY KEY (`id`),
  ADD KEY `simple_report_entries_client_id_index` (`client_id`),
  ADD KEY `simple_report_entries_organisation_id_index` (`organisation_id`),
  ADD KEY `simple_report_entries_zone_scope_id_index` (`zone_scope_id`),
  ADD KEY `simple_report_entries_zone_scope_target_form_id_index` (`zone_scope_target_form_id`),
  ADD KEY `simple_report_entries_client_form_snapshot_id_index` (`client_form_snapshot_id`),
  ADD KEY `simple_report_entries_organisation_node_id_index` (`organisation_node_id`),
  ADD KEY `simple_report_entries_client_user_id_index` (`client_user_id`),
  ADD KEY `simple_report_entries_status_index` (`status`),
  ADD KEY `simple_report_entries_organisation_node_unit_id_index` (`organisation_node_unit_id`);

--
-- Index pour la table `sondages`
--
ALTER TABLE `sondages`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sondages_created_by_foreign` (`created_by`);

--
-- Index pour la table `sondage_questions`
--
ALTER TABLE `sondage_questions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sondage_questions_sondage_id_foreign` (`sondage_id`);

--
-- Index pour la table `specialities`
--
ALTER TABLE `specialities`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `specialities_name_profession_id_unique` (`name`,`profession_id`),
  ADD KEY `specialities_profession_id_foreign` (`profession_id`),
  ADD KEY `specialities_type_index` (`type`);

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

--
-- Index pour la table `support_tickets`
--
ALTER TABLE `support_tickets`
  ADD PRIMARY KEY (`id`),
  ADD KEY `support_tickets_client_user_id_foreign` (`client_user_id`),
  ADD KEY `support_tickets_assigned_admin_id_foreign` (`assigned_admin_id`),
  ADD KEY `support_tickets_client_id_status_index` (`client_id`,`status`),
  ADD KEY `support_tickets_created_at_index` (`created_at`);

--
-- Index pour la table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `users_email_unique` (`email`);

--
-- Index pour la table `visites_associations_patients`
--
ALTER TABLE `visites_associations_patients`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_client_org_idx` (`client_id`,`organisation_id`),
  ADD KEY `visit_scope_status_idx` (`zone_scope_id`,`status`),
  ADD KEY `visit_user_status_idx` (`client_user_id`,`status`),
  ADD KEY `visit_target_idx` (`target_table`,`target_id`);

--
-- Index pour la table `visites_centrales_achat`
--
ALTER TABLE `visites_centrales_achat`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_client_org_idx` (`client_id`,`organisation_id`),
  ADD KEY `visit_scope_status_idx` (`zone_scope_id`,`status`),
  ADD KEY `visit_user_status_idx` (`client_user_id`,`status`),
  ADD KEY `visit_target_idx` (`target_table`,`target_id`);

--
-- Index pour la table `visites_dispensateurs`
--
ALTER TABLE `visites_dispensateurs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_client_org_idx` (`client_id`,`organisation_id`),
  ADD KEY `visit_scope_status_idx` (`zone_scope_id`,`status`),
  ADD KEY `visit_user_status_idx` (`client_user_id`,`status`),
  ADD KEY `visit_target_idx` (`target_table`,`target_id`);

--
-- Index pour la table `visites_distributeurs`
--
ALTER TABLE `visites_distributeurs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_client_org_idx` (`client_id`,`organisation_id`),
  ADD KEY `visit_scope_status_idx` (`zone_scope_id`,`status`),
  ADD KEY `visit_user_status_idx` (`client_user_id`,`status`),
  ADD KEY `visit_target_idx` (`target_table`,`target_id`);

--
-- Index pour la table `visites_influenceurs_decideurs`
--
ALTER TABLE `visites_influenceurs_decideurs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_client_org_idx` (`client_id`,`organisation_id`),
  ADD KEY `visit_scope_status_idx` (`zone_scope_id`,`status`),
  ADD KEY `visit_user_status_idx` (`client_user_id`,`status`),
  ADD KEY `visit_target_idx` (`target_table`,`target_id`);

--
-- Index pour la table `visites_institutions_sante`
--
ALTER TABLE `visites_institutions_sante`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_client_org_idx` (`client_id`,`organisation_id`),
  ADD KEY `visit_scope_status_idx` (`zone_scope_id`,`status`),
  ADD KEY `visit_user_status_idx` (`client_user_id`,`status`),
  ADD KEY `visit_target_idx` (`target_table`,`target_id`);

--
-- Index pour la table `visites_organismes_formation_medicale`
--
ALTER TABLE `visites_organismes_formation_medicale`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_client_org_idx` (`client_id`,`organisation_id`),
  ADD KEY `visit_scope_status_idx` (`zone_scope_id`,`status`),
  ADD KEY `visit_user_status_idx` (`client_user_id`,`status`),
  ADD KEY `visit_target_idx` (`target_table`,`target_id`);

--
-- Index pour la table `visites_partenaires_commerciaux`
--
ALTER TABLE `visites_partenaires_commerciaux`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_client_org_idx` (`client_id`,`organisation_id`),
  ADD KEY `visit_scope_status_idx` (`zone_scope_id`,`status`),
  ADD KEY `visit_user_status_idx` (`client_user_id`,`status`),
  ADD KEY `visit_target_idx` (`target_table`,`target_id`);

--
-- Index pour la table `visites_prescripteurs`
--
ALTER TABLE `visites_prescripteurs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_client_org_idx` (`client_id`,`organisation_id`),
  ADD KEY `visit_scope_status_idx` (`zone_scope_id`,`status`),
  ADD KEY `visit_user_status_idx` (`client_user_id`,`status`),
  ADD KEY `visit_target_idx` (`target_table`,`target_id`);

--
-- Index pour la table `visites_structures_soins`
--
ALTER TABLE `visites_structures_soins`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_client_org_idx` (`client_id`,`organisation_id`),
  ADD KEY `visit_scope_status_idx` (`zone_scope_id`,`status`),
  ADD KEY `visit_user_status_idx` (`client_user_id`,`status`),
  ADD KEY `visit_target_idx` (`target_table`,`target_id`);

--
-- Index pour la table `visit_commandes`
--
ALTER TABLE `visit_commandes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_commande_visit_idx` (`org_target_key`,`visit_id`);

--
-- Index pour la table `visit_commande_lines`
--
ALTER TABLE `visit_commande_lines`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_commande_line_parent_idx` (`visit_commande_id`);

--
-- Index pour la table `visit_commande_status_events`
--
ALTER TABLE `visit_commande_status_events`
  ADD PRIMARY KEY (`id`),
  ADD KEY `vcse_commande_id_idx` (`visit_commande_id`,`id`),
  ADD KEY `vcse_created_idx` (`created_at`);

--
-- Index pour la table `visit_form_answers`
--
ALTER TABLE `visit_form_answers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_form_answer_visit_idx` (`org_target_key`,`visit_id`),
  ADD KEY `visit_form_answer_product_idx` (`visit_id`,`product_id`);

--
-- Index pour la table `visit_gps_logs`
--
ALTER TABLE `visit_gps_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_gps_visit_idx` (`org_target_key`,`visit_id`),
  ADD KEY `visit_gps_target_idx` (`target_table`,`target_id`);

--
-- Index pour la table `visit_presentations`
--
ALTER TABLE `visit_presentations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_presentation_visit_idx` (`org_target_key`,`visit_id`),
  ADD KEY `visit_presentation_product_idx` (`product_id`);

--
-- Index pour la table `visit_presentation_slides`
--
ALTER TABLE `visit_presentation_slides`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_slide_idx` (`visit_presentation_id`,`slide_index`);

--
-- Index pour la table `visit_proofs`
--
ALTER TABLE `visit_proofs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_proof_visit_idx` (`org_target_key`,`visit_id`);

--
-- Index pour la table `visit_purchases`
--
ALTER TABLE `visit_purchases`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_purchase_visit_idx` (`org_target_key`,`visit_id`);

--
-- Index pour la table `visit_purchase_lines`
--
ALTER TABLE `visit_purchase_lines`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_purchase_line_purchase_idx` (`visit_purchase_id`);

--
-- Index pour la table `visit_sales`
--
ALTER TABLE `visit_sales`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_sale_visit_idx` (`org_target_key`,`visit_id`);

--
-- Index pour la table `visit_sale_lines`
--
ALTER TABLE `visit_sale_lines`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_sale_line_sale_idx` (`visit_sale_id`);

--
-- Index pour la table `visit_stock_history`
--
ALTER TABLE `visit_stock_history`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_stock_hist_lookup_idx` (`org_target_key`,`visit_id`,`product_id`);

--
-- Index pour la table `visit_stock_lines`
--
ALTER TABLE `visit_stock_lines`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `visit_stock_line_unique` (`org_target_key`,`visit_id`,`product_id`),
  ADD KEY `visit_stock_visit_idx` (`org_target_key`,`visit_id`);

--
-- Index pour la table `visit_survey_answers`
--
ALTER TABLE `visit_survey_answers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `visit_survey_answer_visit_idx` (`org_target_key`,`visit_id`);

--
-- Index pour la table `whatsapp_sessions`
--
ALTER TABLE `whatsapp_sessions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `whatsapp_sessions_session_id_unique` (`session_id`);

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

--
-- Index pour la table `zones`
--
ALTER TABLE `zones`
  ADD PRIMARY KEY (`id`),
  ADD KEY `zones_client_id_foreign` (`client_id`),
  ADD KEY `zones_created_by_admin_id_foreign` (`created_by_admin_id`),
  ADD KEY `zones_created_by_client_user_id_foreign` (`created_by_client_user_id`),
  ADD KEY `zones_org_node_id_foreign` (`org_node_id`),
  ADD KEY `zones_parent_zone_id_foreign` (`parent_zone_id`),
  ADD KEY `zones_owner_group_id_foreign` (`owner_group_id`),
  ADD KEY `zones_scope_id_foreign` (`scope_id`);

--
-- Index pour la table `zone_attributions`
--
ALTER TABLE `zone_attributions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `zone_attributions_zone_id_group_id_unique` (`zone_id`,`group_id`),
  ADD KEY `zone_attributions_group_id_foreign` (`group_id`),
  ADD KEY `zone_attributions_scope_id_foreign` (`scope_id`),
  ADD KEY `zone_attributions_proposed_by_client_user_id_foreign` (`proposed_by_client_user_id`),
  ADD KEY `zone_attributions_approved_by_client_user_id_foreign` (`approved_by_client_user_id`),
  ADD KEY `zone_attributions_rejected_by_client_user_id_foreign` (`rejected_by_client_user_id`),
  ADD KEY `zone_attributions_revoked_by_client_user_id_foreign` (`revoked_by_client_user_id`);

--
-- Index pour la table `zone_commune`
--
ALTER TABLE `zone_commune`
  ADD PRIMARY KEY (`zone_id`,`commune_id`),
  ADD KEY `zone_commune_commune_id_foreign` (`commune_id`);

--
-- Index pour la table `zone_conflicts`
--
ALTER TABLE `zone_conflicts`
  ADD PRIMARY KEY (`id`),
  ADD KEY `zone_conflicts_client_id_foreign` (`client_id`),
  ADD KEY `zone_conflicts_zone_id_foreign` (`zone_id`),
  ADD KEY `zone_conflicts_scope_id_foreign` (`scope_id`),
  ADD KEY `zone_conflicts_resolved_by_client_user_id_foreign` (`resolved_by_client_user_id`);

--
-- Index pour la table `zone_history`
--
ALTER TABLE `zone_history`
  ADD PRIMARY KEY (`id`),
  ADD KEY `zone_history_client_id_foreign` (`client_id`),
  ADD KEY `zone_history_zone_id_foreign` (`zone_id`);

--
-- Index pour la table `zone_product`
--
ALTER TABLE `zone_product`
  ADD PRIMARY KEY (`zone_id`,`product_id`),
  ADD KEY `zone_product_product_id_foreign` (`product_id`);

--
-- Index pour la table `zone_scopes`
--
ALTER TABLE `zone_scopes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `zone_scopes_product_id_foreign` (`product_id`),
  ADD KEY `zone_scopes_parent_scope_id_foreign` (`parent_scope_id`),
  ADD KEY `zone_scopes_created_by_client_user_id_foreign` (`created_by_client_user_id`),
  ADD KEY `zone_scopes_zone_scope_type_id_foreign` (`zone_scope_type_id`),
  ADD KEY `zs_client_type_idx` (`client_id`,`zone_scope_type_id`),
  ADD KEY `zone_scopes_cycle_plan_id_foreign` (`cycle_plan_id`),
  ADD KEY `zone_scopes_organisation_id_foreign` (`organisation_id`);

--
-- Index pour la table `zone_scope_goals`
--
ALTER TABLE `zone_scope_goals`
  ADD PRIMARY KEY (`id`),
  ADD KEY `zone_scope_goals_product_id_foreign` (`product_id`),
  ADD KEY `zone_scope_goals_zone_id_foreign` (`zone_id`),
  ADD KEY `zone_scope_goals_assigned_role_id_foreign` (`assigned_role_id`),
  ADD KEY `zone_scope_goals_assigned_user_id_foreign` (`assigned_user_id`),
  ADD KEY `zone_scope_goals_zone_scope_id_goal_type_index` (`zone_scope_id`,`goal_type`),
  ADD KEY `zone_scope_goals_zone_scope_id_target_type_index` (`zone_scope_id`,`target_type`),
  ADD KEY `zone_scope_goals_zone_scope_id_product_id_index` (`zone_scope_id`,`product_id`),
  ADD KEY `zone_scope_goals_zone_scope_id_zone_id_index` (`zone_scope_id`,`zone_id`),
  ADD KEY `zone_scope_goals_zone_scope_id_assigned_role_id_index` (`zone_scope_id`,`assigned_role_id`),
  ADD KEY `zone_scope_goals_zone_scope_id_assigned_user_id_index` (`zone_scope_id`,`assigned_user_id`),
  ADD KEY `zone_scope_goals_zone_scope_id_period_type_index` (`zone_scope_id`,`period_type`),
  ADD KEY `zsg_scope_objective_idx` (`zone_scope_id`,`objective_code`),
  ADD KEY `zsg_scope_post_idx` (`zone_scope_id`,`organisation_node_id`),
  ADD KEY `zsg_scope_target_key_idx` (`zone_scope_id`,`target_key`);

--
-- Index pour la table `zone_scope_product`
--
ALTER TABLE `zone_scope_product`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `zone_scope_product_zone_scope_id_product_id_unique` (`zone_scope_id`,`product_id`),
  ADD KEY `zone_scope_product_product_id_foreign` (`product_id`);

--
-- Index pour la table `zone_scope_product_presentation`
--
ALTER TABLE `zone_scope_product_presentation`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `zsp_pres_unique` (`zone_scope_id`,`product_id`,`product_presentation_id`),
  ADD KEY `zone_scope_product_presentation_product_presentation_id_foreign` (`product_presentation_id`),
  ADD KEY `zsp_scope_product_idx` (`zone_scope_id`,`product_id`),
  ADD KEY `zsp_product_pres_idx` (`product_id`,`product_presentation_id`);

--
-- Index pour la table `zone_scope_realisateurs`
--
ALTER TABLE `zone_scope_realisateurs`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `zone_scope_realisateurs_zone_scope_id_target_key_unique` (`zone_scope_id`,`target_key`),
  ADD KEY `zone_scope_realisateurs_zone_id_foreign` (`zone_id`);

--
-- Index pour la table `zone_scope_snapshots`
--
ALTER TABLE `zone_scope_snapshots`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `zone_scope_snapshots_zone_scope_id_unique` (`zone_scope_id`);

--
-- Index pour la table `zone_scope_snapshot_forms`
--
ALTER TABLE `zone_scope_snapshot_forms`
  ADD PRIMARY KEY (`id`),
  ADD KEY `zss_forms_snapshot_fk` (`zone_scope_snapshot_id`);

--
-- Index pour la table `zone_scope_snapshot_goals`
--
ALTER TABLE `zone_scope_snapshot_goals`
  ADD PRIMARY KEY (`id`),
  ADD KEY `zss_goals_snapshot_fk` (`zone_scope_snapshot_id`);

--
-- Index pour la table `zone_scope_snapshot_presentations`
--
ALTER TABLE `zone_scope_snapshot_presentations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `zss_pres_snapshot_fk` (`zone_scope_snapshot_id`);

--
-- Index pour la table `zone_scope_snapshot_products`
--
ALTER TABLE `zone_scope_snapshot_products`
  ADD PRIMARY KEY (`id`),
  ADD KEY `zss_prod_snapshot_fk` (`zone_scope_snapshot_id`);

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

--
-- Index pour la table `zone_scope_snapshot_targets`
--
ALTER TABLE `zone_scope_snapshot_targets`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `scope_snapshot_targets_unique` (`zone_scope_snapshot_id`,`target_key`);

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

--
-- Index pour la table `zone_scope_snapshot_target_specialities`
--
ALTER TABLE `zone_scope_snapshot_target_specialities`
  ADD PRIMARY KEY (`id`),
  ADD KEY `zss_tspec_tgt_fk` (`zone_scope_snapshot_target_id`);

--
-- Index pour la table `zone_scope_survey_campaigns`
--
ALTER TABLE `zone_scope_survey_campaigns`
  ADD PRIMARY KEY (`id`),
  ADD KEY `zssc_scope_start_idx` (`zone_scope_id`,`starts_at`);

--
-- Index pour la table `zone_scope_survey_campaign_targets`
--
ALTER TABLE `zone_scope_survey_campaign_targets`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `zssct_campaign_target_unique` (`zone_scope_survey_campaign_id`,`target_key`);

--
-- Index pour la table `zone_scope_target_forms`
--
ALTER TABLE `zone_scope_target_forms`
  ADD PRIMARY KEY (`id`),
  ADD KEY `zone_scope_target_forms_client_form_id_foreign` (`client_form_id`),
  ADD KEY `zs_target_form_scope_target_idx` (`zone_scope_id`,`target_key`),
  ADD KEY `zs_target_form_scope_kind_idx` (`zone_scope_id`,`form_kind`),
  ADD KEY `zs_target_form_scope_target_kind_idx` (`zone_scope_id`,`target_key`,`form_kind`),
  ADD KEY `zs_target_form_scope_node_kind_idx` (`zone_scope_id`,`organisation_node_id`,`form_kind`);

--
-- Index pour la table `zone_scope_target_specialities`
--
ALTER TABLE `zone_scope_target_specialities`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `zs_target_spec_unique` (`zone_scope_id`,`target_key`,`speciality_id`),
  ADD KEY `zone_scope_target_specialities_speciality_id_foreign` (`speciality_id`),
  ADD KEY `zs_target_spec_scope_target_idx` (`zone_scope_id`,`target_key`);

--
-- Index pour la table `zone_scope_target_surveys`
--
ALTER TABLE `zone_scope_target_surveys`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `zsts_scope_target_unique` (`zone_scope_id`,`target_key`);

--
-- Index pour la table `zone_scope_types`
--
ALTER TABLE `zone_scope_types`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `zone_scope_types_client_id_name_unique` (`client_id`,`name`),
  ADD KEY `zst_client_creator_idx` (`client_id`,`created_by_client_user_id`),
  ADD KEY `zone_scope_types_created_by_client_user_id_foreign` (`created_by_client_user_id`);

--
-- Index pour la table `zone_scope_type_edges`
--
ALTER TABLE `zone_scope_type_edges`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `zste_unique` (`zone_scope_type_id`,`parent_org_node_id`,`child_org_node_id`),
  ADD KEY `zste_parent_idx` (`zone_scope_type_id`,`parent_org_node_id`);

--
-- Index pour la table `zone_scope_type_node_targets`
--
ALTER TABLE `zone_scope_type_node_targets`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `zstnt_unique` (`zone_scope_type_id`,`org_node_id`),
  ADD KEY `zstnt_type_idx` (`zone_scope_type_id`);

--
-- Index pour la table `zone_wilaya`
--
ALTER TABLE `zone_wilaya`
  ADD PRIMARY KEY (`zone_id`,`wilaya_id`);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

--
-- 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 `goal_types`
--
ALTER TABLE `goal_types`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

--
-- AUTO_INCREMENT pour la table `landing_testimonials`
--
ALTER TABLE `landing_testimonials`
  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=271;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

--
-- AUTO_INCREMENT pour la table `wilayas`
--
ALTER TABLE `wilayas`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=61;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

--
-- Contraintes pour la table `admin_devices`
--
ALTER TABLE `admin_devices`
  ADD CONSTRAINT `admin_devices_admin_id_foreign` FOREIGN KEY (`admin_id`) REFERENCES `admins` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `clients`
--
ALTER TABLE `clients`
  ADD CONSTRAINT `clients_default_client_user_id_foreign` FOREIGN KEY (`default_client_user_id`) REFERENCES `client_users` (`id`) ON DELETE SET NULL;

--
-- Contraintes pour la table `client_access`
--
ALTER TABLE `client_access`
  ADD CONSTRAINT `client_access_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `client_devices`
--
ALTER TABLE `client_devices`
  ADD CONSTRAINT `client_devices_client_user_id_foreign` FOREIGN KEY (`client_user_id`) REFERENCES `client_users` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `client_forms`
--
ALTER TABLE `client_forms`
  ADD CONSTRAINT `client_forms_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `admins` (`id`) ON DELETE SET NULL;

--
-- Contraintes pour la table `client_form_questions`
--
ALTER TABLE `client_form_questions`
  ADD CONSTRAINT `client_form_questions_client_form_id_foreign` FOREIGN KEY (`client_form_id`) REFERENCES `client_forms` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `client_form_requests`
--
ALTER TABLE `client_form_requests`
  ADD CONSTRAINT `client_form_requests_client_form_id_foreign` FOREIGN KEY (`client_form_id`) REFERENCES `client_forms` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `client_form_requests_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `client_form_requests_requested_by_client_user_id_foreign` FOREIGN KEY (`requested_by_client_user_id`) REFERENCES `client_users` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `client_form_request_assignees`
--
ALTER TABLE `client_form_request_assignees`
  ADD CONSTRAINT `client_form_request_assignees_client_user_id_foreign` FOREIGN KEY (`client_user_id`) REFERENCES `client_users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `client_form_request_assignees_request_id_foreign` FOREIGN KEY (`request_id`) REFERENCES `client_form_requests` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `client_form_snapshots`
--
ALTER TABLE `client_form_snapshots`
  ADD CONSTRAINT `cfs_client_fk` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `cfs_creator_fk` FOREIGN KEY (`created_by_client_user_id`) REFERENCES `client_users` (`id`) ON DELETE SET NULL;

--
-- Contraintes pour la table `client_geo_bricks`
--
ALTER TABLE `client_geo_bricks`
  ADD CONSTRAINT `client_geo_bricks_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `client_geo_bricks_created_by_client_user_id_foreign` FOREIGN KEY (`created_by_client_user_id`) REFERENCES `client_users` (`id`) ON DELETE SET NULL;

--
-- Contraintes pour la table `client_geo_brick_commune`
--
ALTER TABLE `client_geo_brick_commune`
  ADD CONSTRAINT `client_geo_brick_commune_client_geo_brick_id_foreign` FOREIGN KEY (`client_geo_brick_id`) REFERENCES `client_geo_bricks` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `client_geo_settings`
--
ALTER TABLE `client_geo_settings`
  ADD CONSTRAINT `client_geo_settings_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `client_geo_zones`
--
ALTER TABLE `client_geo_zones`
  ADD CONSTRAINT `client_geo_zones_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `client_geo_zones_created_by_client_user_id_foreign` FOREIGN KEY (`created_by_client_user_id`) REFERENCES `client_users` (`id`) ON DELETE SET NULL;

--
-- Contraintes pour la table `client_geo_zone_wilaya`
--
ALTER TABLE `client_geo_zone_wilaya`
  ADD CONSTRAINT `client_geo_zone_wilaya_client_geo_zone_id_foreign` FOREIGN KEY (`client_geo_zone_id`) REFERENCES `client_geo_zones` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `client_org_groups`
--
ALTER TABLE `client_org_groups`
  ADD CONSTRAINT `client_org_groups_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `client_org_groups_org_node_id_foreign` FOREIGN KEY (`org_node_id`) REFERENCES `org_nodes` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `client_org_groups_parent_group_id_foreign` FOREIGN KEY (`parent_group_id`) REFERENCES `client_org_groups` (`id`) ON DELETE SET NULL;

--
-- Contraintes pour la table `client_pf_contact_assignments`
--
ALTER TABLE `client_pf_contact_assignments`
  ADD CONSTRAINT `client_pf_contact_assignments_assigned_by_client_user_id_foreign` FOREIGN KEY (`assigned_by_client_user_id`) REFERENCES `client_users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `client_pf_contact_assignments_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `client_pf_contact_assignments_organisation_id_foreign` FOREIGN KEY (`organisation_id`) REFERENCES `organisations` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `client_pf_contact_assignments_organisation_node_unit_id_foreign` FOREIGN KEY (`organisation_node_unit_id`) REFERENCES `organisation_node_units` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `client_pf_imports`
--
ALTER TABLE `client_pf_imports`
  ADD CONSTRAINT `client_pf_imports_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `client_pf_imports_uploaded_by_client_user_id_foreign` FOREIGN KEY (`uploaded_by_client_user_id`) REFERENCES `client_users` (`id`) ON DELETE SET NULL;

--
-- Contraintes pour la table `client_pf_import_rows`
--
ALTER TABLE `client_pf_import_rows`
  ADD CONSTRAINT `client_pf_import_rows_decided_by_admin_id_foreign` FOREIGN KEY (`decided_by_admin_id`) REFERENCES `admins` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `client_pf_import_rows_import_id_foreign` FOREIGN KEY (`import_id`) REFERENCES `client_pf_imports` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `client_pf_memberships`
--
ALTER TABLE `client_pf_memberships`
  ADD CONSTRAINT `client_pf_memberships_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `client_pf_memberships_created_by_client_user_id_foreign` FOREIGN KEY (`created_by_client_user_id`) REFERENCES `client_users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `client_pf_memberships_source_import_id_foreign` FOREIGN KEY (`source_import_id`) REFERENCES `client_pf_imports` (`id`) ON DELETE SET NULL;

--
-- Contraintes pour la table `client_roles`
--
ALTER TABLE `client_roles`
  ADD CONSTRAINT `client_roles_org_node_id_foreign` FOREIGN KEY (`org_node_id`) REFERENCES `org_nodes` (`id`) ON DELETE SET NULL;

--
-- Contraintes pour la table `client_territories`
--
ALTER TABLE `client_territories`
  ADD CONSTRAINT `client_territories_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `client_territory_bricks`
--
ALTER TABLE `client_territory_bricks`
  ADD CONSTRAINT `client_territory_bricks_client_geo_brick_id_foreign` FOREIGN KEY (`client_geo_brick_id`) REFERENCES `client_geo_bricks` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `client_territory_bricks_client_territory_id_foreign` FOREIGN KEY (`client_territory_id`) REFERENCES `client_territories` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `client_territory_communes`
--
ALTER TABLE `client_territory_communes`
  ADD CONSTRAINT `client_territory_communes_client_territory_id_foreign` FOREIGN KEY (`client_territory_id`) REFERENCES `client_territories` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `client_territory_wilayas`
--
ALTER TABLE `client_territory_wilayas`
  ADD CONSTRAINT `client_territory_wilayas_client_territory_id_foreign` FOREIGN KEY (`client_territory_id`) REFERENCES `client_territories` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `client_territory_zones`
--
ALTER TABLE `client_territory_zones`
  ADD CONSTRAINT `client_territory_zones_client_geo_zone_id_foreign` FOREIGN KEY (`client_geo_zone_id`) REFERENCES `client_geo_zones` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `client_territory_zones_client_territory_id_foreign` FOREIGN KEY (`client_territory_id`) REFERENCES `client_territories` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `client_users`
--
ALTER TABLE `client_users`
  ADD CONSTRAINT `client_users_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `client_users_client_role_id_foreign` FOREIGN KEY (`client_role_id`) REFERENCES `client_roles` (`id`) ON DELETE SET NULL;

--
-- Contraintes pour la table `client_user_organisations`
--
ALTER TABLE `client_user_organisations`
  ADD CONSTRAINT `client_user_organisations_client_user_id_foreign` FOREIGN KEY (`client_user_id`) REFERENCES `client_users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `client_user_organisations_covers_assignment_id_foreign` FOREIGN KEY (`covers_assignment_id`) REFERENCES `client_user_organisations` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `client_user_organisations_organisation_id_foreign` FOREIGN KEY (`organisation_id`) REFERENCES `organisations` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `client_user_organisations_organisation_node_id_foreign` FOREIGN KEY (`organisation_node_id`) REFERENCES `organisation_nodes` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `client_user_organisations_organisation_node_unit_id_foreign` FOREIGN KEY (`organisation_node_unit_id`) REFERENCES `organisation_node_units` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `client_user_organisations_substitute_client_user_id_foreign` FOREIGN KEY (`substitute_client_user_id`) REFERENCES `client_users` (`id`) ON DELETE SET NULL;

--
-- Contraintes pour la table `client_user_org_groups`
--
ALTER TABLE `client_user_org_groups`
  ADD CONSTRAINT `client_user_org_groups_client_org_group_id_foreign` FOREIGN KEY (`client_org_group_id`) REFERENCES `client_org_groups` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `client_user_org_groups_client_user_id_foreign` FOREIGN KEY (`client_user_id`) REFERENCES `client_users` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `client_user_org_nodes`
--
ALTER TABLE `client_user_org_nodes`
  ADD CONSTRAINT `client_user_org_nodes_client_user_id_foreign` FOREIGN KEY (`client_user_id`) REFERENCES `client_users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `client_user_org_nodes_org_node_id_foreign` FOREIGN KEY (`org_node_id`) REFERENCES `org_nodes` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `client_user_portal_activity_logs`
--
ALTER TABLE `client_user_portal_activity_logs`
  ADD CONSTRAINT `client_user_portal_activity_logs_actor_client_user_id_foreign` FOREIGN KEY (`actor_client_user_id`) REFERENCES `client_users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `client_user_portal_activity_logs_client_user_id_foreign` FOREIGN KEY (`client_user_id`) REFERENCES `client_users` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `client_user_territories`
--
ALTER TABLE `client_user_territories`
  ADD CONSTRAINT `client_user_territories_client_user_id_foreign` FOREIGN KEY (`client_user_id`) REFERENCES `client_users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `client_user_territories_commune_id_foreign` FOREIGN KEY (`commune_id`) REFERENCES `communes` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `cycle_plans`
--
ALTER TABLE `cycle_plans`
  ADD CONSTRAINT `cycle_plans_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `goal_type_units`
--
ALTER TABLE `goal_type_units`
  ADD CONSTRAINT `goal_type_units_goal_type_id_foreign` FOREIGN KEY (`goal_type_id`) REFERENCES `goal_types` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `goal_type_units_goal_unit_id_foreign` FOREIGN KEY (`goal_unit_id`) REFERENCES `goal_units` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `organisations`
--
ALTER TABLE `organisations`
  ADD CONSTRAINT `organisations_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `organisations_supreme_parent_node_id_foreign` FOREIGN KEY (`supreme_parent_node_id`) REFERENCES `organisation_nodes` (`id`) ON DELETE SET NULL;

--
-- Contraintes pour la table `organisation_absences`
--
ALTER TABLE `organisation_absences`
  ADD CONSTRAINT `organisation_absences_created_by_client_user_id_foreign` FOREIGN KEY (`created_by_client_user_id`) REFERENCES `client_users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `organisation_absences_organisation_evenement_id_foreign` FOREIGN KEY (`organisation_evenement_id`) REFERENCES `organisation_evenements` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `organisation_absences_organisation_id_foreign` FOREIGN KEY (`organisation_id`) REFERENCES `organisations` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `organisation_admins`
--
ALTER TABLE `organisation_admins`
  ADD CONSTRAINT `organisation_admins_admin_id_foreign` FOREIGN KEY (`admin_id`) REFERENCES `admins` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `organisation_admins_organisation_id_foreign` FOREIGN KEY (`organisation_id`) REFERENCES `organisations` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `organisation_cible_parent_assignments`
--
ALTER TABLE `organisation_cible_parent_assignments`
  ADD CONSTRAINT `organisation_cible_parent_assignments_organisation_id_foreign` FOREIGN KEY (`organisation_id`) REFERENCES `organisations` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `organisation_evenements`
--
ALTER TABLE `organisation_evenements`
  ADD CONSTRAINT `organisation_evenements_client_form_id_foreign` FOREIGN KEY (`client_form_id`) REFERENCES `client_forms` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `organisation_evenements_created_by_client_user_id_foreign` FOREIGN KEY (`created_by_client_user_id`) REFERENCES `client_users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `organisation_evenements_organisation_id_foreign` FOREIGN KEY (`organisation_id`) REFERENCES `organisations` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `organisation_evenements_superviseur_client_user_id_foreign` FOREIGN KEY (`superviseur_client_user_id`) REFERENCES `client_users` (`id`) ON DELETE SET NULL;

--
-- Contraintes pour la table `organisation_evenement_declarations`
--
ALTER TABLE `organisation_evenement_declarations`
  ADD CONSTRAINT `oed_approved_by_fk` FOREIGN KEY (`approved_by_client_user_id`) REFERENCES `client_users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `oed_created_by_fk` FOREIGN KEY (`created_by_client_user_id`) REFERENCES `client_users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `oed_evt_fk` FOREIGN KEY (`organisation_evenement_id`) REFERENCES `organisation_evenements` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `oed_org_fk` FOREIGN KEY (`organisation_id`) REFERENCES `organisations` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `organisation_geo_bricks`
--
ALTER TABLE `organisation_geo_bricks`
  ADD CONSTRAINT `organisation_geo_bricks_organisation_id_foreign` FOREIGN KEY (`organisation_id`) REFERENCES `organisations` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `organisation_geo_brick_commune`
--
ALTER TABLE `organisation_geo_brick_commune`
  ADD CONSTRAINT `organisation_geo_brick_commune_commune_id_foreign` FOREIGN KEY (`commune_id`) REFERENCES `communes` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `organisation_geo_brick_commune_organisation_geo_brick_id_foreign` FOREIGN KEY (`organisation_geo_brick_id`) REFERENCES `organisation_geo_bricks` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `organisation_geo_zones`
--
ALTER TABLE `organisation_geo_zones`
  ADD CONSTRAINT `organisation_geo_zones_organisation_id_foreign` FOREIGN KEY (`organisation_id`) REFERENCES `organisations` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `organisation_geo_zone_wilaya`
--
ALTER TABLE `organisation_geo_zone_wilaya`
  ADD CONSTRAINT `organisation_geo_zone_wilaya_organisation_geo_zone_id_foreign` FOREIGN KEY (`organisation_geo_zone_id`) REFERENCES `organisation_geo_zones` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `organisation_links`
--
ALTER TABLE `organisation_links`
  ADD CONSTRAINT `organisation_links_linked_organisation_id_foreign` FOREIGN KEY (`linked_organisation_id`) REFERENCES `organisations` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `organisation_links_organisation_id_foreign` FOREIGN KEY (`organisation_id`) REFERENCES `organisations` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `organisation_modification_sessions`
--
ALTER TABLE `organisation_modification_sessions`
  ADD CONSTRAINT `org_mod_sess_user_fk` FOREIGN KEY (`initiated_by_client_user_id`) REFERENCES `client_users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `organisation_modification_sessions_organisation_id_foreign` FOREIGN KEY (`organisation_id`) REFERENCES `organisations` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `organisation_nodes`
--
ALTER TABLE `organisation_nodes`
  ADD CONSTRAINT `organisation_nodes_org_node_id_foreign` FOREIGN KEY (`org_node_id`) REFERENCES `org_nodes` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `organisation_nodes_organisation_id_foreign` FOREIGN KEY (`organisation_id`) REFERENCES `organisations` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `organisation_nodes_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `organisation_nodes` (`id`) ON DELETE SET NULL;

--
-- Contraintes pour la table `organisation_node_parents`
--
ALTER TABLE `organisation_node_parents`
  ADD CONSTRAINT `organisation_node_parents_organisation_node_id_foreign` FOREIGN KEY (`organisation_node_id`) REFERENCES `organisation_nodes` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `organisation_node_parents_parent_organisation_node_id_foreign` FOREIGN KEY (`parent_organisation_node_id`) REFERENCES `organisation_nodes` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `organisation_node_units`
--
ALTER TABLE `organisation_node_units`
  ADD CONSTRAINT `organisation_node_units_organisation_node_id_foreign` FOREIGN KEY (`organisation_node_id`) REFERENCES `organisation_nodes` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `organisation_node_units_parent_organisation_node_id_foreign` FOREIGN KEY (`parent_organisation_node_id`) REFERENCES `organisation_nodes` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `organisation_node_units_parent_organisation_node_unit_id_foreign` FOREIGN KEY (`parent_organisation_node_unit_id`) REFERENCES `organisation_node_units` (`id`) ON DELETE SET NULL;

--
-- Contraintes pour la table `organisation_node_user_territories`
--
ALTER TABLE `organisation_node_user_territories`
  ADD CONSTRAINT `organisation_node_user_territories_client_user_id_foreign` FOREIGN KEY (`client_user_id`) REFERENCES `client_users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `organisation_node_user_territories_commune_id_foreign` FOREIGN KEY (`commune_id`) REFERENCES `communes` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `organisation_node_user_territories_organisation_node_id_foreign` FOREIGN KEY (`organisation_node_id`) REFERENCES `organisation_nodes` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `organisation_terrain_unit_snapshots`
--
ALTER TABLE `organisation_terrain_unit_snapshots`
  ADD CONSTRAINT `organisation_terrain_unit_snapshots_organisation_id_foreign` FOREIGN KEY (`organisation_id`) REFERENCES `organisations` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `organisation_territories`
--
ALTER TABLE `organisation_territories`
  ADD CONSTRAINT `organisation_territories_commune_id_foreign` FOREIGN KEY (`commune_id`) REFERENCES `communes` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `organisation_territories_organisation_id_foreign` FOREIGN KEY (`organisation_id`) REFERENCES `organisations` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `organisation_territory_assignments`
--
ALTER TABLE `organisation_territory_assignments`
  ADD CONSTRAINT `organisation_territory_assignments_client_territory_id_foreign` FOREIGN KEY (`client_territory_id`) REFERENCES `client_territories` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `organisation_territory_assignments_organisation_id_foreign` FOREIGN KEY (`organisation_id`) REFERENCES `organisations` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `organisation_territory_coverage_notes`
--
ALTER TABLE `organisation_territory_coverage_notes`
  ADD CONSTRAINT `organisation_territory_coverage_notes_organisation_id_foreign` FOREIGN KEY (`organisation_id`) REFERENCES `organisations` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `organisation_territory_repartitions`
--
ALTER TABLE `organisation_territory_repartitions`
  ADD CONSTRAINT `organisation_territory_repartitions_commune_id_foreign` FOREIGN KEY (`commune_id`) REFERENCES `communes` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `organisation_territory_repartitions_organisation_id_foreign` FOREIGN KEY (`organisation_id`) REFERENCES `organisations` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `organisation_territory_repartitions_organisation_node_id_foreign` FOREIGN KEY (`organisation_node_id`) REFERENCES `organisation_nodes` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `org_evt_internal_users`
--
ALTER TABLE `org_evt_internal_users`
  ADD CONSTRAINT `org_evt_int_cu_fk` FOREIGN KEY (`client_user_id`) REFERENCES `client_users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `org_evt_int_evt_fk` FOREIGN KEY (`organisation_evenement_id`) REFERENCES `organisation_evenements` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `org_node_client_roles`
--
ALTER TABLE `org_node_client_roles`
  ADD CONSTRAINT `org_node_client_roles_client_role_id_foreign` FOREIGN KEY (`client_role_id`) REFERENCES `client_roles` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `org_node_client_roles_org_node_id_foreign` FOREIGN KEY (`org_node_id`) REFERENCES `org_nodes` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `org_node_edges`
--
ALTER TABLE `org_node_edges`
  ADD CONSTRAINT `org_node_edges_child_node_id_foreign` FOREIGN KEY (`child_node_id`) REFERENCES `org_nodes` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `org_node_edges_parent_node_id_foreign` FOREIGN KEY (`parent_node_id`) REFERENCES `org_nodes` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `org_node_org_functional_group`
--
ALTER TABLE `org_node_org_functional_group`
  ADD CONSTRAINT `org_node_org_functional_group_org_functional_group_id_foreign` FOREIGN KEY (`org_functional_group_id`) REFERENCES `org_functional_groups` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `org_node_org_functional_group_org_node_id_foreign` FOREIGN KEY (`org_node_id`) REFERENCES `org_nodes` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `planned_visits`
--
ALTER TABLE `planned_visits`
  ADD CONSTRAINT `planned_visits_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `planned_visits_client_user_id_foreign` FOREIGN KEY (`client_user_id`) REFERENCES `client_users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `planned_visits_organisation_id_foreign` FOREIGN KEY (`organisation_id`) REFERENCES `organisations` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `planned_visits_organisation_node_unit_id_foreign` FOREIGN KEY (`organisation_node_unit_id`) REFERENCES `organisation_node_units` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `platform_country_admin_units`
--
ALTER TABLE `platform_country_admin_units`
  ADD CONSTRAINT `platform_country_admin_units_geo_import_id_foreign` FOREIGN KEY (`geo_import_id`) REFERENCES `platform_country_geo_imports` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `platform_country_admin_units_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `platform_country_admin_units` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `platform_country_admin_units_platform_country_id_foreign` FOREIGN KEY (`platform_country_id`) REFERENCES `platform_countries` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `platform_country_admin_unit_translations`
--
ALTER TABLE `platform_country_admin_unit_translations`
  ADD CONSTRAINT `platform_country_admin_unit_translations_admin_unit_id_foreign` FOREIGN KEY (`admin_unit_id`) REFERENCES `platform_country_admin_units` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `platform_country_geo_imports`
--
ALTER TABLE `platform_country_geo_imports`
  ADD CONSTRAINT `platform_country_geo_imports_platform_country_id_foreign` FOREIGN KEY (`platform_country_id`) REFERENCES `platform_countries` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `platform_country_geo_import_level_stats`
--
ALTER TABLE `platform_country_geo_import_level_stats`
  ADD CONSTRAINT `platform_country_geo_import_level_stats_geo_import_id_foreign` FOREIGN KEY (`geo_import_id`) REFERENCES `platform_country_geo_imports` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `products`
--
ALTER TABLE `products`
  ADD CONSTRAINT `products_created_by_client_user_id_foreign` FOREIGN KEY (`created_by_client_user_id`) REFERENCES `client_users` (`id`) ON DELETE SET NULL;

--
-- Contraintes pour la table `product_presentations`
--
ALTER TABLE `product_presentations`
  ADD CONSTRAINT `product_presentations_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `product_presentations_created_by_client_user_id_foreign` FOREIGN KEY (`created_by_client_user_id`) REFERENCES `client_users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `product_presentations_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `product_presentations_request_id_foreign` FOREIGN KEY (`request_id`) REFERENCES `product_presentation_requests` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `product_presentations_reviewed_by_client_user_id_foreign` FOREIGN KEY (`reviewed_by_client_user_id`) REFERENCES `client_users` (`id`) ON DELETE SET NULL;

--
-- Contraintes pour la table `product_presentation_requests`
--
ALTER TABLE `product_presentation_requests`
  ADD CONSTRAINT `product_presentation_requests_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `product_presentation_requests_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `product_presentation_request_assignees`
--
ALTER TABLE `product_presentation_request_assignees`
  ADD CONSTRAINT `product_presentation_request_assignees_client_user_id_foreign` FOREIGN KEY (`client_user_id`) REFERENCES `client_users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `product_presentation_request_assignees_request_id_foreign` FOREIGN KEY (`request_id`) REFERENCES `product_presentation_requests` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `product_presentation_views`
--
ALTER TABLE `product_presentation_views`
  ADD CONSTRAINT `product_presentation_views_client_user_id_foreign` FOREIGN KEY (`client_user_id`) REFERENCES `client_users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `product_presentation_views_presentation_id_foreign` FOREIGN KEY (`presentation_id`) REFERENCES `product_presentations` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `reseau_favorites`
--
ALTER TABLE `reseau_favorites`
  ADD CONSTRAINT `reseau_favorites_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `reseau_favorites_client_user_id_foreign` FOREIGN KEY (`client_user_id`) REFERENCES `client_users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `reseau_favorites_organisation_id_foreign` FOREIGN KEY (`organisation_id`) REFERENCES `organisations` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `reseau_favorites_organisation_node_unit_id_foreign` FOREIGN KEY (`organisation_node_unit_id`) REFERENCES `organisation_node_units` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `scope_assignments`
--
ALTER TABLE `scope_assignments`
  ADD CONSTRAINT `scope_assignments_client_user_id_foreign` FOREIGN KEY (`client_user_id`) REFERENCES `client_users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `scope_assignments_zone_id_foreign` FOREIGN KEY (`zone_id`) REFERENCES `zones` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `scope_assignments_zone_scope_id_foreign` FOREIGN KEY (`zone_scope_id`) REFERENCES `zone_scopes` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `sondages`
--
ALTER TABLE `sondages`
  ADD CONSTRAINT `sondages_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `admins` (`id`) ON DELETE SET NULL;

--
-- Contraintes pour la table `sondage_questions`
--
ALTER TABLE `sondage_questions`
  ADD CONSTRAINT `sondage_questions_sondage_id_foreign` FOREIGN KEY (`sondage_id`) REFERENCES `sondages` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `specialities`
--
ALTER TABLE `specialities`
  ADD CONSTRAINT `specialities_profession_id_foreign` FOREIGN KEY (`profession_id`) REFERENCES `professions` (`id`) ON DELETE SET NULL;

--
-- Contraintes pour la table `support_tickets`
--
ALTER TABLE `support_tickets`
  ADD CONSTRAINT `support_tickets_assigned_admin_id_foreign` FOREIGN KEY (`assigned_admin_id`) REFERENCES `admins` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `support_tickets_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `support_tickets_client_user_id_foreign` FOREIGN KEY (`client_user_id`) REFERENCES `client_users` (`id`) ON DELETE SET NULL;

--
-- Contraintes pour la table `zones`
--
ALTER TABLE `zones`
  ADD CONSTRAINT `zones_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `zones_created_by_admin_id_foreign` FOREIGN KEY (`created_by_admin_id`) REFERENCES `admins` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `zones_created_by_client_user_id_foreign` FOREIGN KEY (`created_by_client_user_id`) REFERENCES `client_users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `zones_org_node_id_foreign` FOREIGN KEY (`org_node_id`) REFERENCES `org_nodes` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `zones_owner_group_id_foreign` FOREIGN KEY (`owner_group_id`) REFERENCES `client_org_groups` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `zones_parent_zone_id_foreign` FOREIGN KEY (`parent_zone_id`) REFERENCES `zones` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `zones_scope_id_foreign` FOREIGN KEY (`scope_id`) REFERENCES `zone_scopes` (`id`) ON DELETE SET NULL;

--
-- Contraintes pour la table `zone_attributions`
--
ALTER TABLE `zone_attributions`
  ADD CONSTRAINT `zone_attributions_approved_by_client_user_id_foreign` FOREIGN KEY (`approved_by_client_user_id`) REFERENCES `client_users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `zone_attributions_group_id_foreign` FOREIGN KEY (`group_id`) REFERENCES `client_org_groups` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `zone_attributions_proposed_by_client_user_id_foreign` FOREIGN KEY (`proposed_by_client_user_id`) REFERENCES `client_users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `zone_attributions_rejected_by_client_user_id_foreign` FOREIGN KEY (`rejected_by_client_user_id`) REFERENCES `client_users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `zone_attributions_revoked_by_client_user_id_foreign` FOREIGN KEY (`revoked_by_client_user_id`) REFERENCES `client_users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `zone_attributions_scope_id_foreign` FOREIGN KEY (`scope_id`) REFERENCES `zone_scopes` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `zone_attributions_zone_id_foreign` FOREIGN KEY (`zone_id`) REFERENCES `zones` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `zone_commune`
--
ALTER TABLE `zone_commune`
  ADD CONSTRAINT `zone_commune_commune_id_foreign` FOREIGN KEY (`commune_id`) REFERENCES `communes` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `zone_commune_zone_id_foreign` FOREIGN KEY (`zone_id`) REFERENCES `zones` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `zone_conflicts`
--
ALTER TABLE `zone_conflicts`
  ADD CONSTRAINT `zone_conflicts_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `zone_conflicts_resolved_by_client_user_id_foreign` FOREIGN KEY (`resolved_by_client_user_id`) REFERENCES `client_users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `zone_conflicts_scope_id_foreign` FOREIGN KEY (`scope_id`) REFERENCES `zone_scopes` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `zone_conflicts_zone_id_foreign` FOREIGN KEY (`zone_id`) REFERENCES `zones` (`id`) ON DELETE SET NULL;

--
-- Contraintes pour la table `zone_history`
--
ALTER TABLE `zone_history`
  ADD CONSTRAINT `zone_history_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `zone_history_zone_id_foreign` FOREIGN KEY (`zone_id`) REFERENCES `zones` (`id`) ON DELETE SET NULL;

--
-- Contraintes pour la table `zone_product`
--
ALTER TABLE `zone_product`
  ADD CONSTRAINT `zone_product_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `zone_product_zone_id_foreign` FOREIGN KEY (`zone_id`) REFERENCES `zones` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `zone_scopes`
--
ALTER TABLE `zone_scopes`
  ADD CONSTRAINT `zone_scopes_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `zone_scopes_created_by_client_user_id_foreign` FOREIGN KEY (`created_by_client_user_id`) REFERENCES `client_users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `zone_scopes_cycle_plan_id_foreign` FOREIGN KEY (`cycle_plan_id`) REFERENCES `cycle_plans` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `zone_scopes_organisation_id_foreign` FOREIGN KEY (`organisation_id`) REFERENCES `organisations` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `zone_scopes_parent_scope_id_foreign` FOREIGN KEY (`parent_scope_id`) REFERENCES `zone_scopes` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `zone_scopes_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `zone_scopes_zone_scope_type_id_foreign` FOREIGN KEY (`zone_scope_type_id`) REFERENCES `zone_scope_types` (`id`) ON DELETE SET NULL;

--
-- Contraintes pour la table `zone_scope_goals`
--
ALTER TABLE `zone_scope_goals`
  ADD CONSTRAINT `zone_scope_goals_assigned_role_id_foreign` FOREIGN KEY (`assigned_role_id`) REFERENCES `client_roles` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `zone_scope_goals_assigned_user_id_foreign` FOREIGN KEY (`assigned_user_id`) REFERENCES `client_users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `zone_scope_goals_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `zone_scope_goals_zone_id_foreign` FOREIGN KEY (`zone_id`) REFERENCES `zones` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `zone_scope_goals_zone_scope_id_foreign` FOREIGN KEY (`zone_scope_id`) REFERENCES `zone_scopes` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `zone_scope_product`
--
ALTER TABLE `zone_scope_product`
  ADD CONSTRAINT `zone_scope_product_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `zone_scope_product_zone_scope_id_foreign` FOREIGN KEY (`zone_scope_id`) REFERENCES `zone_scopes` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `zone_scope_product_presentation`
--
ALTER TABLE `zone_scope_product_presentation`
  ADD CONSTRAINT `zone_scope_product_presentation_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `zone_scope_product_presentation_product_presentation_id_foreign` FOREIGN KEY (`product_presentation_id`) REFERENCES `product_presentations` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `zone_scope_product_presentation_zone_scope_id_foreign` FOREIGN KEY (`zone_scope_id`) REFERENCES `zone_scopes` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `zone_scope_realisateurs`
--
ALTER TABLE `zone_scope_realisateurs`
  ADD CONSTRAINT `zone_scope_realisateurs_zone_id_foreign` FOREIGN KEY (`zone_id`) REFERENCES `zones` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `zone_scope_realisateurs_zone_scope_id_foreign` FOREIGN KEY (`zone_scope_id`) REFERENCES `zone_scopes` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `zone_scope_snapshots`
--
ALTER TABLE `zone_scope_snapshots`
  ADD CONSTRAINT `zone_scope_snapshots_zone_scope_id_foreign` FOREIGN KEY (`zone_scope_id`) REFERENCES `zone_scopes` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `zone_scope_snapshot_forms`
--
ALTER TABLE `zone_scope_snapshot_forms`
  ADD CONSTRAINT `zss_forms_snapshot_fk` FOREIGN KEY (`zone_scope_snapshot_id`) REFERENCES `zone_scope_snapshots` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `zone_scope_snapshot_goals`
--
ALTER TABLE `zone_scope_snapshot_goals`
  ADD CONSTRAINT `zss_goals_snapshot_fk` FOREIGN KEY (`zone_scope_snapshot_id`) REFERENCES `zone_scope_snapshots` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `zone_scope_snapshot_presentations`
--
ALTER TABLE `zone_scope_snapshot_presentations`
  ADD CONSTRAINT `zss_pres_snapshot_fk` FOREIGN KEY (`zone_scope_snapshot_id`) REFERENCES `zone_scope_snapshots` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `zone_scope_snapshot_products`
--
ALTER TABLE `zone_scope_snapshot_products`
  ADD CONSTRAINT `zss_prod_snapshot_fk` FOREIGN KEY (`zone_scope_snapshot_id`) REFERENCES `zone_scope_snapshots` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `zone_scope_snapshot_targets`
--
ALTER TABLE `zone_scope_snapshot_targets`
  ADD CONSTRAINT `zone_scope_snapshot_targets_zone_scope_snapshot_id_foreign` FOREIGN KEY (`zone_scope_snapshot_id`) REFERENCES `zone_scope_snapshots` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `zone_scope_snapshot_target_specialities`
--
ALTER TABLE `zone_scope_snapshot_target_specialities`
  ADD CONSTRAINT `zss_tspec_tgt_fk` FOREIGN KEY (`zone_scope_snapshot_target_id`) REFERENCES `zone_scope_snapshot_targets` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `zone_scope_target_forms`
--
ALTER TABLE `zone_scope_target_forms`
  ADD CONSTRAINT `zone_scope_target_forms_zone_scope_id_foreign` FOREIGN KEY (`zone_scope_id`) REFERENCES `zone_scopes` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `zone_scope_target_specialities`
--
ALTER TABLE `zone_scope_target_specialities`
  ADD CONSTRAINT `zone_scope_target_specialities_speciality_id_foreign` FOREIGN KEY (`speciality_id`) REFERENCES `specialities` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `zone_scope_target_specialities_zone_scope_id_foreign` FOREIGN KEY (`zone_scope_id`) REFERENCES `zone_scopes` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `zone_scope_types`
--
ALTER TABLE `zone_scope_types`
  ADD CONSTRAINT `zone_scope_types_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `zone_scope_types_created_by_client_user_id_foreign` FOREIGN KEY (`created_by_client_user_id`) REFERENCES `client_users` (`id`) ON DELETE SET NULL;

--
-- Contraintes pour la table `zone_scope_type_edges`
--
ALTER TABLE `zone_scope_type_edges`
  ADD CONSTRAINT `zone_scope_type_edges_zone_scope_type_id_foreign` FOREIGN KEY (`zone_scope_type_id`) REFERENCES `zone_scope_types` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `zone_scope_type_node_targets`
--
ALTER TABLE `zone_scope_type_node_targets`
  ADD CONSTRAINT `zone_scope_type_node_targets_zone_scope_type_id_foreign` FOREIGN KEY (`zone_scope_type_id`) REFERENCES `zone_scope_types` (`id`) ON DELETE CASCADE;

--
-- Contraintes pour la table `zone_wilaya`
--
ALTER TABLE `zone_wilaya`
  ADD CONSTRAINT `zone_wilaya_zone_id_foreign` FOREIGN KEY (`zone_id`) REFERENCES `zones` (`id`) ON DELETE CASCADE;
COMMIT;

