-- https://www.phpmyadmin.net/
--
-- Versão do servidor: 5.5.58-cll

START TRANSACTION;



--
-- Database: `wsptcom_dbskills`
--

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

--
-- Estrutura da tabela `admin_level`
--

CREATE TABLE `admin_level` (
  `id_admin_level` int(10) NOT NULL,
  `name` varchar(25) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Extraindo dados da tabela `admin_level`
--

INSERT INTO `admin_level` (`id_admin_level`, `name`) VALUES
(1, 'Administrador Geral'),
(2, 'Administrador Assistente');

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

--
-- Estrutura da tabela `clusters`
--

CREATE TABLE `clusters` (
  `id_cluster` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
  `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Extraindo dados da tabela `clusters`
--

INSERT INTO `clusters` (`id_cluster`, `name`) VALUES
('1', 'Cluster 1'),
('2', 'Cluster 2'),
('3', 'Cluster 3'),
('4', 'Cluster 4'),
('C5', 'Cluster C5');

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

--
-- Estrutura da tabela `competition_type`
--

CREATE TABLE `competition_type` (
  `id_competition_type` int(10) NOT NULL,
  `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Extraindo dados da tabela `competition_type`
--

INSERT INTO `competition_type` (`id_competition_type`, `name`) VALUES
(1, 'Competição Oficial'),
(2, 'Competição Demonstração');

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

--
-- Estrutura da tabela `cycles`
--

CREATE TABLE `cycles` (
  `id_cycle` int(10) NOT NULL,
  `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `date_start` date NOT NULL,
  `date_end` date NOT NULL,
  `active` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Extraindo dados da tabela `cycles`
--

INSERT INTO `cycles` (`id_cycle`, `name`, `date_start`, `date_end`, `active`) VALUES
(1, 'Ciclo 2015-2017', '2015-09-01', '2017-12-31', 1),
(2, 'Ciclo 2017-2019', '2017-09-01', '2019-12-31', 1);

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

--
-- Estrutura da tabela `documents_type`
--

CREATE TABLE `documents_type` (
  `id_document_type` int(10) NOT NULL,
  `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Extraindo dados da tabela `documents_type`
--

INSERT INTO `documents_type` (`id_document_type`, `name`) VALUES
(1, 'Cartão de cidadão'),
(2, 'Bilhete de identidade'),
(3, 'Autorização de residência'),
(4, 'Passaporte'),
(5, 'Cartão de residência'),
(6, 'Visto de trabalho'),
(99, 'Outro');

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

--
-- Estrutura da tabela `education`
--

CREATE TABLE `education` (
  `id_education` int(10) NOT NULL,
  `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Extraindo dados da tabela `education`
--

INSERT INTO `education` (`id_education`, `name`) VALUES
(1, '1º Ciclo Ensino Básico'),
(2, '2º Ciclo Ensino Básico'),
(3, '3º Ciclo Ensino Básico'),
(4, 'Ensino Secundário'),
(5, 'Habilitação escolar pós Secundária não Superior'),
(6, 'Habilitação Superior - Bacharelato'),
(7, 'Habilitação Superior - Licenciatura'),
(8, 'Habilitação Superior - Mestrado'),
(9, 'Habilitação Superior - Doutoramento');

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

--
-- Estrutura da tabela `entities`
--

CREATE TABLE `entities` (
  `id_entity` int(10) NOT NULL,
  `name` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `id_participant_platform_manager` int(10) DEFAULT NULL,
  `address` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `city` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `postal_code` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
  `id_zone1` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL,
  `id_zone2` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL,
  `id_zone3` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL,
  `id_entity_scope` int(10) DEFAULT NULL,
  `entity_is_main` tinyint(1) NOT NULL,
  `id_entity_main` int(10) DEFAULT NULL,
  `phone` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
  `email` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `direction_name` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `direction_email` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `direction_position` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `alternative_contact_name` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `alternative_contact_email` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `alternative_contact_direct_phone` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
  `notes` text COLLATE utf8_unicode_ci NOT NULL,
  `active` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Extraindo dados da tabela `entities`
--

INSERT INTO `entities` (`id_entity`, `name`, `id_participant_platform_manager`, `address`, `city`, `postal_code`, `id_zone1`, `id_zone2`, `id_zone3`, `id_entity_scope`, `entity_is_main`, `id_entity_main`, `phone`, `email`, `direction_name`, `direction_email`, `direction_position`, `alternative_contact_name`, `alternative_contact_email`, `alternative_contact_direct_phone`, `notes`, `active`) VALUES
(1000, 'IEFP - Serviços Centrais', 1000, 'Rua exemplo, 1234 - 1º direito', '', '', NULL, NULL, NULL, NULL, 1, NULL, '', '', '', '', '', '', '', '', '', 1),
(1001, 'IEFP - Serviços lisboa', 1000, 'Rua exemplo, 1234 - 1º direito', '', '', NULL, NULL, NULL, NULL, 0, 1000, '', '', '', '', '', '', '', '', '', 1);

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

--
-- Estrutura da tabela `entities_registration`
--

CREATE TABLE `entities_registration` (
  `id_entity_registration` int(10) NOT NULL,
  `id_event` int(10) NOT NULL,
  `name` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `adress` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `city` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `postal_code` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
  `id_zone1` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
  `id_zone2` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
  `id_zone3` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
  `id_organization_region` int(10) NOT NULL,
  `id_entity_scope` int(10) NOT NULL,
  `phone` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
  `email` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `direction_name` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `direction_email` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `direction_position` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `platform_manager_name` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `platform_manager_email` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `platform_manager_direct_phone` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
  `registered_skills` text COLLATE utf8_unicode_ci NOT NULL,
  `id_registration_status` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

--
-- Estrutura da tabela `entity_scope`
--

CREATE TABLE `entity_scope` (
  `id_entity_scope` int(10) NOT NULL,
  `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Extraindo dados da tabela `entity_scope`
--

INSERT INTO `entity_scope` (`id_entity_scope`, `name`) VALUES
(1, 'IEFP - Serviços Centrais'),
(2, 'IEFP - Delegação Regional'),
(3, 'IEFP - Centro de Formação Gestão Direta'),
(4, 'Centro de Formação Gestão Participada'),
(5, 'Entidade Formadora'),
(6, 'Escola Profissional'),
(7, 'Escola Secundária'),
(8, 'Escola de Hotelaria e Turismo / Turismo de Portugal'),
(9, 'Universidade'),
(10, 'Politécnico'),
(11, 'Empresa');

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

--
-- Estrutura da tabela `events`
--

CREATE TABLE `events` (
  `id_event` int(10) NOT NULL,
  `name` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `id_cycle` int(10) NOT NULL,
  `id_event_kind` int(10) NOT NULL,
  `date_start` date NOT NULL,
  `date_end` date NOT NULL,
  `notes` text COLLATE utf8_unicode_ci NOT NULL,
  `active` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

--
-- Estrutura da tabela `events_kind`
--

CREATE TABLE `events_kind` (
  `id_event_kind` int(10) NOT NULL,
  `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Extraindo dados da tabela `events_kind`
--

INSERT INTO `events_kind` (`id_event_kind`, `name`) VALUES
(1, 'Pré-Seleção'),
(2, 'Campeonato Regional'),
(3, 'Campeonato Nacional (WS Portugal)'),
(11, 'Campeonato Europeu (WS Europe)'),
(12, 'Campeonato Mundial (WS International)');

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

--
-- Estrutura da tabela `events_participants`
--

CREATE TABLE `events_participants` (
  `id_event_participant` int(10) NOT NULL,
  `id_entity` int(10) NOT NULL,
  `id_participant` int(10) NOT NULL,
  `id_event_skill` varchar(21) COLLATE utf8_unicode_ci NOT NULL,
  `id_participant_type` int(10) NOT NULL,
  `id_event_participant_state` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

--
-- Estrutura da tabela `events_participants_state`
--

CREATE TABLE `events_participants_state` (
  `id_event_participant_state` int(10) NOT NULL,
  `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Extraindo dados da tabela `events_participants_state`
--

INSERT INTO `events_participants_state` (`id_event_participant_state`, `name`) VALUES
(1, 'Pré-Registo'),
(2, 'Registo Oficial (Confirmado)'),
(3, 'Registo Oficial (Pago)'),
(4, 'Registo Cancelado');

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

--
-- Estrutura da tabela `events_registration_manager_entities`
--

CREATE TABLE `events_registration_manager_entities` (
  `id_event` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
  `registration_title` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `registration_description` text COLLATE utf8_unicode_ci NOT NULL,
  `date_registration_start` date NOT NULL,
  `date_registration_end` date NOT NULL,
  `active` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

--
-- Estrutura da tabela `events_skills`
--

CREATE TABLE `events_skills` (
  `id_event_skill` varchar(21) COLLATE utf8_unicode_ci NOT NULL,
  `id_event` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
  `id_skill` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
  `name` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `id_cluster` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
  `id_competition_type` int(10) NOT NULL,
  `id_venue_section` int(10) NOT NULL,
  `date_born_start` date NOT NULL,
  `date_born_end` date NOT NULL,
  `notes` text COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

--
-- Estrutura da tabela `gender`
--

CREATE TABLE `gender` (
  `id_gender` varchar(1) COLLATE utf8_unicode_ci NOT NULL,
  `name` varchar(25) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Extraindo dados da tabela `gender`
--

INSERT INTO `gender` (`id_gender`, `name`) VALUES
('F', 'Feminino'),
('M', 'Masculino');

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

--
-- Estrutura da tabela `log_records`
--

CREATE TABLE `log_records` (
  `id_log_record` int(10) UNSIGNED NOT NULL,
  `id_log_type` int(10) NOT NULL,
  `log_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `login` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `table_name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `record_id` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `notes` varchar(255) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

--
-- Estrutura da tabela `log_types`
--

CREATE TABLE `log_types` (
  `id_log_type` int(10) NOT NULL,
  `name` varchar(25) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Extraindo dados da tabela `log_types`
--

INSERT INTO `log_types` (`id_log_type`, `name`) VALUES
(1, 'Login'),
(2, 'Logout'),
(3, 'Table Insert Record'),
(4, 'Table Update Record'),
(5, 'Table Delete Record');

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

--
-- Estrutura da tabela `nationalities`
--

CREATE TABLE `nationalities` (
  `id_nationality` int(10) NOT NULL,
  `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Extraindo dados da tabela `nationalities`
--

INSERT INTO `nationalities` (`id_nationality`, `name`) VALUES
(1, 'Portuguesa'),
(2, 'Estrangeira');

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

--
-- Estrutura da tabela `organization_region`
--

CREATE TABLE `organization_region` (
  `id_organization_region` int(10) NOT NULL,
  `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Extraindo dados da tabela `organization_region`
--

INSERT INTO `organization_region` (`id_organization_region`, `name`) VALUES
(1, 'DR Norte'),
(2, 'DR Centro'),
(3, 'DR Lisboa e Vale do Tejo'),
(4, 'Dr Alentejo'),
(5, 'DR Algarve'),
(6, 'RA Açores'),
(7, 'RA Madeira');

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

--
-- Estrutura da tabela `participants_type`
--

CREATE TABLE `participants_type` (
  `id_participant_type` int(10) NOT NULL,
  `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `id_participant_type_category` int(10) NOT NULL,
  `allow_external_registration` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Extraindo dados da tabela `participants_type`
--

INSERT INTO `participants_type` (`id_participant_type`, `name`, `id_participant_type_category`, `allow_external_registration`) VALUES
(101, 'Organização (Gestor da Competição)', 1, 0),
(102, 'Organização (Membro)', 1, 0),
(201, 'Gestor da Plataforma (Representante Entidade)', 2, 0),
(301, 'Chefe de Oficina', 3, 1),
(302, 'Chefe de Oficina Assistente', 3, 1),
(303, 'Chefe de Oficina (Convidado)', 3, 1),
(401, 'Presidente do Júri', 4, 1),
(402, 'Assistente do Presidente do Júri', 4, 1),
(403, 'Jurado', 4, 1),
(501, 'Team Leader', 5, 1),
(601, 'Concorrente', 6, 1),
(602, 'Concorrente (Convidado)', 6, 1),
(701, 'Tradutor', 7, 0),
(801, 'Observador', 8, 0);

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

--
-- Estrutura da tabela `participants_type_category`
--

CREATE TABLE `participants_type_category` (
  `id_participant_type_category` int(10) NOT NULL,
  `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Extraindo dados da tabela `participants_type_category`
--

INSERT INTO `participants_type_category` (`id_participant_type_category`, `name`) VALUES
(1, 'Organização'),
(2, 'Gestores Plataforma (Entidades)'),
(3, 'Chefes Oficina'),
(4, 'Jurados'),
(5, 'Team Leaders'),
(6, 'Concorrentes'),
(7, 'Tradutores'),
(8, 'Observadores');

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

--
-- Estrutura da tabela `registration_status`
--

CREATE TABLE `registration_status` (
  `id_registration_status` int(10) NOT NULL,
  `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Extraindo dados da tabela `registration_status`
--

INSERT INTO `registration_status` (`id_registration_status`, `name`) VALUES
(1, 'Registo efetuado (Falta conferir)'),
(2, 'Registo convertido em Entidade'),
(3, 'Registo Cancelado (Duplicado/outro)'),
(4, '');

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

--
-- Estrutura da tabela `skills`
--

CREATE TABLE `skills` (
  `id_skill` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
  `name` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `id_cluster` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
  `notes` text COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

--
-- Estrutura da tabela `venues_sections`
--

CREATE TABLE `venues_sections` (
  `id_venue_section` int(10) NOT NULL,
  `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `id_event` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
  `notes` text COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

--
-- Estrutura da tabela `vocation_skills_type`
--

CREATE TABLE `vocation_skills_type` (
  `id_vocational_skills_type` int(10) NOT NULL,
  `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Extraindo dados da tabela `vocation_skills_type`
--

INSERT INTO `vocation_skills_type` (`id_vocational_skills_type`, `name`) VALUES
(1, 'Aprendizagem'),
(2, 'Educação Formação de Adultos');

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

--
-- Estrutura da tabela `zone1`
--

CREATE TABLE `zone1` (
  `id_zone1` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
  `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Extraindo dados da tabela `zone1`
--

INSERT INTO `zone1` (`id_zone1`, `name`) VALUES
('Z01', 'Zone 1'),
('Z02', 'Zone 2'),
('Z03', 'Zone 3'),
('Z04', 'Zone 4'),
('Z05', 'Zone 5');

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

--
-- Estrutura da tabela `zone2`
--

CREATE TABLE `zone2` (
  `id_zone2` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
  `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `id_zone1` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
  `id_organization_region` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Extraindo dados da tabela `zone2`
--

INSERT INTO `zone2` (`id_zone2`, `name`, `id_zone1`, `id_organization_region`) VALUES
('Z01Z11', 'Zone AAA (Z01)', 'Z01', 1),
('Z01Z12', 'Zone BBB (z01)', 'Z01', 1),
('Z01Z13', 'Zone CCC', 'Z01', 2),
('Z02Z21', 'Zone 21 (z02)', 'Z02', 2),
('Z04Z41', 'Zone 41 (zone 04)', 'Z04', 4);

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

--
-- Estrutura da tabela `zone3`
--

CREATE TABLE `zone3` (
  `id_zone3` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
  `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `id_zone2` varchar(25) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Extraindo dados da tabela `zone3`
--

INSERT INTO `zone3` (`id_zone3`, `name`, `id_zone2`) VALUES
('Z01Z11Z111', 'ZONE AAA 111', 'Z01Z11'),
('Z01Z11Z112', 'ZONE AAA 112', 'Z01Z11'),
('Z01Z11Z113', 'ZONE AAA 113', 'Z01Z11'),
('Z01Z12Z121', 'Zone BBB (z01) - 121', 'Z01Z12'),
('Z04Z41Z441', 'Zone 41 (zone 04) - FREG', 'Z04Z41');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `admin_level`
--
ALTER TABLE `admin_level`
  ADD PRIMARY KEY (`id_admin_level`);

--
-- Indexes for table `clusters`
--
ALTER TABLE `clusters`
  ADD PRIMARY KEY (`id_cluster`);

--
-- Indexes for table `competition_type`
--
ALTER TABLE `competition_type`
  ADD PRIMARY KEY (`id_competition_type`);

--
-- Indexes for table `cycles`
--
ALTER TABLE `cycles`
  ADD PRIMARY KEY (`id_cycle`);

--
-- Indexes for table `documents_type`
--
ALTER TABLE `documents_type`
  ADD PRIMARY KEY (`id_document_type`);

--
-- Indexes for table `education`
--
ALTER TABLE `education`
  ADD PRIMARY KEY (`id_education`);

--
-- Indexes for table `entities`
--
ALTER TABLE `entities`
  ADD PRIMARY KEY (`id_entity`),
  ADD KEY `id_zone1` (`id_zone1`),
  ADD KEY `id_zone2` (`id_zone2`),
  ADD KEY `id_zone3` (`id_zone3`),
  ADD KEY `id_entity_scope` (`id_entity_scope`),
  ADD KEY `id_participant_platform_manager` (`id_participant_platform_manager`),
  ADD KEY `id_entity_main` (`id_entity_main`) USING BTREE;

--
-- Indexes for table `entities_registration`
--
ALTER TABLE `entities_registration`
  ADD PRIMARY KEY (`id_entity_registration`),
  ADD KEY `id_zone1` (`id_zone1`),
  ADD KEY `id_zone2` (`id_zone2`),
  ADD KEY `id_zone3` (`id_zone3`),
  ADD KEY `id_organization_region` (`id_organization_region`),
  ADD KEY `id_entity_scope` (`id_entity_scope`),
  ADD KEY `id_registration_status` (`id_registration_status`);

--
-- Indexes for table `entity_scope`
--
ALTER TABLE `entity_scope`
  ADD PRIMARY KEY (`id_entity_scope`);

--
-- Indexes for table `events`
--
ALTER TABLE `events`
  ADD PRIMARY KEY (`id_event`),
  ADD UNIQUE KEY `id_event_kind` (`id_event_kind`),
  ADD KEY `id_cycle` (`id_cycle`);

--
-- Indexes for table `events_kind`
--
ALTER TABLE `events_kind`
  ADD PRIMARY KEY (`id_event_kind`);

--
-- Indexes for table `events_participants`
--
ALTER TABLE `events_participants`
  ADD PRIMARY KEY (`id_event_participant`),
  ADD KEY `id_entity` (`id_entity`),
  ADD KEY `id_participant` (`id_participant`),
  ADD KEY `id_event_skill` (`id_event_skill`),
  ADD KEY `id_participant_type` (`id_participant_type`),
  ADD KEY `id_event_participant_state` (`id_event_participant_state`);

--
-- Indexes for table `events_participants_state`
--
ALTER TABLE `events_participants_state`
  ADD PRIMARY KEY (`id_event_participant_state`);

--
-- Indexes for table `events_registration_manager_entities`
--
ALTER TABLE `events_registration_manager_entities`
  ADD PRIMARY KEY (`id_event`);

--
-- Indexes for table `events_skills`
--
ALTER TABLE `events_skills`
  ADD PRIMARY KEY (`id_event_skill`),
  ADD KEY `id_event` (`id_event`),
  ADD KEY `id_skill` (`id_skill`),
  ADD KEY `id_competition_type` (`id_competition_type`),
  ADD KEY `id_venue_section` (`id_venue_section`),
  ADD KEY `id_cluster` (`id_cluster`);

--
-- Indexes for table `gender`
--
ALTER TABLE `gender`
  ADD PRIMARY KEY (`id_gender`);

--
-- Indexes for table `log_records`
--
ALTER TABLE `log_records`
  ADD PRIMARY KEY (`id_log_record`),
  ADD KEY `id_log_type` (`id_log_type`);

--
-- Indexes for table `log_types`
--
ALTER TABLE `log_types`
  ADD PRIMARY KEY (`id_log_type`);

--
-- Indexes for table `nationalities`
--
ALTER TABLE `nationalities`
  ADD PRIMARY KEY (`id_nationality`);

--
-- Indexes for table `organization_region`
--
ALTER TABLE `organization_region`
  ADD PRIMARY KEY (`id_organization_region`);

--
-- Indexes for table `participants_type`
--
ALTER TABLE `participants_type`
  ADD PRIMARY KEY (`id_participant_type`),
  ADD KEY `id_participant_type_category` (`id_participant_type_category`);

--
-- Indexes for table `participants_type_category`
--
ALTER TABLE `participants_type_category`
  ADD PRIMARY KEY (`id_participant_type_category`);

--
-- Indexes for table `registration_status`
--
ALTER TABLE `registration_status`
  ADD PRIMARY KEY (`id_registration_status`);

--
-- Indexes for table `skills`
--
ALTER TABLE `skills`
  ADD PRIMARY KEY (`id_skill`),
  ADD KEY `id_cluster` (`id_cluster`);

--
-- Indexes for table `venues_sections`
--
ALTER TABLE `venues_sections`
  ADD PRIMARY KEY (`id_venue_section`),
  ADD KEY `id_event` (`id_event`);

--
-- Indexes for table `vocation_skills_type`
--
ALTER TABLE `vocation_skills_type`
  ADD PRIMARY KEY (`id_vocational_skills_type`);

--
-- Indexes for table `zone1`
--
ALTER TABLE `zone1`
  ADD PRIMARY KEY (`id_zone1`);

--
-- Indexes for table `zone2`
--
ALTER TABLE `zone2`
  ADD PRIMARY KEY (`id_zone2`),
  ADD KEY `id_zone1` (`id_zone1`),
  ADD KEY `id_organization_region` (`id_organization_region`);

--
-- Indexes for table `zone3`
--
ALTER TABLE `zone3`
  ADD PRIMARY KEY (`id_zone3`),
  ADD KEY `id_zone2` (`id_zone2`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `admin_level`
--
ALTER TABLE `events`
  MODIFY `id_event` int(10) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `admin_level`
--
ALTER TABLE `admin_level`
  MODIFY `id_admin_level` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `competition_type`
--
ALTER TABLE `competition_type`
  MODIFY `id_competition_type` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `cycles`
--
ALTER TABLE `cycles`
  MODIFY `id_cycle` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `documents_type`
--
ALTER TABLE `documents_type`
  MODIFY `id_document_type` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=100;
--
-- AUTO_INCREMENT for table `education`
--
ALTER TABLE `education`
  MODIFY `id_education` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `entities`
--
ALTER TABLE `entities`
  MODIFY `id_entity` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1002;
--
-- AUTO_INCREMENT for table `entities_registration`
--
ALTER TABLE `entities_registration`
  MODIFY `id_entity_registration` int(10) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `entity_scope`
--
ALTER TABLE `entity_scope`
  MODIFY `id_entity_scope` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT for table `events_participants`
--
ALTER TABLE `events_participants`
  MODIFY `id_event_participant` int(10) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `events_participants_state`
--
ALTER TABLE `events_participants_state`
  MODIFY `id_event_participant_state` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `log_records`
--
ALTER TABLE `log_records`
  MODIFY `id_log_record` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `log_types`
--
ALTER TABLE `log_types`
  MODIFY `id_log_type` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `nationalities`
--
ALTER TABLE `nationalities`
  MODIFY `id_nationality` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `organization_region`
--
ALTER TABLE `organization_region`
  MODIFY `id_organization_region` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `registration_status`
--
ALTER TABLE `registration_status`
  MODIFY `id_registration_status` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `venues_sections`
--
ALTER TABLE `venues_sections`
  MODIFY `id_venue_section` int(10) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `vocation_skills_type`
--
ALTER TABLE `vocation_skills_type`
  MODIFY `id_vocational_skills_type` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- Constraints for dumped tables
--

--
-- Limitadores para a tabela `entities`
--
ALTER TABLE `entities`
  ADD CONSTRAINT `entities_ibfk_1` FOREIGN KEY (`id_zone1`) REFERENCES `zone1` (`id_zone1`),
  ADD CONSTRAINT `entities_ibfk_2` FOREIGN KEY (`id_zone2`) REFERENCES `zone2` (`id_zone2`),
  ADD CONSTRAINT `entities_ibfk_3` FOREIGN KEY (`id_zone3`) REFERENCES `zone3` (`id_zone3`),
  ADD CONSTRAINT `entities_ibfk_4` FOREIGN KEY (`id_entity_main`) REFERENCES `entities` (`id_entity`),
  ADD CONSTRAINT `entities_ibfk_5` FOREIGN KEY (`id_entity_scope`) REFERENCES `entity_scope` (`id_entity_scope`),
  ADD CONSTRAINT `entities_ibfk_6` FOREIGN KEY (`id_participant_platform_manager`) REFERENCES `participants` (`id_participant`);

--
-- Limitadores para a tabela `entities_registration`
--
ALTER TABLE `entities_registration`
  ADD CONSTRAINT `entities_registration_ibfk_1` FOREIGN KEY (`id_zone1`) REFERENCES `zone1` (`id_zone1`),
  ADD CONSTRAINT `entities_registration_ibfk_2` FOREIGN KEY (`id_zone2`) REFERENCES `zone2` (`id_zone2`),
  ADD CONSTRAINT `entities_registration_ibfk_3` FOREIGN KEY (`id_zone3`) REFERENCES `zone3` (`id_zone3`),
  ADD CONSTRAINT `entities_registration_ibfk_4` FOREIGN KEY (`id_organization_region`) REFERENCES `organization_region` (`id_organization_region`),
  ADD CONSTRAINT `entities_registration_ibfk_5` FOREIGN KEY (`id_registration_status`) REFERENCES `registration_status` (`id_registration_status`);

--
-- Limitadores para a tabela `events`
--
ALTER TABLE `events`
  ADD CONSTRAINT `events_ibfk_1` FOREIGN KEY (`id_cycle`) REFERENCES `cycles` (`id_cycle`),
  ADD CONSTRAINT `events_ibfk_2` FOREIGN KEY (`id_event_kind`) REFERENCES `events_kind` (`id_event_kind`);

--
-- Limitadores para a tabela `events_participants`
--
ALTER TABLE `events_participants`
  ADD CONSTRAINT `events_participants_ibfk_1` FOREIGN KEY (`id_entity`) REFERENCES `entities` (`id_entity`),
  ADD CONSTRAINT `events_participants_ibfk_2` FOREIGN KEY (`id_event_participant_state`) REFERENCES `events_participants_state` (`id_event_participant_state`),
  ADD CONSTRAINT `events_participants_ibfk_3` FOREIGN KEY (`id_event_skill`) REFERENCES `events_skills` (`id_event_skill`),
  ADD CONSTRAINT `events_participants_ibfk_4` FOREIGN KEY (`id_participant`) REFERENCES `participants` (`id_participant`),
  ADD CONSTRAINT `events_participants_ibfk_5` FOREIGN KEY (`id_participant_type`) REFERENCES `participants_type` (`id_participant_type`);

--
-- Limitadores para a tabela `events_registration_manager_entities`
--
ALTER TABLE `events_registration_manager_entities`
  ADD CONSTRAINT `events_registration_manager_entities_ibfk_1` FOREIGN KEY (`id_event`) REFERENCES `events` (`id_event`);

--
-- Limitadores para a tabela `events_skills`
--
ALTER TABLE `events_skills`
  ADD CONSTRAINT `events_skills_ibfk_1` FOREIGN KEY (`id_event`) REFERENCES `events` (`id_event`),
  ADD CONSTRAINT `events_skills_ibfk_2` FOREIGN KEY (`id_skill`) REFERENCES `skills` (`id_skill`),
  ADD CONSTRAINT `events_skills_ibfk_3` FOREIGN KEY (`id_venue_section`) REFERENCES `venues_sections` (`id_venue_section`),
  ADD CONSTRAINT `events_skills_ibfk_4` FOREIGN KEY (`id_competition_type`) REFERENCES `competition_type` (`id_competition_type`),
  ADD CONSTRAINT `events_skills_ibfk_5` FOREIGN KEY (`id_cluster`) REFERENCES `clusters` (`id_cluster`);

--
-- Limitadores para a tabela `log_records`
--
ALTER TABLE `log_records`
  ADD CONSTRAINT `log_records_ibfk_1` FOREIGN KEY (`id_log_type`) REFERENCES `log_types` (`id_log_type`);

--
-- Limitadores para a tabela `participants_type`
--
ALTER TABLE `participants_type`
  ADD CONSTRAINT `participants_type_ibfk_1` FOREIGN KEY (`id_participant_type_category`) REFERENCES `participants_type_category` (`id_participant_type_category`);

--
-- Limitadores para a tabela `skills`
--
ALTER TABLE `skills`
  ADD CONSTRAINT `skills_ibfk_1` FOREIGN KEY (`id_cluster`) REFERENCES `clusters` (`id_cluster`);

--
-- Limitadores para a tabela `venues_sections`
--
ALTER TABLE `venues_sections`
  ADD CONSTRAINT `venues_sections_ibfk_1` FOREIGN KEY (`id_event`) REFERENCES `events` (`id_event`);

--
-- Limitadores para a tabela `zone2`
--
ALTER TABLE `zone2`
  ADD CONSTRAINT `zone2_ibfk_1` FOREIGN KEY (`id_organization_region`) REFERENCES `organization_region` (`id_organization_region`),
  ADD CONSTRAINT `zone2_ibfk_2` FOREIGN KEY (`id_zone1`) REFERENCES `zone1` (`id_zone1`);

--
-- Limitadores para a tabela `zone3`
--
ALTER TABLE `zone3`
  ADD CONSTRAINT `zone3_ibfk_1` FOREIGN KEY (`id_zone2`) REFERENCES `zone2` (`id_zone2`);
COMMIT;

