|
@@ -88,6 +88,33 @@ CREATE TABLE shop_filters_values (
|
|
name varchar(255) NOT NULL COMMENT 'Value name',
|
|
name varchar(255) NOT NULL COMMENT 'Value name',
|
|
PRIMARY KEY (id)
|
|
PRIMARY KEY (id)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
+CREATE TABLE shop_order_products (
|
|
|
|
+ id int(11) NOT NULL AUTO_INCREMENT COMMENT 'AI',
|
|
|
|
+ order_id int(11) NOT NULL COMMENT 'Order ID',
|
|
|
|
+ product_id int(11) NOT NULL COMMENT 'Product ID',
|
|
|
|
+ price float(8,2) NOT NULL COMMENT 'Product price',
|
|
|
|
+ quantity int(11) NOT NULL COMMENT 'Quantity',
|
|
|
|
+ PRIMARY KEY (id)
|
|
|
|
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
+CREATE TABLE shop_orders (
|
|
|
|
+ id int(11) NOT NULL AUTO_INCREMENT COMMENT 'AI',
|
|
|
|
+ create_datetime datetime NOT NULL COMMENT 'Create date/time',
|
|
|
|
+ update_datetime datetime NOT NULL COMMENT 'Update date/time',
|
|
|
|
+ currency_id int(11) NOT NULL COMMENT 'Currency ID',
|
|
|
|
+ currency_name varchar(255) NOT NULL COMMENT 'Currency name',
|
|
|
|
+ currency_coefficient float(8,4) NOT NULL DEFAULT '1.0000' COMMENT 'Currency coefficient',
|
|
|
|
+ currency_code varchar(10) NOT NULL COMMENT 'Currency code',
|
|
|
|
+ currency_symbol varchar(5) NOT NULL COMMENT 'Currency symbol',
|
|
|
|
+ client_last_name varchar(64) NOT NULL COMMENT 'Client last name',
|
|
|
|
+ client_first_name varchar(64) NOT NULL COMMENT 'Client first name',
|
|
|
|
+ client_second_name varchar(64) NOT NULL DEFAULT '' COMMENT 'Client second name',
|
|
|
|
+ client_phone varchar(64) NOT NULL DEFAULT '' COMMENT 'Client phone',
|
|
|
|
+ client_email varchar(20) NOT NULL COMMENT 'Client email',
|
|
|
|
+ client_delivery_comment text NOT NULL COMMENT 'Client delivery comment',
|
|
|
|
+ client_order_comment text NOT NULL COMMENT 'Client order comment',
|
|
|
|
+ status int(1) NOT NULL COMMENT 'new/confirmed/canceled/inprogress/completed',
|
|
|
|
+ PRIMARY KEY (id)
|
|
|
|
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
CREATE TABLE shop_product_images (
|
|
CREATE TABLE shop_product_images (
|
|
id int(11) NOT NULL AUTO_INCREMENT,
|
|
id int(11) NOT NULL AUTO_INCREMENT,
|
|
product_id int(11) NOT NULL,
|
|
product_id int(11) NOT NULL,
|
|
@@ -151,6 +178,10 @@ ALTER TABLE shop_filter_product_values ADD KEY FK_shop_filter_product_values_fil
|
|
ALTER TABLE shop_filters ADD KEY name (name);
|
|
ALTER TABLE shop_filters ADD KEY name (name);
|
|
ALTER TABLE shop_filters_values ADD KEY FK_shop_filters_values_filter_id (filter_id);
|
|
ALTER TABLE shop_filters_values ADD KEY FK_shop_filters_values_filter_id (filter_id);
|
|
ALTER TABLE shop_filters_values ADD KEY name (name);
|
|
ALTER TABLE shop_filters_values ADD KEY name (name);
|
|
|
|
+ALTER TABLE shop_orders ADD KEY FK_shop_orders_currency_id (currency_id);
|
|
|
|
+ALTER TABLE shop_order_products ADD UNIQUE KEY order_product (order_id,product_id) USING BTREE;
|
|
|
|
+ALTER TABLE shop_order_products ADD KEY FK_shop_order_products_order_id (order_id);
|
|
|
|
+ALTER TABLE shop_order_products ADD KEY FK_shop_order_products_product_id (product_id);
|
|
ALTER TABLE shop_product_images ADD UNIQUE KEY product_filename (product_id,filename) USING BTREE;
|
|
ALTER TABLE shop_product_images ADD UNIQUE KEY product_filename (product_id,filename) USING BTREE;
|
|
ALTER TABLE shop_product_images ADD KEY FK_shop_product_images_product_id (product_id);
|
|
ALTER TABLE shop_product_images ADD KEY FK_shop_product_images_product_id (product_id);
|
|
ALTER TABLE shop_products ADD UNIQUE KEY alias (alias);
|
|
ALTER TABLE shop_products ADD UNIQUE KEY alias (alias);
|
|
@@ -174,6 +205,9 @@ ALTER TABLE shop_cats ADD CONSTRAINT FK_shop_cats_user FOREIGN KEY (user) REFERE
|
|
ALTER TABLE shop_filter_product_values ADD CONSTRAINT FK_shop_filter_product_values_product_id FOREIGN KEY (product_id) REFERENCES shop_products (id) ON DELETE RESTRICT;
|
|
ALTER TABLE shop_filter_product_values ADD CONSTRAINT FK_shop_filter_product_values_product_id FOREIGN KEY (product_id) REFERENCES shop_products (id) ON DELETE RESTRICT;
|
|
ALTER TABLE shop_filter_product_values ADD CONSTRAINT FK_shop_filter_product_values_filter_value_id FOREIGN KEY (filter_value_id) REFERENCES shop_filters_values (id) ON DELETE RESTRICT;
|
|
ALTER TABLE shop_filter_product_values ADD CONSTRAINT FK_shop_filter_product_values_filter_value_id FOREIGN KEY (filter_value_id) REFERENCES shop_filters_values (id) ON DELETE RESTRICT;
|
|
ALTER TABLE shop_filters_values ADD CONSTRAINT FK_shop_filters_values_filter_id FOREIGN KEY (filter_id) REFERENCES shop_filters (id) ON DELETE RESTRICT;
|
|
ALTER TABLE shop_filters_values ADD CONSTRAINT FK_shop_filters_values_filter_id FOREIGN KEY (filter_id) REFERENCES shop_filters (id) ON DELETE RESTRICT;
|
|
|
|
+ALTER TABLE shop_orders ADD CONSTRAINT FK_shop_orders_currency_id FOREIGN KEY (currency_id) REFERENCES shop_currencies (id) ON DELETE RESTRICT;
|
|
|
|
+ALTER TABLE shop_order_products ADD CONSTRAINT FK_shop_order_products_order_id FOREIGN KEY (order_id) REFERENCES shop_orders (id) ON DELETE RESTRICT;
|
|
|
|
+ALTER TABLE shop_order_products ADD CONSTRAINT FK_shop_order_products_product_id FOREIGN KEY (product_id) REFERENCES shop_products (id) ON DELETE RESTRICT;
|
|
ALTER TABLE shop_product_images ADD CONSTRAINT FK_shop_product_images_product_id FOREIGN KEY (product_id) REFERENCES shop_products (id) ON DELETE RESTRICT;
|
|
ALTER TABLE shop_product_images ADD CONSTRAINT FK_shop_product_images_product_id FOREIGN KEY (product_id) REFERENCES shop_products (id) ON DELETE RESTRICT;
|
|
ALTER TABLE shop_products ADD CONSTRAINT FK_shop_products_user FOREIGN KEY (user) REFERENCES users (id) ON DELETE RESTRICT;
|
|
ALTER TABLE shop_products ADD CONSTRAINT FK_shop_products_user FOREIGN KEY (user) REFERENCES users (id) ON DELETE RESTRICT;
|
|
ALTER TABLE shop_products ADD CONSTRAINT FK_shop_products_currency FOREIGN KEY (currency) REFERENCES shop_currencies (id) ON DELETE RESTRICT;
|
|
ALTER TABLE shop_products ADD CONSTRAINT FK_shop_products_currency FOREIGN KEY (currency) REFERENCES shop_currencies (id) ON DELETE RESTRICT;
|