diff --git a/install/thelia.sql b/install/thelia.sql
index 006d86d19..0f5f9e70b 100755
--- a/install/thelia.sql
+++ b/install/thelia.sql
@@ -34,14 +34,7 @@ CREATE TABLE `product`
`id` INTEGER NOT NULL AUTO_INCREMENT,
`tax_rule_id` INTEGER,
`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,
- `weight` FLOAT,
`position` INTEGER NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
@@ -316,21 +309,6 @@ CREATE TABLE `attribute_av`
ON DELETE CASCADE
) 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
-- ---------------------------------------------------------------------
@@ -339,31 +317,28 @@ DROP TABLE IF EXISTS `attribute_combination`;
CREATE TABLE `attribute_combination`
(
- `id` INTEGER NOT NULL AUTO_INCREMENT,
`attribute_id` INTEGER NOT NULL,
- `combination_id` INTEGER NOT NULL,
`attribute_av_id` INTEGER NOT NULL,
+ `stock_id` INTEGER NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
- PRIMARY KEY (`id`,`attribute_id`,`combination_id`,`attribute_av_id`),
- INDEX `idx_ attribute_combination_attribute_id` (`attribute_id`),
- INDEX `idx_ attribute_combination_attribute_av_id` (`attribute_av_id`),
- INDEX `idx_ attribute_combination_combination_id` (`combination_id`),
- CONSTRAINT `fk_ attribute_combination_attribute_id`
+ PRIMARY KEY (`attribute_id`,`attribute_av_id`,`stock_id`),
+ INDEX `idx_attribute_combination_attribute_id` (`attribute_id`),
+ INDEX `idx_attribute_combination_attribute_av_id` (`attribute_av_id`),
+ INDEX `idx_attribute_combination_stock_id` (`stock_id`),
+ CONSTRAINT `fk_attribute_combination_attribute_id`
FOREIGN KEY (`attribute_id`)
REFERENCES `attribute` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE,
- CONSTRAINT `fk_ attribute_combination_attribute_av_id`
+ CONSTRAINT `fk_attribute_combination_attribute_av_id`
FOREIGN KEY (`attribute_av_id`)
REFERENCES `attribute_av` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE,
- CONSTRAINT `fk_ attribute_combination_combination_id`
- FOREIGN KEY (`combination_id`)
- REFERENCES `combination` (`id`)
- ON UPDATE RESTRICT
- ON DELETE CASCADE
+ CONSTRAINT `fk_attribute_combination_stock_id`
+ FOREIGN KEY (`stock_id`)
+ REFERENCES `stock` (`id`)
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
@@ -379,16 +354,13 @@ CREATE TABLE `stock`
`product_id` INTEGER NOT NULL,
`increase` FLOAT,
`quantity` FLOAT NOT NULL,
+ `promo` TINYINT DEFAULT 0,
+ `newness` TINYINT DEFAULT 0,
+ `weight` FLOAT,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
- INDEX `idx_stock_combination_id` (`combination_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`
FOREIGN KEY (`product_id`)
REFERENCES `product` (`id`)
@@ -1341,22 +1313,48 @@ CREATE TABLE `cart_item`
`cart_id` INTEGER NOT NULL,
`product_id` INTEGER NOT NULL,
`quantity` FLOAT DEFAULT 1,
- `combination_id` INTEGER,
+ `stock_id` INTEGER NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
INDEX `idx_cart_item_cart_id` (`cart_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`
FOREIGN KEY (`cart_id`)
REFERENCES `cart` (`id`),
CONSTRAINT `fk_cart_item_product_id`
FOREIGN KEY (`product_id`)
REFERENCES `product` (`id`),
- CONSTRAINT `fk_cart_item_combination_id`
- FOREIGN KEY (`combination_id`)
- REFERENCES `combination` (`id`)
+ CONSTRAINT `fk_cart_item_stock_id`
+ FOREIGN KEY (`stock_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;
-- ---------------------------------------------------------------------
@@ -1805,14 +1803,7 @@ CREATE TABLE `product_version`
`id` INTEGER NOT NULL,
`tax_rule_id` INTEGER,
`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,
- `weight` FLOAT,
`position` INTEGER NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
diff --git a/local/config/schema.xml b/local/config/schema.xml
index fe2f18d22..176933d2e 100755
--- a/local/config/schema.xml
+++ b/local/config/schema.xml
@@ -239,19 +239,19 @@
-
+
-
+
-
+
-
+