

SET NAMES UTF8;





DROP TABLE IF EXISTS `assets`;

CREATE TABLE `assets` (

  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,

  `parentId` int(11) unsigned DEFAULT NULL,

  `type` varchar(20) DEFAULT NULL,

  `filename` varchar(255) DEFAULT '',

  `path` varchar(765) CHARACTER SET ascii DEFAULT NULL, /* path in ascii using the full key length of 765 bytes (PIMCORE-2654) */

  `mimetype` varchar(255) DEFAULT NULL,

  `creationDate` bigint(20) unsigned DEFAULT NULL,

  `modificationDate` bigint(20) unsigned DEFAULT NULL,

  `userOwner` int(11) unsigned DEFAULT NULL,

  `userModification` int(11) unsigned DEFAULT NULL,

  `customSettings` text,

  `hasMetaData` tinyint(1) NOT NULL DEFAULT '0',

  PRIMARY KEY (`id`),

  UNIQUE KEY `fullpath` (`path`,`filename`),

  KEY `parentId` (`parentId`),

  KEY `filename` (`filename`),

  KEY `path` (`path`)

) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `assets_metadata`;

CREATE TABLE `assets_metadata` (

  `cid` int(11) DEFAULT NULL,

  `name` varchar(255) DEFAULT NULL,

  `language` varchar(255) DEFAULT NULL,

  `type` ENUM('input','textarea','asset','document','object','date','select','checkbox') DEFAULT NULL,

  `data` text,

  KEY `cid` (`cid`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `assets_metadata_predefined`;

CREATE TABLE `assets_metadata_predefined` (

  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,

  `name` varchar(255) DEFAULT NULL,

  `description` text,

  `language` varchar(255) DEFAULT NULL,

  `type` enum('input','textarea','asset','document','object','date','select','checkbox') DEFAULT NULL,

  `data` text,

  `targetSubtype` enum('image', 'text', 'audio', 'video', 'document', 'archive', 'unknown') DEFAULT NULL,

  `creationDate` bigint(20) unsigned DEFAULT '0',

  `modificationDate` bigint(20) unsigned DEFAULT '0',

  `config` text,

  PRIMARY KEY (`id`),

  KEY `name` (`name`),

  KEY `id` (`id`),

  KEY `type` (`type`),

  KEY `language` (`language`),

  KEY `targetSubtype` (`targetSubtype`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `cache`;

CREATE TABLE `cache` (

  `id` varchar(165) NOT NULL DEFAULT '',

  `data` longtext,

  `mtime` bigint(20) DEFAULT NULL,

  `expire` bigint(20) DEFAULT NULL,

  PRIMARY KEY (`id`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `cache_tags`;

CREATE TABLE `cache_tags` (

  `id` varchar(165) NOT NULL DEFAULT '',

  `tag` varchar(165) NOT NULL DEFAULT '',

  PRIMARY KEY (`id`,`tag`),

  INDEX `id` (`id`),

  INDEX `tag` (`tag`)

) ENGINE=MEMORY;



DROP TABLE IF EXISTS `classes` ;

CREATE TABLE `classes` (

  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,

  `name` varchar(255) DEFAULT NULL,

  `description` text,

  `creationDate` bigint(20) unsigned DEFAULT NULL,

  `modificationDate` bigint(20) unsigned DEFAULT NULL,

  `userOwner` int(11) unsigned DEFAULT NULL,

  `userModification` int(11) unsigned DEFAULT NULL,

  `allowInherit` tinyint(1) unsigned DEFAULT '0',

  `allowVariants` tinyint(1) unsigned DEFAULT '0',

  `parentClass` varchar(255) DEFAULT NULL,

  `useTraits` varchar(255) DEFAULT NULL,

  `icon` varchar(255) DEFAULT NULL,

  `previewUrl` varchar(255) DEFAULT NULL,

  `propertyVisibility` text,

  `showVariants` tinyint(1) DEFAULT NULL,

  PRIMARY KEY (`id`),

  UNIQUE KEY `name` (`name`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `custom_layouts` ;

CREATE TABLE `custom_layouts` (

	`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,

	`classId` INT(11) UNSIGNED NOT NULL,

	`name` VARCHAR(255) NULL DEFAULT NULL,

	`description` TEXT NULL,

	`creationDate` BIGINT(20) UNSIGNED NULL DEFAULT NULL,

	`modificationDate` BIGINT(20) UNSIGNED NULL DEFAULT NULL,

	`userOwner` INT(11) UNSIGNED NULL DEFAULT NULL,

	`userModification` INT(11) UNSIGNED NULL DEFAULT NULL,

	`default` tinyint(4) NOT NULL DEFAULT '0',

	PRIMARY KEY (`id`),

	UNIQUE INDEX `name` (`name`, `classId`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `dependencies` ;

CREATE TABLE `dependencies` (

  `sourcetype` enum('document','asset','object') NOT NULL DEFAULT 'document',

  `sourceid` int(11) unsigned NOT NULL DEFAULT '0',

  `targettype` enum('document','asset','object') NOT NULL DEFAULT 'document',

  `targetid` int(11) unsigned NOT NULL DEFAULT '0',

  PRIMARY KEY (`sourcetype`,`sourceid`,`targetid`,`targettype`),

  KEY `sourceid` (`sourceid`),

  KEY `targetid` (`targetid`),

  KEY `sourcetype` (`sourcetype`),

  KEY `targettype` (`targettype`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `documents` ;

CREATE TABLE `documents` (

  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,

  `parentId` int(11) unsigned DEFAULT NULL,

  `type` enum('page','link','snippet','folder','hardlink','email') DEFAULT NULL,

  `key` varchar(255) DEFAULT '',

  `path` varchar(765) CHARACTER SET ascii DEFAULT NULL, /* path in ascii using the full key length of 765 bytes (PIMCORE-2654) */

  `index` int(11) unsigned DEFAULT '0',

  `published` tinyint(1) unsigned DEFAULT '1',

  `creationDate` bigint(20) unsigned DEFAULT NULL,

  `modificationDate` bigint(20) unsigned DEFAULT NULL,

  `userOwner` int(11) unsigned DEFAULT NULL,

  `userModification` int(11) unsigned DEFAULT NULL,

  PRIMARY KEY (`id`),

  UNIQUE KEY `fullpath` (`path`,`key`),

  KEY `parentId` (`parentId`),

  KEY `key` (`key`),

  KEY `path` (`path`),

  KEY `published` (`published`)

) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `documents_doctypes`;

CREATE TABLE `documents_doctypes` (

  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,

  `name` varchar(255) DEFAULT NULL,

  `module` varchar(255) DEFAULT NULL,

  `controller` varchar(255) DEFAULT NULL,

  `action` varchar(255) DEFAULT NULL,

  `template` varchar(255) DEFAULT NULL,

  `type` enum('page','snippet','email') DEFAULT NULL,

  `priority` int(3) DEFAULT '0',

  `creationDate` bigint(20) unsigned DEFAULT '0',

  `modificationDate` bigint(20) unsigned DEFAULT '0',

  PRIMARY KEY  (`id`),

  KEY `priority` (`priority`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `documents_elements`;

CREATE TABLE `documents_elements` (

  `documentId` int(11) unsigned NOT NULL DEFAULT '0',

  `name` varchar(255) NOT NULL DEFAULT '',

  `type` varchar(50) DEFAULT NULL,

  `data` longtext,

  PRIMARY KEY (`documentId`,`name`),

  KEY `documentId` (`documentId`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `documents_email`;

CREATE TABLE `documents_email` (

  `id` int(11) unsigned NOT NULL DEFAULT '0',

  `module` varchar(255) DEFAULT NULL,

  `controller` varchar(255) DEFAULT NULL,

  `action` varchar(255) DEFAULT NULL,

  `template` varchar(255) DEFAULT NULL,

  `to` varchar(255) DEFAULT NULL,

  `from` varchar(255) DEFAULT NULL,

  `cc` varchar(255) DEFAULT NULL,

  `bcc` varchar(255) DEFAULT NULL,

  `subject` varchar(255) DEFAULT NULL,

  PRIMARY KEY (`id`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `documents_hardlink`;

CREATE TABLE `documents_hardlink` (

  `id` int(11) DEFAULT NULL,

  `sourceId` int(11) DEFAULT NULL,

  `propertiesFromSource` tinyint(1) DEFAULT NULL,

  `childsFromSource` tinyint(1) DEFAULT NULL,

  UNIQUE KEY `id` (`id`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `documents_link`;

CREATE TABLE `documents_link` (

  `id` int(11) unsigned NOT NULL default '0',

  `internalType` enum('document','asset') default NULL,

  `internal` int(11) unsigned default NULL,

  `direct` varchar(1000) default NULL,

  `linktype` enum('direct','internal') default NULL,

  PRIMARY KEY  (`id`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `documents_page` ;

CREATE TABLE `documents_page` (

  `id` int(11) unsigned NOT NULL DEFAULT '0',

  `module` varchar(255) DEFAULT NULL,

  `controller` varchar(255) DEFAULT NULL,

  `action` varchar(255) DEFAULT NULL,

  `template` varchar(255) DEFAULT NULL,

  `title` varchar(255) DEFAULT NULL,

  `description` varchar(255) DEFAULT NULL,

  `keywords` varchar(255) DEFAULT NULL,

  `metaData` text,

  `prettyUrl` varchar(255) DEFAULT NULL,

  `contentMasterDocumentId` int(11) DEFAULT NULL,

  `css` longtext,

  `personas` varchar(255) DEFAULT NULL,

  PRIMARY KEY (`id`),

  KEY `prettyUrl` (`prettyUrl`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `documents_snippet`;

CREATE TABLE `documents_snippet` (

  `id` int(11) unsigned NOT NULL DEFAULT '0',

  `module` varchar(255) DEFAULT NULL,

  `controller` varchar(255) DEFAULT NULL,

  `action` varchar(255) DEFAULT NULL,

  `template` varchar(255) DEFAULT NULL,

  `contentMasterDocumentId` int(11) DEFAULT NULL,

  PRIMARY KEY (`id`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `edit_lock`;

CREATE TABLE `edit_lock` (

  `id` int(11) NOT NULL auto_increment,

  `cid` int(11) unsigned NOT NULL default '0',

  `ctype` enum('document','asset','object') default NULL,

  `userId` int(11) unsigned NOT NULL default '0',

  `sessionId` varchar(255) default NULL,

  `date` int(11) unsigned default NULL,

  PRIMARY KEY  (`id`),

  KEY `cid` (`cid`),

  KEY `ctype` (`ctype`),

  KEY `cidtype` (`cid`,`ctype`)

) DEFAULT CHARSET=utf8;





DROP TABLE IF EXISTS `email_blacklist`;

CREATE TABLE `email_blacklist` (

  `address` varchar(255) NOT NULL DEFAULT '',

  `creationDate` int(11) unsigned DEFAULT NULL,

  `modificationDate` int(11) unsigned DEFAULT NULL,

  PRIMARY KEY (`address`)

) DEFAULT CHARSET=utf8;





DROP TABLE IF EXISTS `email_log`;

CREATE TABLE `email_log` (

  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,

  `documentId` int(11) DEFAULT NULL,

  `requestUri` varchar(500) DEFAULT NULL,

  `params` text,

  `from` varchar(500) DEFAULT NULL,

  `to` longtext,

  `cc` longtext,

  `bcc` longtext,

  `sentDate` bigint(20) DEFAULT NULL,

  `subject` varchar(500) DEFAULT NULL,

  PRIMARY KEY (`id`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `glossary`;

CREATE TABLE `glossary` (

  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,

  `language` varchar(10) DEFAULT NULL,

  `casesensitive` tinyint(1) DEFAULT NULL,

  `exactmatch` tinyint(1) DEFAULT NULL,

  `text` varchar(255) DEFAULT NULL,

  `link` varchar(255) DEFAULT NULL,

  `abbr` varchar(255) DEFAULT NULL,

  `acronym` varchar(255) DEFAULT NULL,

  `site` int(11) unsigned DEFAULT NULL,

  `creationDate` bigint(20) unsigned DEFAULT '0',

  `modificationDate` bigint(20) unsigned DEFAULT '0',

  PRIMARY KEY (`id`),

  KEY `language` (`language`),

  KEY `site` (`site`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `http_error_log`;

CREATE TABLE `http_error_log` (

  `uri` varchar(3000) CHARACTER SET ascii DEFAULT NULL,

  `code` int(3) DEFAULT NULL,

  `parametersGet` longtext,

  `parametersPost` longtext,

  `cookies` longtext,

  `serverVars` longtext,

  `date` bigint(20) DEFAULT NULL,

  `count` bigint(20) DEFAULT NULL,

  KEY (`uri` (765)),

  KEY `code` (`code`),

  KEY `date` (`date`),

  KEY `count` (`count`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `keyvalue_groups`;

CREATE TABLE `keyvalue_groups` (

    `id` INT(11) NOT NULL AUTO_INCREMENT,

    `name` VARCHAR(255) NOT NULL DEFAULT '',

    `description` VARCHAR(255),

    `creationDate` bigint(20) unsigned DEFAULT '0',

    `modificationDate` bigint(20) unsigned DEFAULT '0',

    PRIMARY KEY  (`id`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `keyvalue_keys`;

CREATE TABLE `keyvalue_keys` (

  `id` int(11) NOT NULL AUTO_INCREMENT,

  `name` varchar(255) NOT NULL DEFAULT '',

  `description` text,

  `type` enum('bool','number','select','text','translated','translatedSelect','range') DEFAULT NULL,

  `unit` varchar(255) DEFAULT NULL,

  `possiblevalues` text,

  `group` int(11) DEFAULT NULL,

  `creationDate` bigint(20) unsigned DEFAULT '0',

  `modificationDate` bigint(20) unsigned DEFAULT '0',

  `translator` int(11) DEFAULT NULL,

	`mandatory` TINYINT(1) NULL DEFAULT NULL,

  PRIMARY KEY (`id`),

  KEY `group` (`group`),

  CONSTRAINT `keyvalue_keys_ibfk_1` FOREIGN KEY (`group`) REFERENCES `keyvalue_groups` (`id`) ON DELETE SET NULL

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `keyvalue_translator_configuration`;

CREATE TABLE `keyvalue_translator_configuration` (

  `id` INT(10) NOT NULL AUTO_INCREMENT,

  `name` VARCHAR(200) NULL DEFAULT NULL,

  `translator` VARCHAR(200) NULL DEFAULT NULL,

  PRIMARY KEY (`id`)

) DEFAULT CHARSET=utf8;





DROP TABLE IF EXISTS `locks`;

CREATE TABLE `locks` (

  `id` varchar(150) NOT NULL DEFAULT '',

  `date` int(11) unsigned DEFAULT NULL,

  PRIMARY KEY (`id`)

) ENGINE=MEMORY DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `notes`;

CREATE TABLE `notes` (

  `id` int(11) NOT NULL AUTO_INCREMENT,

  `type` varchar(255) DEFAULT NULL,

  `cid` int(11) DEFAULT NULL,

  `ctype` enum('asset','document','object') DEFAULT NULL,

  `date` int(11) DEFAULT NULL,

  `user` int(11) DEFAULT NULL,

  `title` varchar(255) DEFAULT NULL,

  `description` longtext,

  PRIMARY KEY (`id`),

  KEY `cid` (`cid`),

  KEY `ctype` (`ctype`),

  KEY `date` (`date`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `notes_data`;

CREATE TABLE `notes_data` (

  `id` int(11) NOT NULL DEFAULT '0',

  `name` varchar(255) DEFAULT NULL,

  `type` enum('text','date','document','asset','object','bool') DEFAULT NULL,

  `data` text,

  KEY `id` (`id`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `objects`;

CREATE TABLE `objects` (

  `o_id` int(11) unsigned NOT NULL AUTO_INCREMENT,

  `o_parentId` int(11) unsigned DEFAULT NULL,

  `o_type` enum('object','folder','variant') DEFAULT NULL,

  `o_key` varchar(255) default '',

  `o_path` varchar(765) CHARACTER SET ascii DEFAULT NULL, /* path in ascii using the full key length of 765 bytes (PIMCORE-2654) */

  `o_index` int(11) unsigned DEFAULT '0',

  `o_published` tinyint(1) unsigned DEFAULT '1',

  `o_creationDate` bigint(20) unsigned DEFAULT NULL,

  `o_modificationDate` bigint(20) unsigned DEFAULT NULL,

  `o_userOwner` int(11) unsigned DEFAULT NULL,

  `o_userModification` int(11) unsigned DEFAULT NULL,

  `o_classId` int(11) unsigned DEFAULT NULL,

  `o_className` varchar(255) DEFAULT NULL,

  PRIMARY KEY (`o_id`),

  UNIQUE KEY `fullpath` (`o_path`,`o_key`),

  KEY `key` (`o_key`),

  KEY `path` (`o_path`),

  KEY `published` (`o_published`),

  KEY `parentId` (`o_parentId`),

  KEY `type` (`o_type`)

) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `properties`;

CREATE TABLE `properties` (

  `cid` int(11) unsigned NOT NULL DEFAULT '0',

  `ctype` enum('document','asset','object') NOT NULL DEFAULT 'document',

  `cpath` varchar(765) CHARACTER SET ascii DEFAULT NULL, /* path in ascii using the full key length of 765 bytes (PIMCORE-2654) */

  `name` varchar(255) NOT NULL DEFAULT '',

  `type` enum('text','date','document','asset','object','bool','select') DEFAULT NULL,

  `data` text,

  `inheritable` tinyint(1) unsigned DEFAULT '1',

  PRIMARY KEY (`cid`,`ctype`,`name`),

  KEY `cpath` (`cpath`),

  KEY `inheritable` (`inheritable`),

  KEY `ctype` (`ctype`),

  KEY `cid` (`cid`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `properties_predefined`;

CREATE TABLE `properties_predefined` (

  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,

  `name` varchar(255) DEFAULT '',

  `description` text,

  `key` varchar(255) DEFAULT NULL,

  `type` enum('text','document','asset','bool','select','object') DEFAULT NULL,

  `data` text,

  `config` text,

  `ctype` enum('document','asset','object') DEFAULT NULL,

  `inheritable` tinyint(1) unsigned DEFAULT '0',

  `creationDate` bigint(20) unsigned DEFAULT '0',

  `modificationDate` bigint(20) unsigned DEFAULT '0',

  PRIMARY KEY (`id`),

  KEY `name` (`name`),

  KEY `id` (`id`),

  KEY `key` (`key`),

  KEY `type` (`type`),

  KEY `ctype` (`ctype`),

  KEY `inheritable` (`inheritable`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `recyclebin`;

CREATE TABLE `recyclebin` (

  `id` int(11) NOT NULL auto_increment,

  `type` varchar(20) default NULL,

  `subtype` varchar(20) default NULL,

  `path` varchar(765) default NULL,

  `amount` int(3) default NULL,

  `date` bigint(20) default NULL,

  `deletedby` varchar(50) DEFAULT NULL,

  PRIMARY KEY  (`id`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `redirects`;

CREATE TABLE `redirects` (

  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,

  `source` varchar(255) DEFAULT NULL,

  `sourceEntireUrl` tinyint(1) DEFAULT NULL,

  `sourceSite` int(11) DEFAULT NULL,

  `passThroughParameters` tinyint(1) DEFAULT NULL,

  `target` varchar(255) DEFAULT NULL,

  `targetSite` int(11) DEFAULT NULL,

  `statusCode` varchar(3) DEFAULT NULL,

  `priority` int(2) DEFAULT '0',

  `expiry` bigint(20) DEFAULT NULL,

  `creationDate` bigint(20) unsigned DEFAULT '0',

  `modificationDate` bigint(20) unsigned DEFAULT '0',

  PRIMARY KEY (`id`),

  KEY `priority` (`priority`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `sanitycheck`;

CREATE TABLE `sanitycheck` (

  `id` int(11) unsigned NOT NULL,

  `type` enum('document','asset','object') NOT NULL,

  PRIMARY KEY  (`id`,`type`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `schedule_tasks`;

CREATE TABLE `schedule_tasks` (

  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,

  `cid` int(11) unsigned DEFAULT NULL,

  `ctype` enum('document','asset','object') DEFAULT NULL,

  `date` bigint(20) unsigned DEFAULT NULL,

  `action` enum('publish','unpublish','delete','publish-version') DEFAULT NULL,

  `version` bigint(20) unsigned DEFAULT NULL,

  `active` tinyint(1) unsigned DEFAULT '0',

  PRIMARY KEY (`id`),

  KEY `cid` (`cid`),

  KEY `ctype` (`ctype`),

  KEY `active` (`active`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `search_backend_data`;

CREATE TABLE `search_backend_data` (

  `id` int(11) NOT NULL,

  `fullpath` varchar(765) CHARACTER SET ascii DEFAULT NULL, /* path in ascii using the full key length of 765 bytes (PIMCORE-2654) */

  `maintype` varchar(8) NOT NULL DEFAULT '',

  `type` varchar(20) DEFAULT NULL,

  `subtype` varchar(255) DEFAULT NULL,

  `published` bigint(20) DEFAULT NULL,

  `creationDate` bigint(20) DEFAULT NULL,

  `modificationDate` bigint(20) DEFAULT NULL,

  `userOwner` int(11) DEFAULT NULL,

  `userModification` int(11) DEFAULT NULL,

  `data` longtext,

  `properties` text,

  PRIMARY KEY (`id`,`maintype`),

  KEY `id` (`id`),

  KEY `fullpath` (`fullpath`),

  KEY `maintype` (`maintype`),

  KEY `type` (`type`),

  KEY `subtype` (`subtype`),

  KEY `published` (`published`),

  FULLTEXT KEY `data` (`data`),

  FULLTEXT KEY `properties` (`properties`),

  FULLTEXT KEY `fulltext` (`data`,`properties`)

) ENGINE=MyISAM DEFAULT CHARSET=utf8;

/* Engine is changed to InnoDB (if available) in Pimcore\Model\Tool\Setup\Resource::database() - not here because all comments are removed */



DROP TABLE IF EXISTS `sites`;

CREATE TABLE `sites` (

  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,

  `mainDomain` varchar(255) DEFAULT NULL,

  `domains` text,

  `rootId` int(11) unsigned DEFAULT NULL,

  `errorDocument` varchar(255) DEFAULT NULL,

  `redirectToMainDomain` tinyint(1) DEFAULT NULL,

  `creationDate` bigint(20) unsigned DEFAULT '0',

  `modificationDate` bigint(20) unsigned DEFAULT '0',

  PRIMARY KEY (`id`),

  UNIQUE KEY `rootId` (`rootId`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS  `staticroutes`;

CREATE TABLE `staticroutes` (

  `id` int(11) unsigned NOT NULL auto_increment,

  `name` varchar(50) default NULL,

  `pattern` varchar(255) default NULL,

  `reverse` varchar(255) default NULL,

  `module` varchar(255) default NULL,

  `controller` varchar(255) default NULL,

  `action` varchar(255) default NULL,

  `variables` varchar(255) default NULL,

  `defaults` varchar(255) default NULL,

  `siteId` int(11) DEFAULT NULL,

  `priority` int(3) DEFAULT '0',

  `creationDate` bigint(20) unsigned DEFAULT '0',

  `modificationDate` bigint(20) unsigned DEFAULT '0',

  PRIMARY KEY  (`id`),

  KEY `priority` (`priority`),

  KEY `name` (`name`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `targeting_personas`;

CREATE TABLE `targeting_personas` (

  `id` int(11) NOT NULL AUTO_INCREMENT,

  `name` varchar(255) NOT NULL DEFAULT '',

  `description` text,

  `conditions` longtext,

  `threshold` int(11) DEFAULT NULL,

  `active` tinyint(1) DEFAULT NULL,

  PRIMARY KEY (`id`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `targeting_rules`;

CREATE TABLE `targeting_rules` (

  `id` int(11) NOT NULL AUTO_INCREMENT,

  `name` varchar(255) NOT NULL DEFAULT '',

  `description` text,

  `scope` varchar(50) DEFAULT NULL,

  `active` tinyint(1) DEFAULT NULL,

  `conditions` longtext,

  `actions` longtext,

  PRIMARY KEY (`id`)

) DEFAULT CHARSET=utf8;



CREATE TABLE `tmp_store` (

  `id` varchar(255) NOT NULL DEFAULT '',

  `tag` varchar(255) DEFAULT NULL,

  `data` longtext,

  `serialized` tinyint(2) NOT NULL DEFAULT '0',

  `date` int(10) DEFAULT NULL,

  `expiryDate` int(10) DEFAULT NULL,

  PRIMARY KEY (`id`),

  KEY `tag` (`tag`),

  KEY `date` (`date`),

  KEY `expiryDate` (`expiryDate`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `tracking_events`;

CREATE TABLE `tracking_events` (

  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,

  `category` varchar(255) DEFAULT NULL,

  `action` varchar(255) DEFAULT NULL,

  `label` varchar(255) DEFAULT NULL,

  `data` varchar(255) DEFAULT NULL,

  `timestamp` bigint(20) unsigned DEFAULT NULL,

  `year` int(5) unsigned DEFAULT NULL,

  `month` int(2) unsigned DEFAULT NULL,

  `day` int(2) unsigned DEFAULT NULL,

  `dayOfWeek` int(1) unsigned DEFAULT NULL,

  `dayOfYear` int(3) unsigned DEFAULT NULL,

  `weekOfYear` int(2) unsigned DEFAULT NULL,

  `hour` int(2) unsigned DEFAULT NULL,

  `minute` int(2) unsigned DEFAULT NULL,

  `second` int(2) unsigned DEFAULT NULL,

  PRIMARY KEY (`id`),

  KEY `timestamp` (`timestamp`),

  KEY `year` (`year`),

  KEY `month` (`month`),

  KEY `day` (`day`),

  KEY `dayOfWeek` (`dayOfWeek`),

  KEY `dayOfYear` (`dayOfYear`),

  KEY `weekOfYear` (`weekOfYear`),

  KEY `hour` (`hour`),

  KEY `minute` (`minute`),

  KEY `second` (`second`),

  KEY `category` (`category`),

  KEY `action` (`action`),

  KEY `label` (`label`),

  KEY `data` (`data`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `translations_admin`;

CREATE TABLE `translations_admin` (

  `key` varchar(255) NOT NULL DEFAULT '',

  `language` varchar(10) NOT NULL DEFAULT '',

  `text` text,

  `creationDate` bigint(20) unsigned DEFAULT NULL,

  `modificationDate` bigint(20) unsigned DEFAULT NULL,

  PRIMARY KEY (`key`,`language`),

  KEY `language` (`language`),

  KEY `key` (`key`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `translations_website`;

CREATE TABLE `translations_website` (

  `key` varchar(255) NOT NULL DEFAULT '',

  `language` varchar(10) NOT NULL DEFAULT '',

  `text` text,

  `creationDate` bigint(20) unsigned DEFAULT NULL,

  `modificationDate` bigint(20) unsigned DEFAULT NULL,

  PRIMARY KEY (`key`,`language`),

  KEY `language` (`language`),

  KEY `key` (`key`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `tree_locks`;

CREATE TABLE `tree_locks` (

  `id` int(11) NOT NULL DEFAULT '0',

  `type` enum('asset','document','object') NOT NULL DEFAULT 'asset',

  `locked` enum('self','propagate') default NULL,

  PRIMARY KEY (`id`,`type`),

  KEY `id` (`id`),

  KEY `type` (`type`),

  KEY `locked` (`locked`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `users`;

CREATE TABLE `users` (

  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,

  `parentId` int(11) unsigned DEFAULT NULL,

  `type` enum('user','userfolder','role','rolefolder') NOT NULL DEFAULT 'user',

  `name` varchar(50) DEFAULT NULL,

  `password` varchar(255) DEFAULT NULL,

  `firstname` varchar(255) DEFAULT NULL,

  `lastname` varchar(255) DEFAULT NULL,

  `email` varchar(255) DEFAULT NULL,

  `language` varchar(10) DEFAULT NULL,

  `admin` tinyint(1) unsigned DEFAULT '0',

  `active` tinyint(1) unsigned DEFAULT '1',

  `permissions` varchar(1000) DEFAULT NULL,

  `roles` varchar(1000) DEFAULT NULL,

  `welcomescreen` tinyint(1) DEFAULT NULL,

  `closeWarning` tinyint(1) DEFAULT NULL,

  `memorizeTabs` tinyint(1) DEFAULT NULL,

  `docTypes` varchar(255) DEFAULT NULL,

  `classes` varchar(255) DEFAULT NULL,

  `apiKey` varchar(255) DEFAULT NULL,

  PRIMARY KEY (`id`),

  UNIQUE KEY `type_name` (`type`,`name`),

  KEY `parentId` (`parentId`),

  KEY `name` (`name`),

  KEY `password` (`password`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `users_permission_definitions`;

CREATE TABLE `users_permission_definitions` (

  `key` varchar(50) NOT NULL DEFAULT '',

  PRIMARY KEY (`key`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `users_workspaces_asset`;

CREATE TABLE `users_workspaces_asset` (

  `cid` int(11) unsigned NOT NULL DEFAULT '0',

  `cpath` varchar(765) CHARACTER SET ascii DEFAULT NULL, /* path in ascii using the full key length of 765 bytes (PIMCORE-2654) */

  `userId` int(11) NOT NULL DEFAULT '0',

  `list` tinyint(1) DEFAULT '0',

  `view` tinyint(1) DEFAULT '0',

  `publish` tinyint(1) DEFAULT '0',

  `delete` tinyint(1) DEFAULT '0',

  `rename` tinyint(1) DEFAULT '0',

  `create` tinyint(1) DEFAULT '0',

  `settings` tinyint(1) DEFAULT '0',

  `versions` tinyint(1) DEFAULT '0',

  `properties` tinyint(1) DEFAULT '0',

  PRIMARY KEY (`cid`, `userId`),

  KEY `cid` (`cid`),

  KEY `userId` (`userId`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `users_workspaces_document`;

CREATE TABLE `users_workspaces_document` (

  `cid` int(11) unsigned NOT NULL DEFAULT '0',

  `cpath` varchar(765) CHARACTER SET ascii DEFAULT NULL, /* path in ascii using the full key length of 765 bytes (PIMCORE-2654) */

  `userId` int(11) NOT NULL DEFAULT '0',

  `list` tinyint(1) unsigned DEFAULT '0',

  `view` tinyint(1) unsigned DEFAULT '0',

  `save` tinyint(1) unsigned DEFAULT '0',

  `publish` tinyint(1) unsigned DEFAULT '0',

  `unpublish` tinyint(1) unsigned DEFAULT '0',

  `delete` tinyint(1) unsigned DEFAULT '0',

  `rename` tinyint(1) unsigned DEFAULT '0',

  `create` tinyint(1) unsigned DEFAULT '0',

  `settings` tinyint(1) unsigned DEFAULT '0',

  `versions` tinyint(1) unsigned DEFAULT '0',

  `properties` tinyint(1) unsigned DEFAULT '0',

  PRIMARY KEY (`cid`, `userId`),

  KEY `cid` (`cid`),

  KEY `userId` (`userId`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `users_workspaces_object`;

CREATE TABLE `users_workspaces_object` (

  `cid` int(11) unsigned NOT NULL DEFAULT '0',

  `cpath` varchar(765) CHARACTER SET ascii DEFAULT NULL, /* path in ascii using the full key length of 765 bytes (PIMCORE-2654) */

  `userId` int(11) NOT NULL DEFAULT '0',

  `list` tinyint(1) unsigned DEFAULT '0',

  `view` tinyint(1) unsigned DEFAULT '0',

  `save` tinyint(1) unsigned DEFAULT '0',

  `publish` tinyint(1) unsigned DEFAULT '0',

  `unpublish` tinyint(1) unsigned DEFAULT '0',

  `delete` tinyint(1) unsigned DEFAULT '0',

  `rename` tinyint(1) unsigned DEFAULT '0',

  `create` tinyint(1) unsigned DEFAULT '0',

  `settings` tinyint(1) unsigned DEFAULT '0',

  `versions` tinyint(1) unsigned DEFAULT '0',

  `properties` tinyint(1) unsigned DEFAULT '0',

  `lEdit` text,

  `lView` text,

  `layouts` text,

  PRIMARY KEY (`cid`, `userId`),

  KEY `cid` (`cid`),

  KEY `userId` (`userId`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `uuids`;

CREATE TABLE `uuids` (

  `uuid` CHAR(36) NOT NULL,

  `itemId` BIGINT(20) UNSIGNED NOT NULL,

  `type` VARCHAR(25) NOT NULL,

  `instanceIdentifier` VARCHAR(50) NOT NULL,

  UNIQUE INDEX `itemId_type_uuid` (`itemId`, `type`, `uuid`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `versions`;

CREATE TABLE `versions` (

  `id` bigint(20) unsigned NOT NULL auto_increment,

  `cid` int(11) unsigned default NULL,

  `ctype` enum('document','asset','object') default NULL,

  `userId` int(11) unsigned default NULL,

  `note` text,

  `date` bigint(1) unsigned default NULL,

  `public` tinyint(1) unsigned NOT NULL default '0',

  `serialized` tinyint(1) unsigned default '0',

  PRIMARY KEY  (`id`),

  KEY `cid` (`cid`),

  KEY `ctype` (`ctype`)

) DEFAULT CHARSET=utf8;



DROP TABLE IF EXISTS `website_settings`;

CREATE TABLE `website_settings` (

	`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,

	`name` VARCHAR(255) NOT NULL DEFAULT '',

	`type` ENUM('text','document','asset','object','bool') DEFAULT NULL,

	`data` TEXT,

	`siteId` INT(11) UNSIGNED DEFAULT NULL,

	`creationDate` BIGINT(20) UNSIGNED DEFAULT '0',

	`modificationDate` BIGINT(20) UNSIGNED DEFAULT '0',

	PRIMARY KEY (`id`),

	INDEX `name` (`name`),

	INDEX `siteId` (`siteId`)

)

DEFAULT CHARSET=utf8;

