update schema, remove white spaces

This commit is contained in:
Manuel Raynaud
2013-07-29 14:13:07 +02:00
parent b0622c1fae
commit 76a8d24f4b
2 changed files with 48 additions and 57 deletions

View File

@@ -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,

View File

@@ -239,19 +239,19 @@
<column name="attribute_id" primaryKey="true" required="true" type="INTEGER" />
<column name="attribute_av_id" primaryKey="true" required="true" type="INTEGER" />
<column name="stock_id" primaryKey="true" required="true" type="INTEGER" />
<foreign-key foreignTable="attribute" name="fk_ attribute_combination_attribute_id" onDelete="CASCADE" onUpdate="RESTRICT">
<foreign-key foreignTable="attribute" name="fk_attribute_combination_attribute_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="attribute_id" />
</foreign-key>
<foreign-key foreignTable="attribute_av" name="fk_ attribute_combination_attribute_av_id" onDelete="CASCADE" onUpdate="RESTRICT">
<foreign-key foreignTable="attribute_av" name="fk_attribute_combination_attribute_av_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="attribute_av_id" />
</foreign-key>
<foreign-key foreignTable="stock" name="fk_attribute_combination_stock_id">
<reference foreign="id" local="stock_id" />
</foreign-key>
<index name="idx_ attribute_combination_attribute_id">
<index name="idx_attribute_combination_attribute_id">
<index-column name="attribute_id" />
</index>
<index name="idx_ attribute_combination_attribute_av_id">
<index name="idx_attribute_combination_attribute_av_id">
<index-column name="attribute_av_id" />
</index>
<index name="idx_attribute_combination_stock_id">