   `deleted_by` varchar(100) COLLATE utf8_estonian_ci DEFAULT NULL,
   `old_id` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
   PRIMARY KEY (`id`),
-  UNIQUE KEY `old_id` (`old_id`),
   KEY `entity_definition_keyname` (`entity_definition_keyname`),
   KEY `sort` (`sort`),
   KEY `deleted` (`deleted`),
   KEY `public` (`public`),
-  KEY `e_fk_def` (`definition_id`),
-  CONSTRAINT `e_fk_def` FOREIGN KEY (`definition_id`) REFERENCES `entity` (`id`),
+  KEY `sharing` (`sharing`),
   CONSTRAINT `e_fk_ed` FOREIGN KEY (`entity_definition_keyname`) REFERENCES `entity_definition` (`keyname`) ON UPDATE CASCADE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_estonian_ci;
 

  UNIQUE KEY `old_id` (`old_id`),
  KEY `ordinal` (`ordinal`),
  KEY `entity_definition_keyname` (`entity_definition_keyname`),
  KEY `relationship_definition_keyname` (`relationship_definition_keyname`),
  KEY `classifying_entity_definition_keyname` (`classifying_entity_definition_keyname`),
  KEY `deleted` (`deleted`),
  KEY `dataproperty` (`dataproperty`),
  CONSTRAINT `pd_fk_ced` FOREIGN KEY (`classifying_entity_definition_keyname`) REFERENCES `entity_definition` (`keyname`) ON UPDATE CASCADE,
  CONSTRAINT `pd_fk_ed` FOREIGN KEY (`entity_definition_keyname`) REFERENCES `entity_definition` (`keyname`) ON UPDATE CASCADE,
  CONSTRAINT `pd_fk_rd` FOREIGN KEY (`relationship_definition_keyname`) REFERENCES `relationship_definition` (`keyname`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_estonian_ci;

-- Create syntax for TABLE 'relationship'

  `entity_id` int(11) unsigned NOT NULL,
  `ordinal` int(11) DEFAULT NULL,
  `language` varchar(10) COLLATE utf8_estonian_ci DEFAULT NULL,
  `value_display` varchar(500) COLLATE utf8_estonian_ci DEFAULT NULL,
  `value_formula` varchar(500) COLLATE utf8_estonian_ci DEFAULT NULL,
  `value_string` varchar(500) COLLATE utf8_estonian_ci DEFAULT NULL,
  `value_text` text COLLATE utf8_estonian_ci,
