CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_product_comment` (
    `id_ets_rv_product_comment` int(10) unsigned NOT NULL auto_increment,
    `id_product` int(10) unsigned NOT NULL,
    `id_customer` int(10) unsigned NOT NULL,
    `id_guest` int(10) unsigned NULL,
    `customer_name` varchar(64) NULL,
    `email` VARCHAR(255) DEFAULT NULL,
    `grade` float unsigned NOT NULL,
    `validate` tinyint(1) NOT NULL,
    `deleted` tinyint(1) NOT NULL,
    `publish_all_language` tinyint(1) NOT NULL DEFAULT 1,
    `question` tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
    `id_country` INT(11) NOT NULL DEFAULT 0,
    `verified_purchase` varchar(6) NOT NULL DEFAULT 'auto',
    `date_add` datetime NOT NULL,
    `upd_date` datetime DEFAULT NULL,
    PRIMARY KEY (`id_ets_rv_product_comment`),
    KEY `idx_id_product` (`id_product`),
    KEY `idx_id_customer` (`id_customer`),
    KEY `idx_id_guest` (`id_guest`)
) ENGINE=ENGINE_TYPE COLLATE=utf8mb4_general_ci DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_product_comment_lang` (
    `id_ets_rv_product_comment` int(10) unsigned NOT NULL,
    `id_lang` int(10) unsigned NOT NULL,
    `title` varchar(64) NULL,
    `content` text NOT NULL,
    PRIMARY KEY (`id_ets_rv_product_comment`, `id_lang`)
) ENGINE=ENGINE_TYPE COLLATE=utf8mb4_general_ci DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_product_comment_publish_lang` (
    `id_ets_rv_product_comment` int(10) unsigned NOT NULL,
    `id_lang` int(10) unsigned NOT NULL,
    PRIMARY KEY (`id_ets_rv_product_comment`, `id_lang`)
) ENGINE=ENGINE_TYPE  DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_product_comment_origin_lang` (
    `id_ets_rv_product_comment` int(10) unsigned NOT NULL,
    `id_lang` int(10) unsigned NOT NULL,
    `title` varchar(64) NULL,
    `content` text NOT NULL,
    PRIMARY KEY (`id_ets_rv_product_comment`, `id_lang`)
) ENGINE=ENGINE_TYPE COLLATE=utf8mb4_general_ci DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_product_comment_cart_rule` (
  `id_cart_rule` int(11) UNSIGNED NOT NULL,
  `id_product` int(11) UNSIGNED NOT NULL,
  `id_customer` int(11) UNSIGNED NOT NULL,
  PRIMARY KEY (`id_cart_rule`, `id_product`, `id_customer`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_product_comment_image` (
  `id_ets_rv_product_comment_image` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  `id_ets_rv_product_comment` int(11) UNSIGNED NOT NULL,
  `image` varchar(500) NOT NULL,
  `position` int(11) UNSIGNED NOT NULL,
  PRIMARY KEY (`id_ets_rv_product_comment_image`),
  KEY `id_ets_rv_product_comment` (`id_ets_rv_product_comment`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_product_comment_video` (
    `id_ets_rv_product_comment_video` INT(11) NOT NULL AUTO_INCREMENT ,
    `id_ets_rv_product_comment` int(11) UNSIGNED NOT NULL,
    `video` VARCHAR(500) NOT NULL ,
    `type` VARCHAR(32) NOT NULL ,
    `position` INT(11) NOT NULL ,
     PRIMARY KEY (`id_ets_rv_product_comment_video`), INDEX (`position`),INDEX(`id_ets_rv_product_comment`) ) ENGINE= ENGINE_TYPE COLLATE=utf8mb4_general_ci DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_product_comment_criterion` (
    `id_ets_rv_product_comment_criterion` int(10) unsigned NOT NULL auto_increment,
    `id_product_comment_criterion_type` tinyint(1) NOT NULL,
    `active` tinyint(1) NOT NULL,
    `deleted` tinyint(1) NOT NULL DEFAULT 0,
    PRIMARY KEY (`id_ets_rv_product_comment_criterion`)
) ENGINE=ENGINE_TYPE  DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_product_comment_criterion_product` (
    `id_product` int(10) unsigned NOT NULL,
    `id_ets_rv_product_comment_criterion` int(10) unsigned NOT NULL,
    PRIMARY KEY(`id_product`, `id_ets_rv_product_comment_criterion`),
    KEY `idx_id_product_comment_criterion` (`id_ets_rv_product_comment_criterion`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_product_comment_criterion_lang` (
    `id_ets_rv_product_comment_criterion` INT(11) UNSIGNED NOT NULL ,
    `id_lang` INT(11) UNSIGNED NOT NULL ,
    `name` VARCHAR(64) NOT NULL ,
    PRIMARY KEY ( `id_ets_rv_product_comment_criterion` , `id_lang` )
) ENGINE=ENGINE_TYPE COLLATE=utf8mb4_general_ci DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_product_comment_criterion_category` (
    `id_ets_rv_product_comment_criterion` int(10) unsigned NOT NULL,
    `id_category` int(10) unsigned NOT NULL,
    PRIMARY KEY(`id_ets_rv_product_comment_criterion`, `id_category`),
    KEY `id_category` (`id_category`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_product_comment_grade` (
    `id_ets_rv_product_comment` int(10) unsigned NOT NULL,
    `id_ets_rv_product_comment_criterion` int(10) unsigned NOT NULL,
    `grade` int(10) unsigned NOT NULL,
    PRIMARY KEY (`id_ets_rv_product_comment`, `id_ets_rv_product_comment_criterion`),
    KEY `idx_id_product_comment_criterion` (`id_ets_rv_product_comment_criterion`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_product_comment_usefulness` (
    `id_ets_rv_product_comment` int(10) unsigned NOT NULL,
    `id_customer` int(10) unsigned NOT NULL,
    `usefulness` tinyint(1) unsigned NOT NULL,
    `employee`   int(10) UNSIGNED NOT NULL DEFAULT 0,
    `question` tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
    PRIMARY KEY (`id_ets_rv_product_comment`, `id_customer`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_product_comment_report` (
    `id_ets_rv_product_comment` int(10) unsigned NOT NULL,
    `id_customer` int(10) unsigned NOT NULL,
    `question` tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
    PRIMARY KEY (`id_ets_rv_product_comment`, `id_customer`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_product_comment_customer` (
    `id_customer` INT(11) UNSIGNED NOT NULL,
    `display_name` VARCHAR(255) NULL,
    `avatar` VARCHAR(500) NULL DEFAULT NULL,
    `is_block` tinyint(1) NOT NULL,
    `is_staff` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
    PRIMARY KEY (`id_customer`)
) ENGINE = ENGINE_TYPE DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_comment`(
    `id_ets_rv_comment`         int(11) UNSIGNED    NOT NULL AUTO_INCREMENT,
    `id_ets_rv_product_comment` int(11) UNSIGNED    NOT NULL,
    `id_customer`               int(11) UNSIGNED    NOT NULL,
    `employee`                  int(10) UNSIGNED NOT NULL DEFAULT 0,
    `question`                  tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
    `answer`                    tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
    `useful_answer`             tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
    `validate`                  tinyint(1) UNSIGNED NOT NULL,
    `deleted`                   tinyint(1) UNSIGNED NOT NULL,
    `date_add`                  datetime            NOT NULL,
    `upd_date`                  datetime DEFAULT NULL,
    PRIMARY KEY (`id_ets_rv_comment`),
    UNIQUE KEY `idx_customer_employee` (`id_customer`, `employee`, `id_ets_rv_comment`),
    KEY `id_ets_rv_product_comment` (`id_ets_rv_product_comment`),
    KEY `id_customer` (`id_customer`)
) ENGINE = ENGINE_TYPE CHARSET = utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_comment_lang`(
    `id_ets_rv_comment` INT(11) UNSIGNED NOT NULL,
    `id_lang`           INT(11) UNSIGNED NOT NULL,
    `content`           TEXT             NOT NULL,
    PRIMARY KEY (`id_ets_rv_comment`, `id_lang`)
) ENGINE = ENGINE_TYPE COLLATE=utf8mb4_general_ci CHARSET = utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_comment_origin_lang`(
    `id_ets_rv_comment` INT(11) UNSIGNED NOT NULL,
    `id_lang`           INT(11) UNSIGNED NOT NULL,
    `content`           TEXT         NOT NULL,
    PRIMARY KEY (`id_ets_rv_comment`, `id_lang`)
) ENGINE = ENGINE_TYPE COLLATE=utf8mb4_general_ci CHARSET = utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_comment_report`(
    `id_ets_rv_comment` INT(11) UNSIGNED NOT NULL,
    `id_customer`       INT(11) UNSIGNED NOT NULL,
    `question`       tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
    PRIMARY KEY (`id_ets_rv_comment`, `id_customer`)
) ENGINE = ENGINE_TYPE CHARSET = utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_comment_usefulness`(
    `id_ets_rv_comment` INT(11) UNSIGNED    NOT NULL,
    `id_customer`       INT(11) UNSIGNED    NOT NULL,
    `usefulness`        TINYINT(1) UNSIGNED NOT NULL,
    `employee`       int(10) UNSIGNED NOT NULL DEFAULT 0,
    `question`       tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
    PRIMARY KEY (`id_ets_rv_comment`, `id_customer`, `employee`)
) ENGINE = ENGINE_TYPE CHARSET = utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_reply_comment`(
    `id_ets_rv_reply_comment` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
    `id_ets_rv_comment`       int(11) UNSIGNED    NOT NULL,
    `id_customer`             int(11) UNSIGNED    NOT NULL,
    `employee`             int(10) UNSIGNED NOT NULL DEFAULT 0,
    `question`             tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
    `validate`                tinyint(1) UNSIGNED NOT NULL,
    `deleted`                 tinyint(1) UNSIGNED NOT NULL,
    `date_add`                  datetime            NOT NULL,
    `upd_date`                  datetime DEFAULT NULL,
    PRIMARY KEY (`id_ets_rv_reply_comment`),
    UNIQUE KEY `idx_customer_employee` (`id_customer`, `employee`, `id_ets_rv_reply_comment`),
    KEY `id_ets_rv_comment` (`id_ets_rv_comment`),
    KEY `id_customer` (`id_customer`)
) ENGINE = ENGINE_TYPE DEFAULT CHARSET = utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_reply_comment_lang` (
  `id_ets_rv_reply_comment` int(11) UNSIGNED NOT NULL,
  `id_lang` int(11) UNSIGNED NOT NULL,
  `content` text NOT NULL,
  PRIMARY KEY (`id_ets_rv_reply_comment`,`id_lang`)
) ENGINE = ENGINE_TYPE COLLATE=utf8mb4_general_ci CHARSET = utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_reply_comment_origin_lang`(
    `id_ets_rv_reply_comment` INT(11) UNSIGNED NOT NULL,
    `id_lang`           INT(11) UNSIGNED NOT NULL,
    `content`           TEXT         NOT NULL,
    PRIMARY KEY (`id_ets_rv_reply_comment`, `id_lang`)
) ENGINE = ENGINE_TYPE COLLATE=utf8mb4_general_ci CHARSET = utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_reply_comment_report`(
    `id_ets_rv_reply_comment` INT(11) UNSIGNED NOT NULL,
    `id_customer`       INT(11) UNSIGNED NOT NULL,
    `question`       tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
    PRIMARY KEY (`id_ets_rv_reply_comment`, `id_customer`)
) ENGINE = ENGINE_TYPE CHARSET = utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_reply_comment_usefulness`(
    `id_ets_rv_reply_comment` INT(11) UNSIGNED    NOT NULL,
    `id_customer`       INT(11) UNSIGNED    NOT NULL,
    `usefulness`        TINYINT(1) UNSIGNED NOT NULL,
    `employee`       int(10) UNSIGNED NOT NULL DEFAULT 0,
    `question`       tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
    PRIMARY KEY (`id_ets_rv_reply_comment`, `id_customer`, `employee`)
) ENGINE = ENGINE_TYPE CHARSET = utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_activity`(
    `id_ets_rv_activity` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
    `id_customer`       INT(11) UNSIGNED NOT NULL,
    `id_guest`       INT(11) UNSIGNED NOT NULL,
    `employee`       INT(10) UNSIGNED NOT NULL DEFAULT 0,
    `id_product`       INT(11) UNSIGNED NOT NULL,
    `type`       TINYINT(2) NOT NULL,
    `action`       TINYINT(3) NOT NULL,
    `id_ets_rv_product_comment` int(10) UNSIGNED NOT NULL DEFAULT 0,
    `id_ets_rv_comment` int(10) UNSIGNED NOT NULL DEFAULT 0,
    `id_ets_rv_reply_comment` int(10) UNSIGNED NOT NULL DEFAULT 0,
    `read` tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
    `content` varchar(64) NOT NULL,
    `date_add`       datetime   NOT NULL,
    PRIMARY KEY (`id_ets_rv_activity`),
    KEY `idx_id_customer` (`id_customer`),
    KEY `idx_id_guest` (`id_guest`),
    KEY `idx_id_product` (`id_product`),
    KEY `idx_id_ets_rv_product_comment` (`id_ets_rv_product_comment`),
    KEY `idx_id_ets_rv_comment` (`id_ets_rv_comment`),
    KEY `idx_id_ets_rv_reply_comment` (`id_ets_rv_reply_comment`),
    KEY `employee_idx` (`employee`)
) ENGINE = ENGINE_TYPE COLLATE=utf8mb4_general_ci  CHARSET = utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_product_comment_order`(
   `id_ets_rv_product_comment` INT(11) UNSIGNED NOT NULL,
   `id_order` INT(11) UNSIGNED NOT NULL,
   `id_product` INT(11) UNSIGNED NOT NULL,
   PRIMARY KEY (`id_ets_rv_product_comment`, `id_order`, `id_product`)
) ENGINE = ENGINE_TYPE CHARSET = utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_email_queue`(
    `id_ets_rv_email_queue` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
    `id_lang` INT(11) UNSIGNED NOT NULL,
    `id_shop` INT(11) UNSIGNED NOT NULL,
    `id_customer` INT(11) UNSIGNED NOT NULL,
    `employee` INT(10) UNSIGNED NOT NULL DEFAULT 0,
    `template` varchar(255) NOT NULL,
    `to_email` varchar(255) NOT NULL,
    `to_name` varchar(255) DEFAULT NULL,
    `template_vars` text NOT NULL,
    `subject` varchar(500) NOT NULL,
    `content` TEXT NOT NULL,
    `sent` tinyint(1) UNSIGNED DEFAULT 0,
    `sending_time` datetime DEFAULT NULL,
    `send_count` int(1) UNSIGNED NOT NULL DEFAULT 0,
    `schedule_time` int(11) UNSIGNED NOT NULL DEFAULT 0,
    `date_add` datetime DEFAULT NULL,
    PRIMARY KEY (`id_ets_rv_email_queue`),
    KEY `idx_id_lang` (`id_lang`),
    KEY `idx_sent` (`sent`),
    KEY `idx_id_shop` (`id_shop`),
    KEY `idx_id_customer` (`id_customer`),
    KEY `idx_employee` (`employee`)
) ENGINE = ENGINE_TYPE CHARSET = utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_tracking`(
    `id_ets_rv_tracking` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
    `id_customer` INT(11) UNSIGNED NOT NULL,
    `employee` INT(10) UNSIGNED NOT NULL DEFAULT 0,
    `email` varchar(255) NOT NULL,
    `subject` varchar(500) NOT NULL,
    `guid` varchar(128) NOT NULL,
    `ip_address` varchar(64) NOT NULL,
    `is_read` tinyint(1) UNSIGNED DEFAULT 0,
    `delivered` tinyint(1) UNSIGNED DEFAULT 0,
    `id_shop` INT(11) UNSIGNED NOT NULL,
    `product_comment_id` INT(11) UNSIGNED NOT NULL,
    `product_id` INT(11) UNSIGNED NOT NULL,
    `id_order` INT(11) UNSIGNED NOT NULL,
    `queue_id` INT(11) UNSIGNED NOT NULL,
    `date_add` datetime DEFAULT NULL,
    `date_upd` datetime DEFAULT NULL,
    PRIMARY KEY (`id_ets_rv_tracking`),
    KEY `idx_id_shop` (`id_shop`),
    KEY `idx_product_id` (`product_id`),
    KEY `idx_id_customer` (`id_customer`),
    KEY `idx_id_order` (`id_order`),
    KEY `idx_employee` (`employee`),
    KEY `idx_guid` (`guid`),
    KEY `idx_product_comment_id` (`product_comment_id`),
    KEY `idx_queue_id` (`queue_id`)
) ENGINE = ENGINE_TYPE CHARSET = utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_discount`(
   `id_ets_rv_tracking` INT(11) UNSIGNED NOT NULL,
   `id_cart_rule` INT(11) UNSIGNED NOT NULL,
   `use_same_cart` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
   PRIMARY KEY (`id_ets_rv_tracking`, `id_cart_rule`),
   KEY `idx_use_same_cart` (`use_same_cart`)
) ENGINE = ENGINE_TYPE CHARSET = utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_email_template`(
   `id_ets_rv_email_template` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
   `template` varchar(128) NOT NULL,
   `active` TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
   UNIQUE KEY `uiq_template` (`template`),
   PRIMARY KEY (`id_ets_rv_email_template`),
   KEY `indexed` (`active`, `id_ets_rv_email_template`)
) ENGINE = ENGINE_TYPE CHARSET = utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_email_template_shop`(
    `id_ets_rv_email_template` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
    `id_shop` INT(11) UNSIGNED NOT NULL,
    `active` TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
    PRIMARY KEY (`id_ets_rv_email_template`, `id_shop`),
    KEY `indexed` (`active`, `id_ets_rv_email_template`)
) ENGINE = ENGINE_TYPE CHARSET = utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_email_template_lang`(
    `id_ets_rv_email_template` INT(11) UNSIGNED NOT NULL,
    `id_lang` INT(11) UNSIGNED NOT NULL,
    `id_shop` INT(11) UNSIGNED NOT NULL,
    `subject` varchar(128) NOT NULL,
    PRIMARY KEY (`id_ets_rv_email_template`, `id_lang`, `id_shop`)
) ENGINE = ENGINE_TYPE CHARSET = utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_staff`(
  `id_employee` int(11) UNSIGNED NOT NULL,
  `id_last_activity` int(11) UNSIGNED NOT NULL DEFAULT 0,
  `display_name` varchar(255) COLLATE utf8mb4_bin NOT NULL,
  `avatar` varchar(500) COLLATE utf8mb4_bin NOT NULL,
  `sendmail` tinyint(1) NOT NULL DEFAULT 1,
  `enabled` tinyint(1) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id_employee`),
  KEY `id_last_activity` (`id_last_activity`)
) ENGINE = ENGINE_TYPE CHARSET = utf8mb4;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_staff_activity` (
  `id_employee` int(11) UNSIGNED NOT NULL,
  `id_ets_rv_activity` int(11) UNSIGNED NOT NULL DEFAULT 0,
  `read` tinyint(1) UNSIGNED NOT NULL DEFAULT 0,
  PRIMARY KEY (`id_employee`, `id_ets_rv_activity`)
) ENGINE = ENGINE_TYPE CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_mail_log` (
    `id_ets_rv_mail_log` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
    `id_ets_rv_email_queue` INT(11) UNSIGNED NOT NULL,
    `id_lang` INT(11) UNSIGNED NOT NULL,
    `id_shop` INT(11) UNSIGNED NOT NULL,
    `id_customer` INT(11) UNSIGNED NOT NULL,
    `employee` INT(10) UNSIGNED NOT NULL DEFAULT 0,
    `template` varchar(255) NOT NULL,
    `to_email` varchar(255) NOT NULL,
    `to_name` varchar(255) DEFAULT NULL,
    `template_vars` text NOT NULL,
    `subject` varchar(500) NOT NULL,
    `content` text NOT NULL,
    `sent_time` datetime DEFAULT NULL,
    `status` tinyint(1) NOT NULL,
    PRIMARY KEY (`id_ets_rv_mail_log`),
    UNIQUE `idx_id_ets_rv_email_queue` (`id_ets_rv_email_queue`) USING BTREE,
    KEY `idx_id_lang` (`id_lang`),
    KEY `idx_id_shop` (`id_shop`),
    KEY `idx_id_customer` (`id_customer`),
    KEY `idx_employee` (`employee`)
) ENGINE=ENGINE_TYPE CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

CREATE TABLE IF NOT EXISTS `PREFIX_ets_rv_unsubscribe` (
    `id_ets_rv_unsubscribe` int(11) unsigned NOT NULL AUTO_INCREMENT,
    `email` varchar(255) NOT NULL,
    `active` tinyint(1) unsigned NOT NULL DEFAULT 1,
    `date_add` DATETIME NULL DEFAULT NULL,
    PRIMARY KEY (`id_ets_rv_unsubscribe`)
) ENGINE=ENGINE_TYPE CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

INSERT IGNORE INTO `PREFIX_ets_rv_product_comment_criterion` VALUES ('1', '1', '1', '0');

INSERT IGNORE INTO `PREFIX_ets_rv_product_comment_criterion_lang` (`id_ets_rv_product_comment_criterion`, `id_lang`, `name`)
(
    SELECT '1', l.`id_lang`, 'Quality'
    FROM `PREFIX_lang` l
);

