CREATE TABLE {$NAMESPACE}_semistructured.semistructured_objecttype (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
  phid VARBINARY(64) NOT NULL,
  viewPolicy varbinary(64) NOT NULL,
  editPolicy varbinary(64) NOT NULL,
  dateCreated INT UNSIGNED NOT NULL,
  dateModified INT UNSIGNED NOT NULL,

  name VARCHAR(255) NOT NULL COLLATE {$COLLATE_SORT},
  description LONGTEXT NOT NULL COLLATE {$COLLATE_TEXT},
  status VARCHAR(32) NOT NULL COLLATE {$COLLATE_TEXT},

  UNIQUE KEY `key_phid` (phid)
) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};

CREATE TABLE {$NAMESPACE}_semistructured.semistructured_objecttypetransaction
  LIKE {$NAMESPACE}_file.file_transaction;
CREATE TABLE {$NAMESPACE}_semistructured.semistructured_objecttypetransaction_comment
  LIKE {$NAMESPACE}_file.file_transaction_comment;

CREATE TABLE {$NAMESPACE}_semistructured.semistructured_objecttype_ffield
  LIKE {$NAMESPACE}_dashboard.dashboard_dashboard_ffield;
CREATE TABLE {$NAMESPACE}_semistructured.semistructured_objecttype_fdocument
  LIKE {$NAMESPACE}_dashboard.dashboard_dashboard_fdocument;
CREATE TABLE {$NAMESPACE}_semistructured.semistructured_objecttype_fngrams
  LIKE {$NAMESPACE}_dashboard.dashboard_dashboard_fngrams;
CREATE TABLE {$NAMESPACE}_semistructured.semistructured_objecttype_fngrams_common
  LIKE {$NAMESPACE}_dashboard.dashboard_dashboard_fngrams_common;
