CREATE TABLE `map_spot` (
  `PK_map_spot_id` int NOT NULL,
  `FK_map_spot_menu_id` int NOT NULL,
  `FK_map_spot_type_id` int NOT NULL DEFAULT '0',
  `libelle_map_spot` varchar(220) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `desc_map_spot` varchar(220) COLLATE utf8_unicode_ci NOT NULL,
  `content_map_spot` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `before_content_map_spot` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `after_content_map_spot` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `begin_map_spot` time NOT NULL,
  `end_map_spot` time NOT NULL,
  `color_map_spot` varchar(220) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 'bleu',
  `permanent_map_spot` int NOT NULL DEFAULT '0',
  `actif_map_spot` int NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `map_spot_menu` (
  `PK_map_spot_menu_id` int NOT NULL,
  `FK_map_spot_menu_id` int NOT NULL,
  `libelle_map_spot_menu` varchar(220) COLLATE utf8_unicode_ci NOT NULL,
  `class_map_spot_menu` varchar(220) COLLATE utf8_unicode_ci NOT NULL,
  `ordre_map_spot_menu` int NOT NULL DEFAULT '1',
  `actif_map_spot_menu` int NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `map_spot_type` (
  `PK_map_spot_type_id` int NOT NULL,
  `libelle_map_spot_type` varchar(220) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `actif_map_spot_type` int NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

INSERT INTO `map_spot_type` (`PK_map_spot_type_id`, `libelle_map_spot_type`, `actif_map_spot_type`) VALUES
(1, 'Webcast', 1),
(2, 'Pop Up', 1),
(3, 'Link', 1);


ALTER TABLE `map_spot`
  ADD PRIMARY KEY (`PK_map_spot_id`),
  ADD KEY `FK_map_spot_type_id` (`FK_map_spot_type_id`),
  ADD KEY `actif_map_spot` (`actif_map_spot`),
  ADD KEY `FK_map_spot_menu_id` (`FK_map_spot_menu_id`);

ALTER TABLE `map_spot_menu`
  ADD PRIMARY KEY (`PK_map_spot_menu_id`),
  ADD KEY `ordre_map_spot_menu` (`ordre_map_spot_menu`),
  ADD KEY `actif_map_spot_menu` (`actif_map_spot_menu`),
  ADD KEY `FK_map_spot_menu_id` (`FK_map_spot_menu_id`);

ALTER TABLE `map_spot_type`
  ADD PRIMARY KEY (`PK_map_spot_type_id`),
  ADD KEY `actif_map_spot_type` (`actif_map_spot_type`);


ALTER TABLE `map_spot`
  MODIFY `PK_map_spot_id` int NOT NULL AUTO_INCREMENT;

ALTER TABLE `map_spot_menu`
  MODIFY `PK_map_spot_menu_id` int NOT NULL AUTO_INCREMENT;

ALTER TABLE `map_spot_type`
  MODIFY `PK_map_spot_type_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
COMMIT;
