INSERT INTO `SITE` (`OJB_CONCRETE_CLASS`, `KEY_ROOT_DOMAIN_OBJECT`, `SITE_TYPE`) 
	VALUES ('net.sourceforge.fenixedu.domain.SiteTemplate', 1, 'net.sourceforge.fenixedu.domain.ExecutionCourseSite');
	
INSERT INTO `ACCESSIBLE_ITEM` (`OJB_CONCRETE_CLASS`, `KEY_ROOT_DOMAIN_OBJECT`, `VISIBLE`, `KEY_SITE`, `SECTION_ORDER`, `KEY_FUNCTIONALITY`) SELECT 'net.sourceforge.fenixedu.domain.FunctionalitySection', 1, 1, 0, 0, AI.`ID_INTERNAL` FROM ACCESSIBLE_ITEM AS AI WHERE UUID = '8b992ca5-c112-4963-a2ca-91a5713e3f0a'; -- 16196
INSERT INTO `ACCESSIBLE_ITEM` (`OJB_CONCRETE_CLASS`, `KEY_ROOT_DOMAIN_OBJECT`, `VISIBLE`, `KEY_SITE`, `SECTION_ORDER`, `KEY_FUNCTIONALITY`) SELECT 'net.sourceforge.fenixedu.domain.FunctionalitySection', 1, 1, 0, 1, AI.`ID_INTERNAL` FROM ACCESSIBLE_ITEM AS AI WHERE UUID = 'c168fb54-39ed-4e76-8c7d-df4827aefc4d'; -- 16197
INSERT INTO `ACCESSIBLE_ITEM` (`OJB_CONCRETE_CLASS`, `KEY_ROOT_DOMAIN_OBJECT`, `VISIBLE`, `KEY_SITE`, `SECTION_ORDER`, `KEY_FUNCTIONALITY`) SELECT 'net.sourceforge.fenixedu.domain.FunctionalitySection', 1, 1, 0, 2, AI.`ID_INTERNAL` FROM ACCESSIBLE_ITEM AS AI WHERE UUID = 'a7ae9674-17c9-4166-91f4-a80b38d79a41'; -- 16198);
INSERT INTO `ACCESSIBLE_ITEM` (`OJB_CONCRETE_CLASS`, `KEY_ROOT_DOMAIN_OBJECT`, `VISIBLE`, `KEY_SITE`, `SECTION_ORDER`, `KEY_FUNCTIONALITY`) SELECT 'net.sourceforge.fenixedu.domain.FunctionalitySection', 1, 1, 0, 3, AI.`ID_INTERNAL` FROM ACCESSIBLE_ITEM AS AI WHERE UUID = '729d1770-b7f0-4bf9-acd0-b07b951b2e2e'; -- 16199);
INSERT INTO `ACCESSIBLE_ITEM` (`OJB_CONCRETE_CLASS`, `KEY_ROOT_DOMAIN_OBJECT`, `VISIBLE`, `KEY_SITE`, `SECTION_ORDER`, `KEY_FUNCTIONALITY`) SELECT 'net.sourceforge.fenixedu.domain.FunctionalitySection', 1, 1, 0, 4, AI.`ID_INTERNAL` FROM ACCESSIBLE_ITEM AS AI WHERE UUID = '9a31d73a-a1d4-462a-af5c-0fb6ffb15761'; -- 16200);
INSERT INTO `ACCESSIBLE_ITEM` (`OJB_CONCRETE_CLASS`, `KEY_ROOT_DOMAIN_OBJECT`, `VISIBLE`, `KEY_SITE`, `SECTION_ORDER`, `KEY_FUNCTIONALITY`) SELECT 'net.sourceforge.fenixedu.domain.FunctionalitySection', 1, 1, 0, 5, AI.`ID_INTERNAL` FROM ACCESSIBLE_ITEM AS AI WHERE UUID = 'c71ee66b-5246-4259-b135-c6eed8d21e7a'; -- 16201);
INSERT INTO `ACCESSIBLE_ITEM` (`OJB_CONCRETE_CLASS`, `KEY_ROOT_DOMAIN_OBJECT`, `VISIBLE`, `KEY_SITE`, `SECTION_ORDER`, `KEY_FUNCTIONALITY`) SELECT 'net.sourceforge.fenixedu.domain.FunctionalitySection', 1, 1, 0, 6, AI.`ID_INTERNAL` FROM ACCESSIBLE_ITEM AS AI WHERE UUID = '51b95e9b-f636-4466-ab5b-f455184b9fe3'; -- 16202);
INSERT INTO `ACCESSIBLE_ITEM` (`OJB_CONCRETE_CLASS`, `KEY_ROOT_DOMAIN_OBJECT`, `VISIBLE`, `KEY_SITE`, `SECTION_ORDER`, `KEY_FUNCTIONALITY`) SELECT 'net.sourceforge.fenixedu.domain.FunctionalitySection', 1, 1, 0, 7, AI.`ID_INTERNAL` FROM ACCESSIBLE_ITEM AS AI WHERE UUID = '672d9b28-2100-46ba-9586-f9bb09692747'; -- 16203);
INSERT INTO `ACCESSIBLE_ITEM` (`OJB_CONCRETE_CLASS`, `KEY_ROOT_DOMAIN_OBJECT`, `VISIBLE`, `KEY_SITE`, `SECTION_ORDER`, `KEY_FUNCTIONALITY`) SELECT 'net.sourceforge.fenixedu.domain.FunctionalitySection', 1, 1, 0, 8, AI.`ID_INTERNAL` FROM ACCESSIBLE_ITEM AS AI WHERE UUID = '98b12f32-87b6-4c9d-8c18-8bd5c00d303c'; -- 16204);
INSERT INTO `ACCESSIBLE_ITEM` (`OJB_CONCRETE_CLASS`, `KEY_ROOT_DOMAIN_OBJECT`, `VISIBLE`, `KEY_SITE`, `SECTION_ORDER`, `KEY_FUNCTIONALITY`) SELECT 'net.sourceforge.fenixedu.domain.FunctionalitySection', 1, 1, 0, 9, AI.`ID_INTERNAL` FROM ACCESSIBLE_ITEM AS AI WHERE UUID = '859fb0f6-ee73-4baa-bf34-80ea3ec8ab5f'; -- 16205);
INSERT INTO `ACCESSIBLE_ITEM` (`OJB_CONCRETE_CLASS`, `KEY_ROOT_DOMAIN_OBJECT`, `VISIBLE`, `KEY_SITE`, `SECTION_ORDER`, `KEY_FUNCTIONALITY`) SELECT 'net.sourceforge.fenixedu.domain.FunctionalitySection', 1, 1, 0, 10, AI.`ID_INTERNAL` FROM ACCESSIBLE_ITEM AS AI WHERE UUID = 'cc6df75a-3be9-45d9-b47b-3b7544565251'; -- 16207);
INSERT INTO `ACCESSIBLE_ITEM` (`OJB_CONCRETE_CLASS`, `KEY_ROOT_DOMAIN_OBJECT`, `VISIBLE`, `KEY_SITE`, `SECTION_ORDER`, `KEY_FUNCTIONALITY`) SELECT 'net.sourceforge.fenixedu.domain.FunctionalitySection', 1, 1, 0, 11, AI.`ID_INTERNAL` FROM ACCESSIBLE_ITEM AS AI WHERE UUID = 'bf220aff-96eb-4a67-ab1c-848f90b6aaa3'; -- 16206);
INSERT INTO `ACCESSIBLE_ITEM` (`OJB_CONCRETE_CLASS`, `KEY_ROOT_DOMAIN_OBJECT`, `VISIBLE`, `KEY_SITE`, `SECTION_ORDER`, `KEY_FUNCTIONALITY`) SELECT 'net.sourceforge.fenixedu.domain.FunctionalitySection', 1, 1, 0, 12, AI.`ID_INTERNAL` FROM ACCESSIBLE_ITEM AS AI WHERE UUID = '360d6646-953c-45cc-a0bf-721365af5e00'; -- 21791);

UPDATE `ACCESSIBLE_ITEM` AS AI, `SITE` AS S
	SET AI.`KEY_SITE` = S.`ID_INTERNAL`
	WHERE AI.`OJB_CONCRETE_CLASS` LIKE 'net.sourceforge.fenixedu.domain.FunctionalitySection'
	  AND S.`OJB_CONCRETE_CLASS`  LIKE 'net.sourceforge.fenixedu.domain.SiteTemplate';

-- Reset sequence number
DELETE FROM `OJB_HL_SEQ` WHERE `TABLENAME` = 'SEQ_ACCESSIBLE_ITEM';