DROP TABLE IF EXISTS `mailjet_campaign`;
CREATE TABLE `mailjet_campaign` (
  `PK_mailjet_campaign_id` int NOT NULL,
  `FK_mailjet_contact_list_id` int NOT NULL,
  `libelle_mailjet_campaign` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `subject_mailjet_campaign` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `content_mailjet_campaign` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `id_mailjet_campaign` varchar(220) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `campaign_id_mailjet_campaign` int NOT NULL,
  `sender_name_mailjet_campaign` varchar(220) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `sender_id_mailjet_campaign` varchar(220) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `date_creation_mailjet_campaign` datetime NOT NULL,
  `schedule_mailjet_campaign` datetime NOT NULL,
  `sent_mailjet_campaign` int NOT NULL DEFAULT '0',
  `actif_mailjet_campaign` int NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

DROP TABLE IF EXISTS `mailjet_contact_list`;
CREATE TABLE `mailjet_contact_list` (
  `PK_mailjet_contact_list_id` int NOT NULL,
  `libelle_mailjet_contact_list` varchar(220) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `files_mailjet_contact` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL,
  `original_mailjet_contact` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL,
  `id_mailjet_contact_list` varchar(220) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `date_creation_mailjet_contact_list` datetime NOT NULL,
  `actif_mailjet_contact_list` int NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

DROP TABLE IF EXISTS `mailjet_contact_list_history`;
CREATE TABLE `mailjet_contact_list_history` (
  `PK_mailjet_contact_list_history_id` int NOT NULL,
  `FK_mailjet_contact_list_id` int NOT NULL,
  `date_import_mailjet_contact_list` datetime NOT NULL,
  `number_mailjet_contact_list` int NOT NULL,
  `comment_mailjet_contact_list` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `actif_mailjet_contact_list_history` int NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;


ALTER TABLE `mailjet_campaign`
  ADD PRIMARY KEY (`PK_mailjet_campaign_id`),
  ADD KEY `actif_mailjet_campaign` (`actif_mailjet_campaign`),
  ADD KEY `libelle_mailjet_campaign` (`libelle_mailjet_campaign`),
  ADD KEY `subject_mailjet_campaign` (`subject_mailjet_campaign`),
  ADD KEY `id_mailjet_campaign` (`id_mailjet_campaign`),
  ADD KEY `FK_mailjet_contact_list_id` (`FK_mailjet_contact_list_id`),
  ADD KEY `sent_mailjet_campaign` (`sent_mailjet_campaign`);

ALTER TABLE `mailjet_contact_list`
  ADD PRIMARY KEY (`PK_mailjet_contact_list_id`),
  ADD KEY `actif_mailjet_contact_list` (`actif_mailjet_contact_list`),
  ADD KEY `libelle_mailjet_contact_list` (`libelle_mailjet_contact_list`);

ALTER TABLE `mailjet_contact_list_history`
  ADD PRIMARY KEY (`PK_mailjet_contact_list_history_id`),
  ADD KEY `FK_mailjet_contact_list_id` (`FK_mailjet_contact_list_id`),
  ADD KEY `date_import` (`date_import_mailjet_contact_list`),
  ADD KEY `number_mailjet_contact_list` (`number_mailjet_contact_list`),
  ADD KEY `actif_mailjet_contact_list_history` (`actif_mailjet_contact_list_history`);


ALTER TABLE `mailjet_campaign`
  MODIFY `PK_mailjet_campaign_id` int NOT NULL AUTO_INCREMENT;

ALTER TABLE `mailjet_contact_list`
  MODIFY `PK_mailjet_contact_list_id` int NOT NULL AUTO_INCREMENT;

ALTER TABLE `mailjet_contact_list_history`
  MODIFY `PK_mailjet_contact_list_history_id` int NOT NULL AUTO_INCREMENT;
COMMIT;