forked from PrestaShop/productcomments
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sql
75 lines (65 loc) · 3.1 KB
/
install.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
CREATE TABLE IF NOT EXISTS `PREFIX_product_comment` (
`id_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,
`title` varchar(64) NULL,
`content` text NOT NULL,
`customer_name` varchar(64) NULL,
`grade` float unsigned NOT NULL,
`validate` tinyint(1) NOT NULL,
`deleted` tinyint(1) NOT NULL,
`date_add` datetime NOT NULL,
PRIMARY KEY (`id_product_comment`),
KEY `id_product` (`id_product`),
KEY `id_customer` (`id_customer`),
KEY `id_guest` (`id_guest`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_criterion` (
`id_product_comment_criterion` int(10) unsigned NOT NULL auto_increment,
`id_product_comment_criterion_type` tinyint(1) NOT NULL,
`active` tinyint(1) NOT NULL,
PRIMARY KEY (`id_product_comment_criterion`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_criterion_product` (
`id_product` int(10) unsigned NOT NULL,
`id_product_comment_criterion` int(10) unsigned NOT NULL,
PRIMARY KEY(`id_product`, `id_product_comment_criterion`),
KEY `id_product_comment_criterion` (`id_product_comment_criterion`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_criterion_lang` (
`id_product_comment_criterion` INT(11) UNSIGNED NOT NULL ,
`id_lang` INT(11) UNSIGNED NOT NULL ,
`name` VARCHAR(64) NOT NULL ,
PRIMARY KEY ( `id_product_comment_criterion` , `id_lang` )
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_criterion_category` (
`id_product_comment_criterion` int(10) unsigned NOT NULL,
`id_category` int(10) unsigned NOT NULL,
PRIMARY KEY(`id_product_comment_criterion`, `id_category`),
KEY `id_category` (`id_category`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_grade` (
`id_product_comment` int(10) unsigned NOT NULL,
`id_product_comment_criterion` int(10) unsigned NOT NULL,
`grade` int(10) unsigned NOT NULL,
PRIMARY KEY (`id_product_comment`, `id_product_comment_criterion`),
KEY `id_product_comment_criterion` (`id_product_comment_criterion`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_usefulness` (
`id_product_comment` int(10) unsigned NOT NULL,
`id_customer` int(10) unsigned NOT NULL,
`usefulness` tinyint(1) unsigned NOT NULL,
PRIMARY KEY (`id_product_comment`, `id_customer`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_report` (
`id_product_comment` int(10) unsigned NOT NULL,
`id_customer` int(10) unsigned NOT NULL,
PRIMARY KEY (`id_product_comment`, `id_customer`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4;
INSERT IGNORE INTO `PREFIX_product_comment_criterion` VALUES ('1', '1', '1');
INSERT IGNORE INTO `PREFIX_product_comment_criterion_lang` (`id_product_comment_criterion`, `id_lang`, `name`)
(
SELECT '1', l.`id_lang`, 'Quality'
FROM `PREFIX_lang` l
);