CREATE TABLE `registration_simple` (
  `PK_registration_simple_id` int NOT NULL,
  `FK_registration_simple_form_id` int NOT NULL,
  `FK_users_id` int NOT NULL,
  `date_registration_simple` datetime DEFAULT NULL,
  `actif_registration_simple` int DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `registration_simple_datas` (
  `PK_registration_simple_datas_id` int NOT NULL,
  `FK_registration_simple_id` int NOT NULL,
  `FK_registration_simple_form_fields_id` int NOT NULL,
  `value_registration_simple_datas` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `registration_simple_form` (
  `PK_registration_simple_form_id` int NOT NULL,
  `libelle_registration_simple_form` varchar(220) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `actif_registration_simple_form` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `registration_simple_form_fields` (
  `PK_registration_simple_form_fields_id` int NOT NULL,
  `FK_registration_simple_form_id` int NOT NULL,
  `libelle_registration_simple_form_fields` varchar(220) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `key_registration_simple_form_fields` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `type_registration_simple_form_fields` varchar(220) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `required_registration_simple_form_fields` int NOT NULL,
  `editable_registration_simple_form_fields` int NOT NULL DEFAULT '1',
  `default_registration_simple_form_fields` int NOT NULL DEFAULT '0',
  `default_key_registration_simple_form_fields` varchar(220) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `quota_registration_simple_form_fields` int NOT NULL DEFAULT '0',
  `participe_registration_simple_form_fields` int NOT NULL,
  `ordre_registration_simple_form_fields` int NOT NULL,
  `actif_registration_simple_form_fields` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `registration_simple_params` (
  `PK_registration_simple_params_id` int NOT NULL,
  `FK_registration_simple_form_id` int NOT NULL,
  `participe_ragistration_simple_params` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `no_participe_ragistration_simple_params` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `duree_registration_simple` int DEFAULT NULL,
  `date_open_registration_simple` date DEFAULT NULL,
  `time_open_registration_simple` time DEFAULT NULL,
  `texte_open_registration_simple` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `date_close_registration_simple` date DEFAULT NULL,
  `time_close_registration_simple` time DEFAULT NULL,
  `texte_close_registration_simple` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `mail_registration_simple` int DEFAULT NULL,
  `from_registration_simple` varchar(220) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `from_name_registration_simple` varchar(220) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `copy_registration_simple` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `objet_mail_registration_simple` varchar(220) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `content_mail_registration_simple` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;


ALTER TABLE `registration_simple`
  ADD PRIMARY KEY (`PK_registration_simple_id`),
  ADD KEY `actif_registration` (`actif_registration_simple`),
  ADD KEY `FK_users_id` (`FK_users_id`),
  ADD KEY `FK_registration_simple_form_id` (`FK_registration_simple_form_id`);

ALTER TABLE `registration_simple_datas`
  ADD PRIMARY KEY (`PK_registration_simple_datas_id`),
  ADD KEY `FK_registration_simple_form_fields_id` (`FK_registration_simple_form_fields_id`),
  ADD KEY `FK_registration_simple_id` (`FK_registration_simple_id`);

ALTER TABLE `registration_simple_form`
  ADD PRIMARY KEY (`PK_registration_simple_form_id`),
  ADD KEY `actif_registration_simple_form` (`actif_registration_simple_form`);

ALTER TABLE `registration_simple_form_fields`
  ADD PRIMARY KEY (`PK_registration_simple_form_fields_id`),
  ADD KEY `FK_registration_simple_form_id` (`FK_registration_simple_form_id`),
  ADD KEY `ordre_registration_simple_form_fields` (`ordre_registration_simple_form_fields`),
  ADD KEY `actif_registration_simple_form_fields` (`actif_registration_simple_form_fields`),
  ADD KEY `participe_registration_simple_form_fields` (`participe_registration_simple_form_fields`);

ALTER TABLE `registration_simple_params`
  ADD PRIMARY KEY (`PK_registration_simple_params_id`),
  ADD KEY `FK_registration_simple_form_id` (`FK_registration_simple_form_id`);


ALTER TABLE `registration_simple`
  MODIFY `PK_registration_simple_id` int NOT NULL AUTO_INCREMENT;

ALTER TABLE `registration_simple_datas`
  MODIFY `PK_registration_simple_datas_id` int NOT NULL AUTO_INCREMENT;

ALTER TABLE `registration_simple_form`
  MODIFY `PK_registration_simple_form_id` int NOT NULL AUTO_INCREMENT;

ALTER TABLE `registration_simple_form_fields`
  MODIFY `PK_registration_simple_form_fields_id` int NOT NULL AUTO_INCREMENT;

ALTER TABLE `registration_simple_params`
  MODIFY `PK_registration_simple_params_id` int NOT NULL AUTO_INCREMENT;
COMMIT;
