 -- UNIQUE
 ALTER TABLE `Metadata` ADD UNIQUE(`name`);
 
+/********** TABLE METADATASECTION ***********/
+CREATE TABLE `MetadataSection`(
+  `idMetadataSection` int(12) unsigned NOT NULL AUTO_INCREMENT,
+  `name` varchar(255) NOT NULL,
+  PRIMARY KEY(`idMetadataSection`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Available sections for metadata';
+
+-- UNIQUE
+ALTER TABLE `MetadataSection` ADD UNIQUE(`name`);
+
 /********** TABLE METADATAGROUP ***********/
 CREATE TABLE `MetadataGroup`(
   `idMetadataGroup` int(12) unsigned NOT NULL AUTO_INCREMENT,
+  `idMetadataSection` int(12) unsigned,
   `name` varchar(255) NOT NULL,
   PRIMARY KEY(`idMetadataGroup`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Available groups for metadata';
 
--- UNIQUE
-ALTER TABLE `MetadataGroup` ADD UNIQUE(`name`);
+
+-- FOREIGN KEY
+ALTER TABLE `MetadataGroup` ADD FOREIGN KEY (`idMetadataSection`) REFERENCES
+  `MetadataSection`(`idMetadataSection`) ON DELETE CASCADE ON UPDATE CASCADE ;
 
 /********** TABLE METADATAGROUP-METADATA ***********/
 CREATE TABLE `RelMetadataGroupMetadata`(


INSERT INTO `RelRolesActions` (`IdRol`, `IdAction`, `IdState`, `IdContext`, `IdPipeline`)
  VALUES  (201, 9510, 8, 1, 3), (201, 9510, 7, 1, 3);

  ON DELETE CASCADE ON UPDATE CASCADE ;

/********** TABLE METADATAGROUP-NODETYPE ***********/
CREATE TABLE `RelMetadataSectionNodeType`(
  `idMetadataSection` int(12) unsigned NOT NULL,
  `idNodeType` int(12) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Relation between section and nodetype';

-- UNIQUE
ALTER TABLE `RelMetadataSectionNodeType` ADD UNIQUE(`idMetadataSection`, `idNodeType`);

-- FOREIGN KEY
ALTER TABLE `RelMetadataSectionNodeType` ADD FOREIGN KEY (`idMetadataSection`) REFERENCES
  `MetadataSection`(`idMetadataSection`) ON DELETE CASCADE ON UPDATE CASCADE ;
ALTER TABLE `RelMetadataSectionNodeType` ADD FOREIGN KEY (`idNodeType`) REFERENCES `NodeTypes`(`IdNodeType`)
  ON DELETE CASCADE ON UPDATE CASCADE;

/********** TABLE METADATA VALUE ***********/
CREATE TABLE `MetadataValue`(
