Merge branches 'coupon' and 'master' of https://github.com/thelia/thelia into coupon
* 'coupon' of https://github.com/thelia/thelia: # By Etienne Roudeix (17) and others # Via Etienne Roudeix (9) and others * 'master' of https://github.com/thelia/thelia: (52 commits) fix content faker fix typo and remove url generation in postInsert model add covers annotation in ProductRewriteTest create test for UrlRewritingTrait payment loop fix postage display postage + invoice step template is not mandatory in product table. refactor rewrriten method name Changed getDefaultCategory in getDefaultCategoryId remove old model classes: Working : Content : fix loop giving no elements Working : Content : fix loop giving no elements Added missing files... Started product management Working : Content : fix loop giving no elements Working : Product : fix loop giving no elements cart billing integration empty cart or delivery exception remove isntall routing and template ...
This commit is contained in:
@@ -5,12 +5,7 @@ use Thelia\Constraint\Rule\AvailableForTotalAmountManager;
|
||||
use Thelia\Constraint\Rule\AvailableForXArticlesManager;
|
||||
use Thelia\Constraint\Rule\Operators;
|
||||
use Thelia\Coupon\CouponRuleCollection;
|
||||
use Thelia\Model\ProductImage;
|
||||
use Thelia\Model\CategoryImage;
|
||||
use Thelia\Model\FolderImage;
|
||||
use Thelia\Model\ContentImage;
|
||||
use Imagine\Image\Color;
|
||||
use Imagine\Image\Point;
|
||||
|
||||
|
||||
require __DIR__ . '/../core/bootstrap.php';
|
||||
|
||||
@@ -24,12 +19,17 @@ $con = \Propel\Runtime\Propel::getConnection(
|
||||
);
|
||||
$con->beginTransaction();
|
||||
|
||||
// Intialize URL management
|
||||
$url = new Thelia\Tools\URL();
|
||||
|
||||
$currency = \Thelia\Model\CurrencyQuery::create()->filterByCode('EUR')->findOne();
|
||||
|
||||
try {
|
||||
$stmt = $con->prepare("SET foreign_key_checks = 0");
|
||||
$stmt->execute();
|
||||
|
||||
echo "Clearing tables\n";
|
||||
|
||||
$productAssociatedContent = Thelia\Model\ProductAssociatedContentQuery::create()
|
||||
->find();
|
||||
$productAssociatedContent->delete();
|
||||
@@ -126,9 +126,24 @@ try {
|
||||
->find();
|
||||
$productPrice->delete();
|
||||
|
||||
\Thelia\Model\ProductImageQuery::create()->find()->delete();
|
||||
\Thelia\Model\CategoryImageQuery::create()->find()->delete();
|
||||
\Thelia\Model\FolderImageQuery::create()->find()->delete();
|
||||
\Thelia\Model\ContentImageQuery::create()->find()->delete();
|
||||
|
||||
\Thelia\Model\ProductDocumentQuery::create()->find()->delete();
|
||||
\Thelia\Model\CategoryDocumentQuery::create()->find()->delete();
|
||||
\Thelia\Model\FolderDocumentQuery::create()->find()->delete();
|
||||
\Thelia\Model\ContentDocumentQuery::create()->find()->delete();
|
||||
|
||||
\Thelia\Model\CouponQuery::create()->find()->delete();
|
||||
|
||||
$stmt = $con->prepare("SET foreign_key_checks = 1");
|
||||
|
||||
$stmt->execute();
|
||||
|
||||
echo "Creating customer\n";
|
||||
|
||||
//customer
|
||||
$customer = new Thelia\Model\Customer();
|
||||
$customer->createOrUpdate(
|
||||
@@ -186,11 +201,13 @@ try {
|
||||
}
|
||||
}
|
||||
|
||||
echo "Creating features\n";
|
||||
|
||||
//features and features_av
|
||||
$featureList = array();
|
||||
for($i=0; $i<4; $i++) {
|
||||
$feature = new Thelia\Model\Feature();
|
||||
$feature->setVisible(rand(1, 10)>7 ? 0 : 1);
|
||||
$feature->setVisible(1);
|
||||
$feature->setPosition($i);
|
||||
setI18n($faker, $feature);
|
||||
|
||||
@@ -209,6 +226,8 @@ try {
|
||||
}
|
||||
}
|
||||
|
||||
echo "Creating attributes\n";
|
||||
|
||||
//attributes and attributes_av
|
||||
$attributeList = array();
|
||||
for($i=0; $i<4; $i++) {
|
||||
@@ -231,6 +250,8 @@ try {
|
||||
}
|
||||
}
|
||||
|
||||
echo "Creating templates\n";
|
||||
|
||||
$template = new Thelia\Model\Template();
|
||||
setI18n($faker, $template, array("Name" => 20));
|
||||
$template->save();
|
||||
@@ -253,52 +274,75 @@ try {
|
||||
->save();
|
||||
}
|
||||
|
||||
echo "Creating folders and content\n";
|
||||
|
||||
//folders and contents
|
||||
$contentIdList = array();
|
||||
for($i=0; $i<4; $i++) {
|
||||
$folder = new Thelia\Model\Folder();
|
||||
$folder->setParent(0);
|
||||
$folder->setVisible(rand(1, 10)>7 ? 0 : 1);
|
||||
$folder->setPosition($i);
|
||||
$folder->setVisible(1);
|
||||
$folder->setPosition($i+1);
|
||||
setI18n($faker, $folder);
|
||||
|
||||
$folder->save();
|
||||
|
||||
$image = new FolderImage();
|
||||
$image = new \Thelia\Model\FolderImage();
|
||||
$image->setFolderId($folder->getId());
|
||||
generate_image($image, 1, 'folder', $folder->getId());
|
||||
|
||||
for($j=1; $j<rand(0, 5); $j++) {
|
||||
$document = new \Thelia\Model\FolderDocument();
|
||||
$document->setFolderId($folder->getId());
|
||||
generate_document($document, 1, 'folder', $folder->getId());
|
||||
|
||||
for($j=0; $j<3; $j++) {
|
||||
$subfolder = new Thelia\Model\Folder();
|
||||
$subfolder->setParent($folder->getId());
|
||||
$subfolder->setVisible(rand(1, 10)>7 ? 0 : 1);
|
||||
$subfolder->setPosition($j);
|
||||
$subfolder->setVisible(1);
|
||||
$subfolder->setPosition($j+1);
|
||||
setI18n($faker, $subfolder);
|
||||
|
||||
$subfolder->save();
|
||||
|
||||
$image = new FolderImage();
|
||||
$image = new \Thelia\Model\FolderImage();
|
||||
$image->setFolderId($subfolder->getId());
|
||||
generate_image($image, 1, 'folder', $subfolder->getId());
|
||||
|
||||
for($k=0; $k<rand(0, 5); $k++) {
|
||||
$document = new \Thelia\Model\FolderDocument();
|
||||
$document->setFolderId($folder->getId());
|
||||
generate_document($document, 1, 'folder', $subfolder->getId());
|
||||
|
||||
for($k=0; $k<4; $k++) {
|
||||
$content = new Thelia\Model\Content();
|
||||
$content->addFolder($subfolder);
|
||||
$content->setVisible(rand(1, 10)>7 ? 0 : 1);
|
||||
$content->setPosition($k);
|
||||
|
||||
$contentFolders = $content->getContentFolders();
|
||||
$collection = new \Propel\Runtime\Collection\Collection();
|
||||
$collection->prepend($contentFolders[0]->setDefaultFolder(1));
|
||||
$content->setContentFolders($collection);
|
||||
|
||||
$content->setVisible(1);
|
||||
$content->setPosition($k+1);
|
||||
setI18n($faker, $content);
|
||||
|
||||
$content->save();
|
||||
$contentId = $content->getId();
|
||||
$contentIdList[] = $contentId;
|
||||
|
||||
$image = new ContentImage();
|
||||
$image->setContentId($content->getId());
|
||||
$image = new \Thelia\Model\ContentImage();
|
||||
$image->setContentId($contentId);
|
||||
generate_image($image, 1, 'content', $contentId);
|
||||
|
||||
$document = new \Thelia\Model\ContentDocument();
|
||||
$document->setContentId($contentId);
|
||||
generate_document($document, 1, 'content', $contentId);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "Creating categories and products\n";
|
||||
|
||||
//categories and products
|
||||
$productIdList = array();
|
||||
$categoryIdList = array();
|
||||
@@ -406,20 +450,30 @@ try {
|
||||
}
|
||||
}
|
||||
|
||||
echo "Generating coupons fixtures\n";
|
||||
|
||||
generateCouponFixtures($thelia);
|
||||
|
||||
$con->commit();
|
||||
|
||||
echo "Successfully terminated.\n";
|
||||
|
||||
} catch (Exception $e) {
|
||||
echo "error : ".$e->getMessage()."\n";
|
||||
$con->rollBack();
|
||||
}
|
||||
|
||||
function createProduct($faker, $category, $position, $template, &$productIdList)
|
||||
function createProduct($faker, Thelia\Model\Category $category, $position, $template, &$productIdList)
|
||||
{
|
||||
$product = new Thelia\Model\Product();
|
||||
$product->setRef($category->getId() . '_' . $position . '_' . $faker->randomNumber(8));
|
||||
$product->addCategory($category);
|
||||
$product->setVisible(rand(1, 10)>7 ? 0 : 1);
|
||||
$product->setVisible(1);
|
||||
$productCategories = $product->getProductCategories();
|
||||
$collection = new \Propel\Runtime\Collection\Collection();
|
||||
$collection->prepend($productCategories[0]->setDefaultCategory(1));
|
||||
$product->setProductCategories($collection);
|
||||
$product->setVisible(1);
|
||||
$product->setPosition($position);
|
||||
$product->setTaxRuleId(1);
|
||||
$product->setTemplate($template);
|
||||
@@ -430,10 +484,14 @@ function createProduct($faker, $category, $position, $template, &$productIdList)
|
||||
$productId = $product->getId();
|
||||
$productIdList[] = $productId;
|
||||
|
||||
$image = new ProductImage();
|
||||
$image = new \Thelia\Model\ProductImage();
|
||||
$image->setProductId($productId);
|
||||
generate_image($image, 1, 'product', $productId);
|
||||
|
||||
$document = new \Thelia\Model\ProductDocument();
|
||||
$document->setProductId($productId);
|
||||
generate_document($document, 1, 'product', $productId);
|
||||
|
||||
return $product;
|
||||
}
|
||||
|
||||
@@ -441,7 +499,7 @@ function createCategory($faker, $parent, $position, &$categoryIdList, $contentId
|
||||
{
|
||||
$category = new Thelia\Model\Category();
|
||||
$category->setParent($parent);
|
||||
$category->setVisible(rand(1, 10)>7 ? 0 : 1);
|
||||
$category->setVisible(1);
|
||||
$category->setPosition($position);
|
||||
setI18n($faker, $category);
|
||||
|
||||
@@ -465,10 +523,14 @@ function createCategory($faker, $parent, $position, &$categoryIdList, $contentId
|
||||
->save();
|
||||
}
|
||||
|
||||
$image = new CategoryImage();
|
||||
$image = new \Thelia\Model\CategoryImage();
|
||||
$image->setCategoryId($categoryId);
|
||||
generate_image($image, 1, 'category', $categoryId);
|
||||
|
||||
$document = new \Thelia\Model\CategoryDocument();
|
||||
$document->setCategoryId($categoryId);
|
||||
generate_document($document, 1, 'category', $categoryId);
|
||||
|
||||
return $category;
|
||||
}
|
||||
|
||||
@@ -481,37 +543,36 @@ function generate_image($image, $position, $typeobj, $id) {
|
||||
->setDescription($faker->text(250))
|
||||
->setChapo($faker->text(40))
|
||||
->setPostscriptum($faker->text(40))
|
||||
->setPosition($position)
|
||||
->setFile(sprintf("sample-image-%s.png", $id))
|
||||
->save()
|
||||
;
|
||||
|
||||
// Generate images
|
||||
$imagine = new Imagine\Gd\Imagine();
|
||||
$image = $imagine->create(new Imagine\Image\Box(320,240), new Color('#E9730F'));
|
||||
$image = $imagine->create(new Imagine\Image\Box(320,240), new Imagine\Image\Color('#E9730F'));
|
||||
|
||||
$white = new Color('#FFF');
|
||||
$white = new Imagine\Image\Color('#FFF');
|
||||
|
||||
$font = $imagine->font(__DIR__.'/faker-assets/FreeSans.ttf', 14, $white);
|
||||
|
||||
$tbox = $font->box("THELIA");
|
||||
$image->draw()->text("THELIA", $font, new Point((320 - $tbox->getWidth()) / 2, 30));
|
||||
$image->draw()->text("THELIA", $font, new Imagine\Image\Point((320 - $tbox->getWidth()) / 2, 30));
|
||||
|
||||
$str = sprintf("%s sample image", ucfirst($typeobj));
|
||||
$tbox = $font->box($str);
|
||||
$image->draw()->text($str, $font, new Point((320 - $tbox->getWidth()) / 2, 80));
|
||||
$image->draw()->text($str, $font, new Imagine\Image\Point((320 - $tbox->getWidth()) / 2, 80));
|
||||
|
||||
$font = $imagine->font(__DIR__.'/faker-assets/FreeSans.ttf', 18, $white);
|
||||
|
||||
$str = sprintf("%s ID %d", strtoupper($typeobj), $id);
|
||||
$tbox = $font->box($str);
|
||||
$image->draw()->text($str, $font, new Point((320 - $tbox->getWidth()) / 2, 180));
|
||||
$image->draw()->text($str, $font, new Imagine\Image\Point((320 - $tbox->getWidth()) / 2, 180));
|
||||
|
||||
$image->draw()
|
||||
->line(new Point(0, 0), new Point(319, 0), $white)
|
||||
->line(new Point(319, 0), new Point(319, 239), $white)
|
||||
->line(new Point(319, 239), new Point(0,239), $white)
|
||||
->line(new Point(0, 239), new Point(0, 0), $white)
|
||||
->line(new Imagine\Image\Point(0, 0), new Imagine\Image\Point(319, 0), $white)
|
||||
->line(new Imagine\Image\Point(319, 0), new Imagine\Image\Point(319, 239), $white)
|
||||
->line(new Imagine\Image\Point(319, 239), new Imagine\Image\Point(0,239), $white)
|
||||
->line(new Imagine\Image\Point(0, 239), new Imagine\Image\Point(0, 0), $white)
|
||||
;
|
||||
|
||||
$image_file = sprintf("%s/../local/media/images/%s/sample-image-%s.png", __DIR__, $typeobj, $id);
|
||||
@@ -521,6 +582,26 @@ function generate_image($image, $position, $typeobj, $id) {
|
||||
$image->save($image_file);
|
||||
}
|
||||
|
||||
function generate_document($document, $position, $typeobj, $id) {
|
||||
|
||||
global $faker;
|
||||
|
||||
$document
|
||||
->setTitle($faker->text(20))
|
||||
->setDescription($faker->text(250))
|
||||
->setChapo($faker->text(40))
|
||||
->setPostscriptum($faker->text(40))
|
||||
->setFile(sprintf("sample-document-%s.txt", $id))
|
||||
->save()
|
||||
;
|
||||
|
||||
$document_file = sprintf("%s/../local/media/documents/%s/sample-document-%s.txt", __DIR__, $typeobj, $id);
|
||||
|
||||
if (! is_dir(dirname($document_file))) mkdir(dirname($document_file), 0777, true);
|
||||
|
||||
file_put_contents($document_file, $faker->text(256));
|
||||
}
|
||||
|
||||
function setI18n($faker, &$object, $fields = array('Title' => 20, 'Description' => 50) )
|
||||
{
|
||||
$localeList = $localeList = array('fr_FR', 'en_US', 'es_ES', 'it_IT');
|
||||
|
||||
@@ -13,8 +13,11 @@ INSERT INTO `config` (`name`, `value`, `secured`, `hidden`, `created_at`, `updat
|
||||
('imagine_graphic_driver', 'gd', 0, 0, NOW(), NOW()),
|
||||
('default_images_quality_percent', '75', 0, 0, NOW(), NOW()),
|
||||
('original_image_delivery_mode', 'symlink', 0, 0, NOW(), NOW()),
|
||||
('original_document_delivery_mode', 'symlink', 0, 0, NOW(), NOW()),
|
||||
('images_library_path', 'local/media/images', 0, 0, NOW(), NOW()),
|
||||
('documents_library_path', 'local/media/documents', 0, 0, NOW(), NOW()),
|
||||
('image_cache_dir_from_web_root', 'cache/images', 0, 0, NOW(), NOW()),
|
||||
('document_cache_dir_from_web_root', 'cache/documents', 0, 0, NOW(), NOW()),
|
||||
('currency_rate_update_url', 'http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml', 0, 0, NOW(), NOW()),
|
||||
('page_not_found_view', '404.html', 0, 0, NOW(), NOW()),
|
||||
('use_tax_free_amounts', 0, 0, 0, NOW(), NOW()),
|
||||
@@ -28,7 +31,13 @@ INSERT INTO `config` (`name`, `value`, `secured`, `hidden`, `created_at`, `updat
|
||||
|
||||
|
||||
INSERT INTO `module` (`id`, `code`, `type`, `activate`, `position`, `full_namespace`, `created_at`, `updated_at`) VALUES
|
||||
(1, 'DebugBar', 1, 1, 1, 'DebugBar\\DebugBar', NOW(), NOW());
|
||||
(1, 'DebugBar', 1, 1, 1, 'DebugBar\\DebugBar', NOW(), NOW()),
|
||||
(2, 'Colissimo', 2, 1, 1, 'Colissimo\\Colissimo', NOW(), NOW());
|
||||
|
||||
INSERT INTO `module_i18n` (`id`, `locale`, `title`, `description`, `chapo`, `postscriptum`) VALUES
|
||||
('2', 'en_US', '72h delivery', NULL, NULL, NULL),
|
||||
('2', 'fr_FR', 'Livraison par colissimo en 72h', NULL, NULL, NULL);
|
||||
|
||||
|
||||
INSERT INTO `customer_title`(`id`, `by_default`, `position`, `created_at`, `updated_at`) VALUES
|
||||
(1, 1, 1, NOW(), NOW()),
|
||||
@@ -43,13 +52,13 @@ INSERT INTO `customer_title_i18n` (`id`, `locale`, `short`, `long`) VALUES
|
||||
(3, 'fr_FR', 'Mlle', 'Madamemoiselle'),
|
||||
(3, 'en_US', 'Miss', 'Miss');
|
||||
|
||||
INSERT INTO `currency` (`id` ,`code` ,`symbol` ,`rate`, `position` ,`by_default` ,`created_at` ,`updated_at`)
|
||||
INSERT INTO `currency` (`id`, `code`, `symbol`, `rate`, `position`, `by_default`, `created_at`, `updated_at`)
|
||||
VALUES
|
||||
(1, 'EUR', '€', '1', 1, '1', NOW() , NOW()),
|
||||
(1, 'EUR', '€', '1', 1, '1', NOW(), NOW()),
|
||||
(2, 'USD', '$', '1.26', 2, '0', NOW(), NOW()),
|
||||
(3, 'GBP', '£', '0.89', 3, '0', NOW(), NOW());
|
||||
|
||||
INSERT INTO `currency_i18n` (`id` ,`locale` ,`name`)
|
||||
INSERT INTO `currency_i18n` (`id`, `locale`, `name`)
|
||||
VALUES
|
||||
(1, 'fr_FR', 'Euro'),
|
||||
(1, 'en_US', 'Euro'),
|
||||
|
||||
@@ -36,7 +36,7 @@ CREATE TABLE `product`
|
||||
`ref` VARCHAR(255) NOT NULL,
|
||||
`visible` TINYINT DEFAULT 0 NOT NULL,
|
||||
`position` INTEGER NOT NULL,
|
||||
`template_id` INTEGER NOT NULL,
|
||||
`template_id` INTEGER,
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
`version` INTEGER DEFAULT 0,
|
||||
@@ -66,11 +66,13 @@ CREATE TABLE `product_category`
|
||||
(
|
||||
`product_id` INTEGER NOT NULL,
|
||||
`category_id` INTEGER NOT NULL,
|
||||
`default_category` TINYINT(1),
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`product_id`,`category_id`),
|
||||
INDEX `idx_product_has_category_category1` (`category_id`),
|
||||
INDEX `idx_product_has_category_product1` (`product_id`),
|
||||
INDEX `idx_product_has_category_default` (`default_category`),
|
||||
CONSTRAINT `fk_product_has_category_product1`
|
||||
FOREIGN KEY (`product_id`)
|
||||
REFERENCES `product` (`id`)
|
||||
@@ -341,6 +343,8 @@ CREATE TABLE `attribute_combination`
|
||||
CONSTRAINT `fk_attribute_combination_product_sale_elements_id`
|
||||
FOREIGN KEY (`product_sale_elements_id`)
|
||||
REFERENCES `product_sale_elements` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
@@ -632,54 +636,73 @@ DROP TABLE IF EXISTS `order`;
|
||||
CREATE TABLE `order`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`ref` VARCHAR(45),
|
||||
`ref` VARCHAR(45) NOT NULL,
|
||||
`customer_id` INTEGER NOT NULL,
|
||||
`address_invoice` INTEGER,
|
||||
`address_delivery` INTEGER,
|
||||
`invoice_date` DATE,
|
||||
`currency_id` INTEGER,
|
||||
`invoice_order_address_id` INTEGER NOT NULL,
|
||||
`delivery_order_address_id` INTEGER NOT NULL,
|
||||
`invoice_date` DATE NOT NULL,
|
||||
`currency_id` INTEGER NOT NULL,
|
||||
`currency_rate` FLOAT NOT NULL,
|
||||
`transaction` VARCHAR(100),
|
||||
`delivery_num` VARCHAR(100),
|
||||
`invoice` VARCHAR(100),
|
||||
`postage` FLOAT,
|
||||
`payment` VARCHAR(45) NOT NULL,
|
||||
`carrier` VARCHAR(45) NOT NULL,
|
||||
`status_id` INTEGER,
|
||||
`lang` VARCHAR(10) NOT NULL,
|
||||
`transaction_ref` VARCHAR(100) COMMENT 'transaction reference - usually use to identify a transaction with banking modules',
|
||||
`delivery_ref` VARCHAR(100) COMMENT 'delivery reference - usually use to identify a delivery progress on a distant delivery tracker website',
|
||||
`invoice_ref` VARCHAR(100) COMMENT 'the invoice reference',
|
||||
`postage` FLOAT NOT NULL,
|
||||
`payment_module_id` INTEGER NOT NULL,
|
||||
`delivery_module_id` INTEGER NOT NULL,
|
||||
`status_id` INTEGER NOT NULL,
|
||||
`lang_id` INTEGER NOT NULL,
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX `ref_UNIQUE` (`ref`),
|
||||
INDEX `idx_order_currency_id` (`currency_id`),
|
||||
INDEX `idx_order_customer_id` (`customer_id`),
|
||||
INDEX `idx_order_address_invoice` (`address_invoice`),
|
||||
INDEX `idx_order_address_delivery` (`address_delivery`),
|
||||
INDEX `idx_order_invoice_order_address_id` (`invoice_order_address_id`),
|
||||
INDEX `idx_order_delivery_order_address_id` (`delivery_order_address_id`),
|
||||
INDEX `idx_order_status_id` (`status_id`),
|
||||
INDEX `fk_order_payment_module_id_idx` (`payment_module_id`),
|
||||
INDEX `fk_order_delivery_module_id_idx` (`delivery_module_id`),
|
||||
INDEX `fk_order_lang_id_idx` (`lang_id`),
|
||||
CONSTRAINT `fk_order_currency_id`
|
||||
FOREIGN KEY (`currency_id`)
|
||||
REFERENCES `currency` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE SET NULL,
|
||||
ON DELETE RESTRICT,
|
||||
CONSTRAINT `fk_order_customer_id`
|
||||
FOREIGN KEY (`customer_id`)
|
||||
REFERENCES `customer` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_order_address_invoice`
|
||||
FOREIGN KEY (`address_invoice`)
|
||||
ON DELETE RESTRICT,
|
||||
CONSTRAINT `fk_order_invoice_order_address_id`
|
||||
FOREIGN KEY (`invoice_order_address_id`)
|
||||
REFERENCES `order_address` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE SET NULL,
|
||||
CONSTRAINT `fk_order_address_delivery`
|
||||
FOREIGN KEY (`address_delivery`)
|
||||
ON DELETE RESTRICT,
|
||||
CONSTRAINT `fk_order_delivery_order_address_id`
|
||||
FOREIGN KEY (`delivery_order_address_id`)
|
||||
REFERENCES `order_address` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE SET NULL,
|
||||
ON DELETE RESTRICT,
|
||||
CONSTRAINT `fk_order_status_id`
|
||||
FOREIGN KEY (`status_id`)
|
||||
REFERENCES `order_status` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE SET NULL
|
||||
ON DELETE RESTRICT,
|
||||
CONSTRAINT `fk_order_payment_module_id`
|
||||
FOREIGN KEY (`payment_module_id`)
|
||||
REFERENCES `module` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE RESTRICT,
|
||||
CONSTRAINT `fk_order_delivery_module_id`
|
||||
FOREIGN KEY (`delivery_module_id`)
|
||||
REFERENCES `module` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE RESTRICT,
|
||||
CONSTRAINT `fk_order_lang_id`
|
||||
FOREIGN KEY (`lang_id`)
|
||||
REFERENCES `lang` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE RESTRICT
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
@@ -852,32 +875,38 @@ CREATE TABLE `area`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`name` VARCHAR(100) NOT NULL,
|
||||
`unit` FLOAT,
|
||||
`postage` FLOAT,
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- delivzone
|
||||
-- area_delivery_module
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `delivzone`;
|
||||
DROP TABLE IF EXISTS `area_delivery_module`;
|
||||
|
||||
CREATE TABLE `delivzone`
|
||||
CREATE TABLE `area_delivery_module`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`area_id` INTEGER,
|
||||
`delivery` VARCHAR(45) NOT NULL,
|
||||
`area_id` INTEGER NOT NULL,
|
||||
`delivery_module_id` INTEGER NOT NULL,
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `idx_delivzone_area_id` (`area_id`),
|
||||
CONSTRAINT `fk_delivzone_area_id`
|
||||
INDEX `idx_area_delivery_module_area_id` (`area_id`),
|
||||
INDEX `idx_area_delivery_module_delivery_module_id_idx` (`delivery_module_id`),
|
||||
CONSTRAINT `fk_area_delivery_module_area_id`
|
||||
FOREIGN KEY (`area_id`)
|
||||
REFERENCES `area` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE SET NULL
|
||||
ON DELETE CASCADE,
|
||||
CONSTRAINT `idx_area_delivery_module_delivery_module_id`
|
||||
FOREIGN KEY (`delivery_module_id`)
|
||||
REFERENCES `module` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
@@ -1128,11 +1157,13 @@ CREATE TABLE `content_folder`
|
||||
(
|
||||
`content_id` INTEGER NOT NULL,
|
||||
`folder_id` INTEGER NOT NULL,
|
||||
`default_folder` TINYINT(1),
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`content_id`,`folder_id`),
|
||||
INDEX `idx_content_folder_content_id` (`content_id`),
|
||||
INDEX `idx_content_folder_folder_id` (`folder_id`),
|
||||
INDEX `idx_content_folder_default` (`default_folder`),
|
||||
CONSTRAINT `fk_content_folder_content_id`
|
||||
FOREIGN KEY (`content_id`)
|
||||
REFERENCES `content` (`id`)
|
||||
@@ -2136,7 +2167,7 @@ CREATE TABLE `product_version`
|
||||
`ref` VARCHAR(255) NOT NULL,
|
||||
`visible` TINYINT DEFAULT 0 NOT NULL,
|
||||
`position` INTEGER NOT NULL,
|
||||
`template_id` INTEGER NOT NULL,
|
||||
`template_id` INTEGER,
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
`version` INTEGER DEFAULT 0 NOT NULL,
|
||||
|
||||
Reference in New Issue
Block a user