update schema, remove white spaces
This commit is contained in:
@@ -34,14 +34,7 @@ CREATE TABLE `product`
|
|||||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||||
`tax_rule_id` INTEGER,
|
`tax_rule_id` INTEGER,
|
||||||
`ref` VARCHAR(255) NOT NULL,
|
`ref` VARCHAR(255) NOT NULL,
|
||||||
`price` FLOAT NOT NULL,
|
|
||||||
`price2` FLOAT,
|
|
||||||
`ecotax` FLOAT,
|
|
||||||
`newness` TINYINT DEFAULT 0,
|
|
||||||
`promo` TINYINT DEFAULT 0,
|
|
||||||
`quantity` INTEGER DEFAULT 0,
|
|
||||||
`visible` TINYINT DEFAULT 0 NOT NULL,
|
`visible` TINYINT DEFAULT 0 NOT NULL,
|
||||||
`weight` FLOAT,
|
|
||||||
`position` INTEGER NOT NULL,
|
`position` INTEGER NOT NULL,
|
||||||
`created_at` DATETIME,
|
`created_at` DATETIME,
|
||||||
`updated_at` DATETIME,
|
`updated_at` DATETIME,
|
||||||
@@ -316,21 +309,6 @@ CREATE TABLE `attribute_av`
|
|||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB;
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
|
||||||
-- combination
|
|
||||||
-- ---------------------------------------------------------------------
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `combination`;
|
|
||||||
|
|
||||||
CREATE TABLE `combination`
|
|
||||||
(
|
|
||||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
|
||||||
`ref` VARCHAR(255),
|
|
||||||
`created_at` DATETIME,
|
|
||||||
`updated_at` DATETIME,
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) ENGINE=InnoDB;
|
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- attribute_combination
|
-- attribute_combination
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
@@ -339,16 +317,15 @@ DROP TABLE IF EXISTS `attribute_combination`;
|
|||||||
|
|
||||||
CREATE TABLE `attribute_combination`
|
CREATE TABLE `attribute_combination`
|
||||||
(
|
(
|
||||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
|
||||||
`attribute_id` INTEGER NOT NULL,
|
`attribute_id` INTEGER NOT NULL,
|
||||||
`combination_id` INTEGER NOT NULL,
|
|
||||||
`attribute_av_id` INTEGER NOT NULL,
|
`attribute_av_id` INTEGER NOT NULL,
|
||||||
|
`stock_id` INTEGER NOT NULL,
|
||||||
`created_at` DATETIME,
|
`created_at` DATETIME,
|
||||||
`updated_at` DATETIME,
|
`updated_at` DATETIME,
|
||||||
PRIMARY KEY (`id`,`attribute_id`,`combination_id`,`attribute_av_id`),
|
PRIMARY KEY (`attribute_id`,`attribute_av_id`,`stock_id`),
|
||||||
INDEX `idx_attribute_combination_attribute_id` (`attribute_id`),
|
INDEX `idx_attribute_combination_attribute_id` (`attribute_id`),
|
||||||
INDEX `idx_attribute_combination_attribute_av_id` (`attribute_av_id`),
|
INDEX `idx_attribute_combination_attribute_av_id` (`attribute_av_id`),
|
||||||
INDEX `idx_ attribute_combination_combination_id` (`combination_id`),
|
INDEX `idx_attribute_combination_stock_id` (`stock_id`),
|
||||||
CONSTRAINT `fk_attribute_combination_attribute_id`
|
CONSTRAINT `fk_attribute_combination_attribute_id`
|
||||||
FOREIGN KEY (`attribute_id`)
|
FOREIGN KEY (`attribute_id`)
|
||||||
REFERENCES `attribute` (`id`)
|
REFERENCES `attribute` (`id`)
|
||||||
@@ -359,11 +336,9 @@ CREATE TABLE `attribute_combination`
|
|||||||
REFERENCES `attribute_av` (`id`)
|
REFERENCES `attribute_av` (`id`)
|
||||||
ON UPDATE RESTRICT
|
ON UPDATE RESTRICT
|
||||||
ON DELETE CASCADE,
|
ON DELETE CASCADE,
|
||||||
CONSTRAINT `fk_ attribute_combination_combination_id`
|
CONSTRAINT `fk_attribute_combination_stock_id`
|
||||||
FOREIGN KEY (`combination_id`)
|
FOREIGN KEY (`stock_id`)
|
||||||
REFERENCES `combination` (`id`)
|
REFERENCES `stock` (`id`)
|
||||||
ON UPDATE RESTRICT
|
|
||||||
ON DELETE CASCADE
|
|
||||||
) ENGINE=InnoDB;
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
@@ -379,16 +354,13 @@ CREATE TABLE `stock`
|
|||||||
`product_id` INTEGER NOT NULL,
|
`product_id` INTEGER NOT NULL,
|
||||||
`increase` FLOAT,
|
`increase` FLOAT,
|
||||||
`quantity` FLOAT NOT NULL,
|
`quantity` FLOAT NOT NULL,
|
||||||
|
`promo` TINYINT DEFAULT 0,
|
||||||
|
`newness` TINYINT DEFAULT 0,
|
||||||
|
`weight` FLOAT,
|
||||||
`created_at` DATETIME,
|
`created_at` DATETIME,
|
||||||
`updated_at` DATETIME,
|
`updated_at` DATETIME,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
INDEX `idx_stock_combination_id` (`combination_id`),
|
|
||||||
INDEX `idx_stock_product_id` (`product_id`),
|
INDEX `idx_stock_product_id` (`product_id`),
|
||||||
CONSTRAINT `fk_stock_combination_id`
|
|
||||||
FOREIGN KEY (`combination_id`)
|
|
||||||
REFERENCES `combination` (`id`)
|
|
||||||
ON UPDATE RESTRICT
|
|
||||||
ON DELETE SET NULL,
|
|
||||||
CONSTRAINT `fk_stock_product_id`
|
CONSTRAINT `fk_stock_product_id`
|
||||||
FOREIGN KEY (`product_id`)
|
FOREIGN KEY (`product_id`)
|
||||||
REFERENCES `product` (`id`)
|
REFERENCES `product` (`id`)
|
||||||
@@ -1341,22 +1313,48 @@ CREATE TABLE `cart_item`
|
|||||||
`cart_id` INTEGER NOT NULL,
|
`cart_id` INTEGER NOT NULL,
|
||||||
`product_id` INTEGER NOT NULL,
|
`product_id` INTEGER NOT NULL,
|
||||||
`quantity` FLOAT DEFAULT 1,
|
`quantity` FLOAT DEFAULT 1,
|
||||||
`combination_id` INTEGER,
|
`stock_id` INTEGER NOT NULL,
|
||||||
`created_at` DATETIME,
|
`created_at` DATETIME,
|
||||||
`updated_at` DATETIME,
|
`updated_at` DATETIME,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
INDEX `idx_cart_item_cart_id` (`cart_id`),
|
INDEX `idx_cart_item_cart_id` (`cart_id`),
|
||||||
INDEX `idx_cart_item_product_id` (`product_id`),
|
INDEX `idx_cart_item_product_id` (`product_id`),
|
||||||
INDEX `idx_cart_item_combination_id` (`combination_id`),
|
INDEX `idx_cart_item_stock_id` (`stock_id`),
|
||||||
CONSTRAINT `fk_cart_item_cart_id`
|
CONSTRAINT `fk_cart_item_cart_id`
|
||||||
FOREIGN KEY (`cart_id`)
|
FOREIGN KEY (`cart_id`)
|
||||||
REFERENCES `cart` (`id`),
|
REFERENCES `cart` (`id`),
|
||||||
CONSTRAINT `fk_cart_item_product_id`
|
CONSTRAINT `fk_cart_item_product_id`
|
||||||
FOREIGN KEY (`product_id`)
|
FOREIGN KEY (`product_id`)
|
||||||
REFERENCES `product` (`id`),
|
REFERENCES `product` (`id`),
|
||||||
CONSTRAINT `fk_cart_item_combination_id`
|
CONSTRAINT `fk_cart_item_stock_id`
|
||||||
FOREIGN KEY (`combination_id`)
|
FOREIGN KEY (`stock_id`)
|
||||||
REFERENCES `combination` (`id`)
|
REFERENCES `stock` (`id`)
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
-- product_price
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `product_price`;
|
||||||
|
|
||||||
|
CREATE TABLE `product_price`
|
||||||
|
(
|
||||||
|
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||||
|
`stock_id` INTEGER NOT NULL,
|
||||||
|
`currency_id` INTEGER NOT NULL,
|
||||||
|
`price` FLOAT NOT NULL,
|
||||||
|
`promo_price` FLOAT,
|
||||||
|
`created_at` DATETIME,
|
||||||
|
`updated_at` DATETIME,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
INDEX `idx_product_price_stock_id` (`stock_id`),
|
||||||
|
INDEX `idx_product_price_currency_id` (`currency_id`),
|
||||||
|
CONSTRAINT `fk_product_price_stock_id`
|
||||||
|
FOREIGN KEY (`stock_id`)
|
||||||
|
REFERENCES `stock` (`id`),
|
||||||
|
CONSTRAINT `fk_product_price_currency_id`
|
||||||
|
FOREIGN KEY (`currency_id`)
|
||||||
|
REFERENCES `currency` (`id`)
|
||||||
) ENGINE=InnoDB;
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
@@ -1805,14 +1803,7 @@ CREATE TABLE `product_version`
|
|||||||
`id` INTEGER NOT NULL,
|
`id` INTEGER NOT NULL,
|
||||||
`tax_rule_id` INTEGER,
|
`tax_rule_id` INTEGER,
|
||||||
`ref` VARCHAR(255) NOT NULL,
|
`ref` VARCHAR(255) NOT NULL,
|
||||||
`price` FLOAT NOT NULL,
|
|
||||||
`price2` FLOAT,
|
|
||||||
`ecotax` FLOAT,
|
|
||||||
`newness` TINYINT DEFAULT 0,
|
|
||||||
`promo` TINYINT DEFAULT 0,
|
|
||||||
`quantity` INTEGER DEFAULT 0,
|
|
||||||
`visible` TINYINT DEFAULT 0 NOT NULL,
|
`visible` TINYINT DEFAULT 0 NOT NULL,
|
||||||
`weight` FLOAT,
|
|
||||||
`position` INTEGER NOT NULL,
|
`position` INTEGER NOT NULL,
|
||||||
`created_at` DATETIME,
|
`created_at` DATETIME,
|
||||||
`updated_at` DATETIME,
|
`updated_at` DATETIME,
|
||||||
|
|||||||
Reference in New Issue
Block a user