   `english_displayinfo` varchar(500) COLLATE utf8_estonian_ci DEFAULT NULL,
   `english_displaytable` varchar(500) COLLATE utf8_estonian_ci DEFAULT NULL,
   `english_sort` varchar(500) COLLATE utf8_estonian_ci DEFAULT NULL,
-  `actions_add` enum('ester') COLLATE utf8_estonian_ci DEFAULT NULL,
-  `created` datetime DEFAULT NULL,
-  `created_by` varchar(100) COLLATE utf8_estonian_ci DEFAULT NULL,
-  `changed` datetime DEFAULT NULL,
-  `changed_by` varchar(100) COLLATE utf8_estonian_ci DEFAULT NULL,
-  `deleted` datetime DEFAULT NULL,
-  `deleted_by` varchar(100) COLLATE utf8_estonian_ci DEFAULT NULL,
-  `gae_key` varchar(100) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
+  `actions_add` varchar(100) COLLATE utf8_estonian_ci DEFAULT NULL,
+  `old_id` varchar(100) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
   PRIMARY KEY (`keyname`),
-  UNIQUE KEY `gae_key` (`gae_key`),
+  UNIQUE KEY `keyname` (`keyname`),
+  UNIQUE KEY `old_id` (`old_id`),
   KEY `public_path` (`public_path`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_estonian_ci;
 
+-- Create syntax for TABLE 'entity'
+CREATE TABLE `entity` (
+  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+  `entity_definition_keyname` varchar(25) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
+  `created` datetime DEFAULT NULL,
+  `created_by` varchar(100) COLLATE utf8_estonian_ci DEFAULT NULL,
+  `changed` datetime DEFAULT NULL,
+  `changed_by` varchar(100) COLLATE utf8_estonian_ci DEFAULT NULL,
+  `deleted` datetime DEFAULT NULL,
+  `deleted_by` varchar(100) COLLATE utf8_estonian_ci DEFAULT NULL,
+  `public` tinyint(1) unsigned NOT NULL DEFAULT '0',
+  `sort` varchar(100) CHARACTER SET utf8 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`),
+  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;
+
+-- Create syntax for TABLE 'relationship_definition'
+CREATE TABLE `relationship_definition` (
+  `keyname` varchar(25) CHARACTER SET ascii COLLATE ascii_bin NOT NULL DEFAULT '',
+  `created` datetime DEFAULT NULL,
+  `created_by` varchar(100) COLLATE utf8_estonian_ci DEFAULT NULL,
+  `changed` datetime DEFAULT NULL,
+  `changed_by` varchar(100) COLLATE utf8_estonian_ci DEFAULT NULL,
+  `deleted` datetime DEFAULT NULL,
+  `deleted_by` varchar(100) COLLATE utf8_estonian_ci DEFAULT NULL,
+  `estonian_label` varchar(500) COLLATE utf8_estonian_ci DEFAULT NULL,
+  `estonian_label_plural` varchar(500) COLLATE utf8_estonian_ci DEFAULT NULL,
+  `estonian_description` varchar(500) COLLATE utf8_estonian_ci DEFAULT NULL,
+  `english_label` varchar(500) COLLATE utf8_estonian_ci DEFAULT NULL,
+  `english_label_plural` varchar(500) COLLATE utf8_estonian_ci DEFAULT NULL,
+  `english_description` varchar(500) COLLATE utf8_estonian_ci DEFAULT NULL,
+  PRIMARY KEY (`keyname`),
+  UNIQUE KEY `keyname` (`keyname`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_estonian_ci;
+
+-- Create syntax for TABLE 'property_definition'
 CREATE TABLE `property_definition` (
   `keyname` varchar(50) CHARACTER SET ascii COLLATE ascii_bin NOT NULL DEFAULT '',
   `entity_definition_keyname` varchar(25) CHARACTER SET ascii COLLATE ascii_bin DEFAULT NULL,
   `relationship_definition_keyname` varchar(25) CHARACTER SET ascii COLLATE ascii_bin DEFAULT NULL,
+  `created` datetime DEFAULT NULL,
+  `created_by` varchar(100) COLLATE utf8_estonian_ci DEFAULT NULL,
+  `changed` datetime DEFAULT NULL,
+  `changed_by` varchar(100) COLLATE utf8_estonian_ci DEFAULT NULL,
+  `deleted` datetime DEFAULT NULL,
+  `deleted_by` varchar(100) COLLATE utf8_estonian_ci DEFAULT NULL,
   `dataproperty` varchar(24) CHARACTER SET ascii COLLATE ascii_bin DEFAULT NULL,
   `datatype` enum('boolean','counter','counter_value','decimal','date','datetime','file','integer','reference','string','text') COLLATE utf8_estonian_ci NOT NULL DEFAULT 'string',
   `defaultvalue` varchar(500) COLLATE utf8_estonian_ci DEFAULT NULL,

  `value_file` int(11) unsigned DEFAULT NULL,
  `value_counter` int(11) unsigned DEFAULT NULL,
  `relationship_id` int(11) unsigned DEFAULT NULL,
  `created` datetime DEFAULT NULL,
  `created_by` varchar(100) COLLATE utf8_estonian_ci DEFAULT NULL,
  `changed` datetime DEFAULT NULL,
  `changed_by` varchar(100) COLLATE utf8_estonian_ci DEFAULT NULL,
  `deleted` datetime DEFAULT NULL,
  `deleted_by` varchar(100) COLLATE utf8_estonian_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `property_definition_keyname` (`property_definition_keyname`),
  KEY `entity_id` (`entity_id`),
  KEY `ordinal` (`ordinal`),
  KEY `language` (`language`),
  KEY `value_string` (`value_string`(255)),
  KEY `value_file` (`value_file`),
  KEY `value_reference` (`value_reference`),
  KEY `value_counter` (`value_counter`),
  KEY `relationship_id` (`relationship_id`),
  KEY `value_entity` (`value_entity`),
  CONSTRAINT `p_fk_pd`          FOREIGN KEY (`property_definition_keyname`) REFERENCES `property_definition` (`keyname`),
  CONSTRAINT `p_fk_e`           FOREIGN KEY (`entity_id`)                   REFERENCES `entity` (`id`),
  CONSTRAINT `p_fk_r`           FOREIGN KEY (`relationship_id`)             REFERENCES `relationship` (`id`),
  CONSTRAINT `p_fk_v_file`      FOREIGN KEY (`value_file`)                  REFERENCES `file` (`id`),
  CONSTRAINT `p_fk_v_reference` FOREIGN KEY (`value_reference`)             REFERENCES `entity` (`id`),
  CONSTRAINT `p_fk_v_counter`   FOREIGN KEY (`value_counter`)               REFERENCES `counter` (`id`),
  CONSTRAINT `p_fk_v_entity`    FOREIGN KEY (`value_entity`)                REFERENCES `entity` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_estonian_ci;


  `entity_id` int(11) unsigned DEFAULT NULL,
  `related_entity_id` int(11) unsigned DEFAULT NULL,
  `master_relationship_id` int(11) unsigned 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_id` (`entity_id`),
  KEY `related_entity_id` (`related_entity_id`),
  KEY `master_relationship_id` (`master_relationship_id`),
  KEY `entity_id_2` (`entity_id`,`related_entity_id`),
  KEY `r_fk_rd` (`relationship_definition_keyname`),
  KEY `r_fk_pd` (`property_definition_keyname`),
  KEY `r_fk_rpd` (`related_property_definition_keyname`),
  KEY `r_fk_ed` (`entity_definition_keyname`),
  KEY `r_fk_red` (`related_entity_definition_keyname`),
  CONSTRAINT `r_fk_red` FOREIGN KEY (`related_entity_definition_keyname`) REFERENCES `entity_definition` (`keyname`) ON UPDATE CASCADE,
  CONSTRAINT `relationship_ibfk_1` FOREIGN KEY (`entity_id`) REFERENCES `entity` (`id`),
  CONSTRAINT `relationship_ibfk_2` FOREIGN KEY (`related_entity_id`) REFERENCES `entity` (`id`),
  CONSTRAINT `relationship_ibfk_3` FOREIGN KEY (`master_relationship_id`) REFERENCES `relationship` (`id`),
  CONSTRAINT `r_fk_ed` FOREIGN KEY (`entity_definition_keyname`) REFERENCES `entity_definition` (`keyname`) ON UPDATE CASCADE,
  CONSTRAINT `r_fk_pd` FOREIGN KEY (`property_definition_keyname`) REFERENCES `property_definition` (`keyname`) ON UPDATE CASCADE,
  CONSTRAINT `r_fk_rd` FOREIGN KEY (`relationship_definition_keyname`) REFERENCES `relationship_definition` (`keyname`) ON UPDATE CASCADE,
  CONSTRAINT `r_fk_rpd` FOREIGN KEY (`related_property_definition_keyname`) REFERENCES `property_definition` (`keyname`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_estonian_ci;

-- Create syntax for TABLE 'property'
CREATE TABLE `property` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `property_definition_keyname` varchar(50) CHARACTER SET ascii COLLATE ascii_bin DEFAULT NULL,
  `created` datetime DEFAULT NULL,
  `created_by` varchar(100) COLLATE utf8_estonian_ci DEFAULT NULL,
  `changed` datetime DEFAULT NULL,
  `changed_by` varchar(100) COLLATE utf8_estonian_ci DEFAULT NULL,
  `deleted` datetime DEFAULT NULL,
  `deleted_by` varchar(100) COLLATE utf8_estonian_ci DEFAULT NULL,
  `entity_id` int(11) unsigned DEFAULT NULL,
  `ordinal` int(11) DEFAULT NULL,
  `language` varchar(10) COLLATE utf8_estonian_ci DEFAULT NULL,
