Skip to content

Commit d3706dd

Browse files
committed
2 parents a6d398a + 27a031a commit d3706dd

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

includes/class-wc-product-tables-install.php

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,13 @@ public static function activate() {
5959
`date_on_sale_to` datetime NULL default NULL,
6060
`average_rating` float NULL default 0,
6161
`stock_status` varchar(100) NULL default 'instock',
62-
PRIMARY KEY (`product_id`)
62+
PRIMARY KEY (`product_id`),
63+
KEY image_id (image_id),
64+
KEY type (type),
65+
KEY virtual (virtual),
66+
KEY downloadable (downloadable),
67+
KEY stock_status (stock_status)
68+
6369
) $collate;
6470
6571
CREATE TABLE {$wpdb->prefix}wc_product_attributes (
@@ -70,7 +76,9 @@ public static function activate() {
7076
`is_variation` tinyint(1) NOT NULL,
7177
`priority` int(11) NOT NULL default 1,
7278
`attribute_id` bigint(20) NOT NULL,
73-
PRIMARY KEY (`product_attribute_id`)
79+
PRIMARY KEY (`product_attribute_id`),
80+
KEY product_id (product_id),
81+
KEY attribute_id (attribute_id)
7482
) $collate;
7583
7684
CREATE TABLE {$wpdb->prefix}wc_product_attribute_values (
@@ -80,7 +88,9 @@ public static function activate() {
8088
`value` text NOT NULL,
8189
`priority` int(11) NOT NULL default 1,
8290
`is_default` tinyint(1) NOT NULL,
83-
PRIMARY KEY (`attribute_value_id`)
91+
PRIMARY KEY (`attribute_value_id`),
92+
KEY product_id (product_id),
93+
KEY product_attribute_id (product_attribute_id)
8494
) $collate;
8595
8696
CREATE TABLE {$wpdb->prefix}wc_product_downloads (
@@ -89,7 +99,8 @@ public static function activate() {
8999
`name` varchar(1000) NOT NULL,
90100
`file` text NOT NULL,
91101
`priority` int(11) default 0,
92-
PRIMARY KEY (`download_id`)
102+
PRIMARY KEY (`download_id`),
103+
KEY product_id (product_id)
93104
) $collate;
94105
95106
CREATE TABLE {$wpdb->prefix}wc_product_relationships (
@@ -98,15 +109,20 @@ public static function activate() {
98109
`product_id` bigint(20) NOT NULL,
99110
`object_id` bigint(20) NOT NULL,
100111
`priority` int(11) NOT NULL,
101-
PRIMARY KEY (`relationship_id`)
112+
PRIMARY KEY (`relationship_id`),
113+
KEY type (type),
114+
KEY product_id (product_id),
115+
KEY object_id (object_id)
102116
) $collate;
103117
104118
CREATE TABLE {$wpdb->prefix}wc_product_variation_attribute_values (
105119
`variation_attribute_value_id` bigint(20) NOT NULL AUTO_INCREMENT,
106120
`product_id` bigint(20) NOT NULL,
107121
`value` text NOT NULL,
108122
`product_attribute_id` bigint(20) NOT NULL,
109-
PRIMARY KEY (`variation_attribute_value_id`)
123+
PRIMARY KEY (`variation_attribute_value_id`),
124+
KEY product_id (product_id),
125+
KEY product_attribute_id (product_attribute_id)
110126
) $collate;
111127
";
112128

0 commit comments

Comments
 (0)