-- ### --
-- ### --
DROP TABLE IF EXISTS `bannercategories`;
-- ### --
-- ### --
CREATE TABLE `bannercategories` (
`id`    INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`title` VARCHAR(255)     NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
DROP TABLE IF EXISTS `banners`;
-- ### --
-- ### --
CREATE TABLE `banners` (
`id`                      INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`name`                    VARCHAR(255)NOT NULL DEFAULT '',
`bannercategory_id`       INT(11)     NOT NULL DEFAULT '0',
`title`                   VARCHAR(255)NOT NULL DEFAULT '',
`id_attribute`            VARCHAR(255)NOT NULL DEFAULT '',
`show_from`               DATETIME    NOT NULL,
`show_to`                 DATETIME    NOT NULL,
`active`                  INT(11)     NOT NULL DEFAULT '0',
`target_blank`            INT(11)     NOT NULL DEFAULT '0',
`rel_nofollow`            INT(11)     NOT NULL DEFAULT '0',
`mode`                    INT(11)     NOT NULL DEFAULT '0',
`banner_href`             VARCHAR(255)NOT NULL DEFAULT '',
`banner_file`             VARCHAR(255)NOT NULL DEFAULT '',
`target_href`             VARCHAR(255)NOT NULL DEFAULT '',
`flash_background_color`  VARCHAR(255)NOT NULL DEFAULT '',
`flash_width`             INT(11)     NOT NULL DEFAULT '0',
`flash_height`            INT(11)     NOT NULL DEFAULT '0',
`filter_type_id`          TEXT,
`filter_category_id`      TEXT,
`filter_template_id`      TEXT,
PRIMARY KEY (`id`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
DROP TABLE IF EXISTS `discounts`;
-- ### --
-- ### --
CREATE TABLE `discounts` (
`id`              INT(11) NOT NULL AUTO_INCREMENT,
`discounttype_id` INT(11) NOT NULL DEFAULT '0',
`entity_id`       INT(11) NOT NULL DEFAULT '0',
`discount`        INT(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `discounttype_id` (`discounttype_id`),
KEY `entity_id` (`entity_id`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
DROP TABLE IF EXISTS `discountupdates`;
-- ### --
-- ### --
CREATE TABLE `discountupdates` (
`template_id`       INT(11)  NOT NULL DEFAULT '0',
`discounted_price`  INT(11)  NOT NULL DEFAULT '0',
PRIMARY KEY (`template_id`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
DROP TABLE IF EXISTS `editorlogs`;
-- ### --
-- ### --
CREATE TABLE `editorlogs` (
`id`           INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`action_time`  DATETIME         NOT NULL,
`editor_login` VARCHAR(255)     NOT NULL DEFAULT '',
`editor_ip`    INT(15) UNSIGNED NOT NULL DEFAULT '0',
`log_action`   VARCHAR(255)     NOT NULL DEFAULT '',
`log_object`   VARCHAR(255)     NOT NULL DEFAULT '',
`log_changes`  TEXT,
PRIMARY KEY (`id`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
DROP TABLE IF EXISTS `editors`;
-- ### --
-- ### --
CREATE TABLE `editors` (
`id`        INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`name`      VARCHAR(255)     NOT NULL DEFAULT '',
`login`     VARCHAR(255)     NOT NULL DEFAULT '',
`password`  VARCHAR(255)     NOT NULL DEFAULT '',
`is_active` TINYINT(1)       NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
DROP TABLE IF EXISTS `menus`;
-- ### --
-- ### --
CREATE TABLE `menus` (
`id`              INT(10)      NOT NULL AUTO_INCREMENT,
`userpage_id`     INT(10)      NOT NULL DEFAULT '0',
`virtualTypeName` VARCHAR(128) NOT NULL DEFAULT ''
COMMENT 'TM virtyal type name',
`position`        INT(10)      NOT NULL DEFAULT '0'
COMMENT 'position on main page',
`enable`          INT(2)       NOT NULL DEFAULT '0'
COMMENT 'show\\hide on main page',
PRIMARY KEY (`id`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
DROP TABLE IF EXISTS `pages`;
-- ### --
-- ### --
CREATE TABLE `pages` (
`id`            INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`name`          VARCHAR(255)     NOT NULL DEFAULT '',
`link_class`    INT(11)          NOT NULL DEFAULT '0',
`url_name`      VARCHAR(255)     NOT NULL DEFAULT '',
`redirect_to`   VARCHAR(255)     NOT NULL DEFAULT '',
`href`          VARCHAR(255)     NOT NULL DEFAULT '',
`visibility`    INT(11)          NOT NULL DEFAULT '0',
`html_name`     VARCHAR(255)     NOT NULL DEFAULT '',
`list_name`     VARCHAR(255)     NOT NULL DEFAULT '',
`position`      INT(11)          NOT NULL DEFAULT '0',
`status`        TINYINT(1)       NOT NULL DEFAULT '0',
`layout`        VARCHAR(255)     NOT NULL DEFAULT '',
`target_blank`  INT(11)          NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
DROP TABLE IF EXISTS `screenshot_hrefs`;
-- ### --
-- ### --
CREATE TABLE `screenshot_hrefs` (
`id`    INT(11)     NOT NULL DEFAULT '0',
`href`  VARCHAR(255)NOT NULL default '',
PRIMARY KEY (`id`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
DROP TABLE IF EXISTS `screenshotdescriptions`;
-- ### --
-- ### --
CREATE TABLE `screenshotdescriptions` (
`id`          INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`description` VARCHAR(255)     NOT NULL  DEFAULT '',
PRIMARY KEY (`id`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
DROP TABLE IF EXISTS `screenshots`;
-- ### --
-- ### --
CREATE TABLE `screenshots` (
`id`                        INT(11)     NOT NULL DEFAULT '0',
`uri`                       VARCHAR(255)NOT NULL DEFAULT '',
`width`                     INT(11)     NOT NULL DEFAULT '0',
`height`                    INT(11)     NOT NULL DEFAULT '0',
`screenshot_href_id`        INT(11)     NOT NULL DEFAULT '0',
`screenshot_description_id` INT(11)     NOT NULL DEFAULT '0',
`template_id`               INT(11)     NOT NULL DEFAULT '0',
`is_wide`                   TINYINT(1)  NOT NULL DEFAULT '0',
`position`                  INT(11)     NOT NULL DEFAULT '0',
`nobr`                      TINYINT(4)  NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `template_id` (`template_id`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
DROP TABLE IF EXISTS `screenshots_templatesubsections`;
-- ### --
-- ### --
CREATE TABLE `screenshots_templatesubsections` (
`screenshot_id`          INT(11)  NOT NULL DEFAULT '0',
`templatesubsection_id`  INT(11)  NOT NULL DEFAULT '0',
PRIMARY KEY (`screenshot_id`, `templatesubsection_id`),
KEY `templatesubsection_id` (`templatesubsection_id`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
DROP TABLE IF EXISTS `searches`;
-- ### --
-- ### --
CREATE TABLE `searches` (
`id`             INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`visible_id`     VARCHAR(32)      NOT NULL DEFAULT '',
`params`         TEXT ,
`date_last_used` DATETIME         NOT NULL,
PRIMARY KEY (`id`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
DROP TABLE IF EXISTS `settings`;
-- ### --
-- ### --
CREATE TABLE `settings` (
`id`          VARCHAR(32)  NOT NULL default '',
`value`       TEXT,
`description` VARCHAR(255) NOT NULL DEFAULT '',
`read_only`   TINYINT(1)   NOT NULL DEFAULT '0',
`preserved`   TINYINT(1)   NOT NULL DEFAULT '0',
`type`        INT(11)      NOT NULL DEFAULT '0',
`status`      INT(11)      NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
DROP TABLE IF EXISTS `submenus`;
-- ### --
-- ### --
CREATE TABLE `submenus` (
`catalog_name` VARCHAR(255) NOT NULL DEFAULT '',
`aliasid`      INT(10)      NOT NULL DEFAULT '0',
`menu_id`      INT(10)      NOT NULL DEFAULT '0',
`position`     INT(10)      NOT NULL DEFAULT '0',
`sort`         INT(10)      NOT NULL DEFAULT '0',
`id`           INT(11)      NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`),
KEY `menu_id_index` (`menu_id`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
DROP TABLE IF EXISTS `subsections`;
-- ### --
-- ### --
CREATE TABLE `subsections` (
`id`          INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`description` VARCHAR(255)     NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
KEY `description` (`description`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
DROP TABLE IF EXISTS `templateauthors`;
-- ### --
-- ### --
CREATE TABLE `templateauthors` (
`id`              INT(11)     NOT NULL DEFAULT '0',
`name`            VARCHAR(255)NOT NULL DEFAULT '',
`template_count`  INT(11)     NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
DROP TABLE IF EXISTS `templatecategories`;
-- ### --
-- ### --
CREATE TABLE `templatecategories` (
`id`                      INT(11)  NOT NULL DEFAULT '0',
`name`                    VARCHAR(255)     NOT NULL DEFAULT '',
`url_name`                VARCHAR(255)     NOT NULL DEFAULT '',
`is_edited`               INT(11)  NOT NULL DEFAULT '0',
`visibility`              INT(11)  NOT NULL DEFAULT '0',
`html_name`               VARCHAR(255)     NOT NULL DEFAULT '',
`list_name`               VARCHAR(255)     NOT NULL DEFAULT '',
`position`                INT(11)  NOT NULL DEFAULT '0',
`template_count`          INT(11)  NOT NULL DEFAULT '0',
`layout`                  VARCHAR(255)     NOT NULL DEFAULT '',
`enabled_template_count`  INT(11)  NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
DROP TABLE IF EXISTS `templatecategories_templates`;
-- ### --
-- ### --
CREATE TABLE `templatecategories_templates` (
`template_id`          INT(11)  NOT NULL DEFAULT '0',
`templatecategory_id`  INT(11)  NOT NULL DEFAULT '0',
PRIMARY KEY (`template_id`, `templatecategory_id`),
KEY `templatecategory_id` (`templatecategory_id`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
DROP TABLE IF EXISTS `templatekeywords`;
-- ### --
-- ### --
CREATE TABLE `templatekeywords` (
`id`    INT(11)  NOT NULL DEFAULT '0',
`name` VARCHAR(255)     NOT NULL  default '',
PRIMARY KEY (`id`),
KEY `name_index` (`name`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
DROP TABLE IF EXISTS `templatekeywords_templates`;
-- ### --
-- ### --
CREATE TABLE `templatekeywords_templates` (
`template_id`         INT(11)  NOT NULL DEFAULT '0',
`templatekeyword_id`  INT(11)  NOT NULL DEFAULT '0',
PRIMARY KEY (`template_id`, `templatekeyword_id`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
DROP TABLE IF EXISTS `templatepackages`;
-- ### --
-- ### --
CREATE TABLE `templatepackages` (
`id`              INT(11)  NOT NULL DEFAULT '0',
`name`           VARCHAR(255) NOT NULL  default '',
`list_name`      VARCHAR(255) NOT NULL default '',
`html_name`      VARCHAR(255) NOT NULL default '',
`description`    VARCHAR(255) NOT NULL default '',
`user_name`      VARCHAR(255) NOT NULL default '',
`is_edited`       INT(11)     NOT NULL DEFAULT '0',
`is_blocked`      INT(11)     NOT NULL DEFAULT '0',
`template_count`  INT(11)     NOT NULL DEFAULT '0',
`url_name`       VARCHAR(255) NOT NULL default '',
`visibility`     INT(11)      NOT NULL DEFAULT '1',
`layout`         VARCHAR(255) NOT NULL default '',
`position`        INT(11)     NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
DROP TABLE IF EXISTS `templates`;
-- ### --
-- ### --
CREATE TABLE `templates` (
`id`                          INT(11)  NOT NULL DEFAULT '0',
`price`                       INT(11)  NOT NULL DEFAULT '0',
`discounted_price`            INT(11)  NOT NULL DEFAULT '0',
`exc_price`                   INT(11)  NOT NULL DEFAULT '0',
`download_count`              INT(11)  NOT NULL DEFAULT '0',
`is_adult`                   TINYINT(1) NOT NULL  DEFAULT '0',
`templateauthor_id`           INT(11)  NOT NULL DEFAULT '0',
`templatetype_id`             INT(11)  NOT NULL DEFAULT '0',
`templatepackage_id`          INT(11)  NOT NULL DEFAULT '0',
`inserted_date`              DATETIME   NOT NULL,
`updated_date`               DATETIME   NOT NULL,
`small_preview_id`            INT(11)  NOT NULL DEFAULT '0',
`large_preview_id`            INT(11)  NOT NULL DEFAULT '0',
`hash`                       VARCHAR(32)NOT NULL default '',
`screenshot_download_status` TINYINT(1) NOT NULL DEFAULT '0',
`disabled`                   TINYINT(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `screenshot_download_status` (`screenshot_download_status`),
KEY `templatetype_id` (`templatetype_id`),
KEY `disabled` (`disabled`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
DROP TABLE IF EXISTS `templates_templatesoftwares`;
-- ### --
-- ### --
CREATE TABLE `templates_templatesoftwares` (
`template_id`          INT(11)  NOT NULL DEFAULT '0',
`templatesoftware_id`  INT(11)  NOT NULL DEFAULT '0',
PRIMARY KEY (`template_id`, `templatesoftware_id`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
DROP TABLE IF EXISTS `templates_templatesources`;
-- ### --
-- ### --
CREATE TABLE `templates_templatesources` (
`template_id`        INT(11)  NOT NULL DEFAULT '0',
`templatesource_id`  INT(11)  NOT NULL DEFAULT '0',
PRIMARY KEY (`template_id`, `templatesource_id`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
DROP TABLE IF EXISTS `templates_templatestyles`;
-- ### --
-- ### --
CREATE TABLE `templates_templatestyles` (
`template_id`       INT(11)  NOT NULL DEFAULT '0',
`templatestyle_id`  INT(11)  NOT NULL DEFAULT '0',
PRIMARY KEY (`template_id`, `templatestyle_id`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
DROP TABLE IF EXISTS `templatesoftwares`;
-- ### --
-- ### --
CREATE TABLE `templatesoftwares` (
`id`    INT(11)  NOT NULL DEFAULT '0',
`name`  TEXT,
PRIMARY KEY (`id`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
DROP TABLE IF EXISTS `templatesources`;
-- ### --
-- ### --
CREATE TABLE `templatesources` (
`id`    INT(11)  NOT NULL DEFAULT '0',
`name` VARCHAR(255) NOT NULL  default '',
PRIMARY KEY (`id`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
DROP TABLE IF EXISTS `templatestyles`;
-- ### --
-- ### --
CREATE TABLE `templatestyles` (
`id`    INT(11)      NOT NULL DEFAULT '0',
`name`  VARCHAR(255) NOT NULL  default '',
PRIMARY KEY (`id`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
DROP TABLE IF EXISTS `templatesubsections`;
-- ### --
-- ### --
CREATE TABLE `templatesubsections` (
`id`             INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`template_id`    INT(11) NOT NULL DEFAULT '0',
`subsection_id`  INT(11) NOT NULL DEFAULT '0',
`position`       INT(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `template_id` (`template_id`),
KEY `subsection_id` (`subsection_id`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
DROP TABLE IF EXISTS `templatetypes`;
-- ### --
-- ### --
CREATE TABLE `templatetypes` (
`id`                      INT(11)  NOT NULL DEFAULT '0',
`name`                    VARCHAR(255)     NOT NULL  default '',
`url_name`                VARCHAR(255)     NOT NULL  default '',
`is_edited`               INT(11)          NOT NULL default '0',
`visibility`              INT(11)  NOT NULL DEFAULT '0',
`html_name`               VARCHAR(255)     NOT NULL  default '',
`list_name`               VARCHAR(255)     NOT NULL default '',
`position`                INT(11)          NOT NULL default '0',
`position_featured`       INT(11) default '0',
`template_count`          INT(11)          NOT NULL default '0',
`layout`                  VARCHAR(255)     NOT NULL default '',
`enabled_template_count`  INT(11)          NOT NULL default '0',
PRIMARY KEY (`id`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
DROP TABLE IF EXISTS `text_contents`;
-- ### --
-- ### --
CREATE TABLE `text_contents` (
`id`        INT(11)  UNSIGNED NOT NULL AUTO_INCREMENT,
`text_id`   INT(11)  NOT NULL DEFAULT '0',
`table`     INT(11)  NOT NULL DEFAULT '0',
`table_id`  INT(11)  NOT NULL DEFAULT '0',
`title`    VARCHAR(255) DEFAULT NULL  default '',
`content`  LONGTEXT,
PRIMARY KEY (`id`),
UNIQUE KEY `PRIMARY_REAL` (`text_id`, `table`, `table_id`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
DROP TABLE IF EXISTS `texts`;
-- ### --
-- ### --
CREATE TABLE `texts` (
`id`       INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`name`     VARCHAR(255)     NOT NULL  default '',
`is_plain` TINYINT(1)       NOT NULL DEFAULT '0',
`type`      INT(11)  NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `type` (`type`)
)
ENGINE =InnoDB
DEFAULT CHARSET =utf8;
-- ### --
-- ### --
