On continue à adapter le template...

This commit is contained in:
2021-04-16 19:23:51 +02:00
parent 1e2e612349
commit c160eb2141
127 changed files with 42260 additions and 36 deletions

View File

@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8" ?>
<config xmlns="http://thelia.net/schema/dic/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
<loops>
<loop name="selection_list" class="Selection\Loop\SelectionLoop"/>
<loop name="selection_container" class="Selection\Loop\SelectionContainerLoop"/>
<loop name="selection_category" class="Selection\Loop\SelectionLoopCategory"/>
<loop name="selection_folder" class="Selection\Loop\SelectionLoopFolder"/>
<loop name="selection_image" class="Selection\Loop\SelectionImage"/>
<loop name="selection_content_related" class="Selection\Loop\SelectionContentRelated"/>
<loop name="selection_product_related" class="Selection\Loop\SelectionProductRelated"/>
</loops>
<forms>
<form name="admin.selection.update" class="Selection\Form\SelectionUpdateForm"/>
<form name="admin.selection.create" class="Selection\Form\SelectionCreateForm"/>
<form name="admin.selection.seo" class="Thelia\Form\SelectionCreateForm"/>
<form name="admin.selection.image.modification" class="Selection\Form\SelectionImageModification"/>
<form name="admin.selection.container.create" class="Selection\Form\SelectionContainerCreateForm"/>
<form name="admin.selection.container.update" class="Selection\Form\SelectionContainerUpdateForm"/>
<form name="admin.selection.container.seo" class="Thelia\Form\SelectionCreateForm"/>
<form name="admin.selection.container.image.modification" class="Selection\Form\SelectioncontainerImageModification"/>
</forms>
<services>
<service id="selection.action.customer" class="Selection\Action\SelectionAction">
<tag name="kernel.event_subscriber"/>
</service>
<service id="selection.container.action" class="Selection\Action\SelectionContainerAction">
<tag name="kernel.event_subscriber"/>
</service>
<service id="thelia.file_manager" class="Thelia\Files\FileManager">
<argument>%file_model.classes%</argument>
</service>
</services>
<hooks>
<hook id="selection.hook">
</hook>
<hook id="Selection.hook.back" class="Selection\Hook\BackHook">
<tag name="hook.event_listener" event="main.top-menu-tools" type="back"/>
</hook>
</hooks>
</config>

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="http://thelia.net/schema/dic/module"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://thelia.net/schema/dic/module http://thelia.net/schema/dic/module/module-2_2.xsd">
<fullnamespace>Selection\Selection</fullnamespace>
<descriptive locale="en_US">
<title>Selection of product and/or content</title>
</descriptive>
<descriptive locale="fr_FR">
<title>Selection de produits et/ou de contenus</title>
</descriptive>
<languages>
<language>en_US</language>
<language>fr_FR</language>
</languages>
<version>1.1.14</version>
<authors>
<author>
<name>Maxime BRUCHET</name>
<email>mbruchet@openstudio.fr</email>
</author>
<author>
<name>Franck Allimant</name>
<company>OpenStudio</company>
<email>fallimant@openstudio.fr</email>
<website>www.openstudio.fr</website>
</author>
</authors>
<type>classic</type>
<thelia>2.3.4</thelia>
<stability>other</stability>
</module>

View File

@@ -0,0 +1,209 @@
<?xml version="1.0" encoding="UTF-8" ?>
<routes xmlns="http://symfony.com/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
<!-- ******************************* Root link to selection list ******************************* -->
<route id="selection.list" path="/admin/selection">
<default key="_controller">Selection\Controller\SelectionController::viewAction</default>
</route>
<!-- ******************************* Root link to update management ******************************* -->
<!-- ***** Default page of management update-->
<route id="selection.update" path="/admin/selection/update/{selectionId}" methods="get">
<default key="_controller">Selection\Controller\SelectionUpdateController::updateAction</default>
<requirement key="selectionID">\d+</requirement>
</route>
<!-- ***** Root to function which return value in select-->
<route id="selection.update.getProductRelated" path="admin/selection/update/getProductRelated/{categoryID}">
<default key="_controller">Selection\Controller\SelectionRelatedProductController::getProductRelated</default>
<requirement key="categoryID">\d+</requirement>
</route>
<!-- ***** Root to function which add value-->
<route id="selection.update.getContentRelated" path="/admin/selection/update/getContentRelated/{folderID}">
<default key="_controller">Selection\Controller\SelectionRelatedContentController::getContentRelated</default>
<requirement key="folderID">\d+</requirement>
</route>
<route id="admin.selection.update.addProductRelated" path="admin/selection/update/addProductRelated/{productID}{selectionID}">
<default key="_controller">Selection\Controller\SelectionRelatedProductController::addProductRelated</default>
<requirement key="productID">\d+</requirement>
<requirement key="selectionID">\d+</requirement>
</route>
<route id="admin.selection.update.addContentRelated" path="/admin/selection/update/addContentRelated/{contentID}{selectionID}">
<default key="_controller">Selection\Controller\SelectionRelatedContentController::addContentRelated</default>
<requirement key="contentID">\d+</requirement>
<requirement key="selectionID">\d+</requirement>
</route>
<!-- ***** Root to function which return value to show in table-->
<route id="selection.show.productInTable" path="/admin/selection/update/showProduct/{selectionID}">
<default key="_controller">Selection\Controller\SelectionRelatedProductController::showProduct</default>
<requirement key="selectionID">\d+</requirement>
</route>
<route id="selection.show.contentInTable" path="/admin/selection/update/showContent/{selectionID}">
<default key="_controller">Selection\Controller\SelectionRelatedContentController::showContent</default>
<requirement key="selectionID">\d+</requirement>
</route>
<!-- ***** Root to function which save the selection-->
<route id="selection.update.saveSelection" path="/admin/selection/save">
<default key="_controller">Selection\Controller\SelectionUpdateController::processUpdateAction</default>
</route>
<!-- ***** Root to function which create and save a new selection-->
<route id="selection.create.createSelection" path="/admin/selection/create">
<default key="_controller">Selection\Controller\SelectionUpdateController::createSelection</default>
</route>
<!-- ***** Root to function which delete a selection from the list-->
<route id="admin.delete.selection" path="/admin/selection/delete">
<default key="_controller">Selection\Controller\SelectionUpdateController::deleteAction</default>
</route>
<!-- ***** Root to function which create and save a new selection container-->
<route id="selection.create.selection.container" path="/admin/selection/container/create">
<default key="_controller">Selection\Controller\SelectionContainerUpdateController::createAction</default>
</route>
<route id="selection.update.selection.container" path="/admin/selection/container/save">
<default key="_controller">Selection\Controller\SelectionContainerUpdateController::processUpdateAction</default>
</route>
<!-- ***** Root to function which delete a selection container from the list-->
<route id="admin.delete.selection.container" path="/admin/selection/container/delete">
<default key="_controller">Selection\Controller\SelectionContainerUpdateController::deleteAction</default>
</route>
<!-- ***** Root to function which update selection container-->
<route id="admin.selection.container.view" path="/admin/selection/container/view/{selectionContainerId}">
<default key="_controller">Selection\Controller\SelectionContainerUpdateController::viewAction</default>
<requirement key="selectionContainerId">\d+</requirement>
</route>
<!-- ***** Root to function which update selection container-->
<route id="admin.selection.container.update" path="/admin/selection/container/update/{selectionContainerId}" methods="get">
<default key="_controller">Selection\Controller\SelectionContainerUpdateController::updateContainerAction</default>
<requirement key="selectionContainerId">\d+</requirement>
</route>
<route id="admin.selection.container.update-position" path="/admin/selection/container/update-position">
<default key="_controller">Selection\Controller\SelectionContainerUpdateController::updatePositionAction</default>
</route>
<!-- Visiblity of a selection container-->
<route id="admin.selection.container.set-default" path="/admin/selection/container/toggle-online">
<default key="_controller">Selection\Controller\SelectionContainerUpdateController::setToggleVisibilityAction</default>
</route>
<!-- ***** Root to function which save SEO content-->
<route id="admin.selection.seo.save" path="/admin/selection/seo/save">
<default key="_controller">Selection\Controller\SelectionUpdateController::processUpdateSeoAction</default>
</route>
<route id="admin.selection.container.seo.save" path="/admin/selection/container/seo/save">
<default key="_controller">Selection\Controller\SelectionContainerUpdateController::processUpdateSeoAction</default>
</route>
<!-- ***** Root to function which modify a related product position-->
<route id="selection.productRelated.update-position" path="/admin/selection/product-related/update-position">
<default key="_controller">Selection\Controller\SelectionUpdateController::updatePositionAction</default>
</route>
<!-- ******************************* Root link to picture edit ******************************* -->
<route id="selection.image.form-ajax" path="/selection/image/type/{parentType}/{parentId}/form-ajax">
<default key="_controller">Selection\Controller\ImageUploadController::getImageFormAjaxAction</default>
<requirement key="parentType">.*</requirement>
<requirement key="parentId">\d+</requirement>
</route>
<route id="selection.image.list-ajax" path="/selection/image/type/{parentType}/{parentId}/list-ajax">
<default key="_controller">Selection\Controller\ImageUploadController::getImageListAjaxAction</default>
<requirement key="parentType">.*</requirement>
<requirement key="parentId">\d+</requirement>
</route>
<route id="selection.image.save-ajax" path="/selection/image/type/{parentType}/{parentId}/save-ajax">
<default key="_controller">Selection\Controller\ImageUploadController::saveImageAjaxAction</default>
<requirement key="parentType">.*</requirement>
<requirement key="parentId">\d+</requirement>
</route>
<route id="selection.image.update.title" path="/selection/image/type/{parentType}/{imageId}/{parentId}/update/title" methods="post">
<default key="_controller">Selection\Controller\ImageUploadController::updateImageTitleAction</default>
<requirement key="parentType">.*</requirement>
<requirement key="imageId">\d+</requirement>
<requirement key="parentId">\d+</requirement>
</route>
<route id="selection.image.update.view" path="/selection/image/type/{parentType}/{imageId}/update" methods="get">
<default key="_controller">Selection\Controller\ImageUploadController::viewImageAction</default>
<requirement key="parentType">.*</requirement>
<requirement key="imageId">\d+</requirement>
</route>
<route id="selection.image.update.edit/admin/image/type/" path="/selection/image/type/{parentType}/{imageId}/update" methods="post">
<default key="_controller">Selection\Controller\ImageUploadController::updateImageAction</default>
<requirement key="parentType">.*</requirement>
<requirement key="imageId">\d+</requirement>
</route>
<route id="selection.image.toggle.process" path="admin/selection/image/type/{parentType}/{documentId}/{parentId}/toggle">
<default key="_controller">Selection\Controller\ImageUploadController::toggleVisibilityImageAction</default>
<requirement key="parentType">.*</requirement>
<requirement key="documentId">\d+</requirement>
<requirement key="parentId">\d+</requirement>
</route>
<route id="selection.image.delete" path="/admin/selection/image/type/{parentType}/delete/{parentId}/{imageId}">
<default key="_controller">Selection\Controller\ImageUploadController::deleteImageAction</default>
<requirement key="parentType">.*</requirement>
<requirement key="imageId">\d+</requirement>
<requirement key="parentId">\d+</requirement>
</route>
<route id="admin.image.update-position" path="/admin/selection/image/type/{parentType}/{parentId}/update-position">
<default key="_controller">Selection\Controller\ImageUploadController::updateImagePositionAction</default>
<requirement key="parentType">.*</requirement>
<requirement key="parentId">\d+</requirement>
</route>
<!-- Related to a selection root -->
<!-- Delete -->
<route id="admin.delete.selection.product" path="admin/selection/delete/relatedProduct/{selectionID}/{productID}">
<default key="_controller">Selection\Controller\SelectionUpdateController::deleteRelatedProduct</default>
<requirement key="selectionID">\d+</requirement>
<requirement key="productID">\d+</requirement>
</route>
<route id="admin.delete.selection.content" path="admin/selection/delete/relatedContent/{selectionID}/{contentID}">
<default key="_controller">Selection\Controller\SelectionUpdateController::deleteRelatedContent</default>
<requirement key="selectionID">\d+</requirement>
<requirement key="contentID">\d+</requirement>
</route>
<!-- Visiblity of a selection-->
<route id="admin.selection.set-default" path="/admin/selection/toggle-online">
<default key="_controller">Selection\Controller\SelectionUpdateController::setToggleVisibilityAction</default>
</route>
<route id="admin.selection.update-position" path="/admin/selection/update-position">
<default key="_controller">Selection\Controller\SelectionUpdateController::updateSelectionPositionAction</default>
</route>
</routes>

View File

@@ -0,0 +1,132 @@
<?xml version="1.0" encoding="UTF-8"?>
<database defaultIdMethod="native" name="thelia"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../core/vendor/thelia/propel/resources/xsd/database.xsd" >
<table name="selection" namespace="Selection\Model">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER"/>
<column name="visible" required="true" type="TINYINT"/>
<column name="code" type="VARCHAR" size="255" />
<column name="title" type="VARCHAR" size="255" />
<column name="description" type="LONGVARCHAR" />
<column name="chapo" type="LONGVARCHAR" />
<column name="postscriptum" type="LONGVARCHAR" />
<column name="position" type="INTEGER" />
<!-- add seo column -->
<column name="meta_title" size="255" type="VARCHAR" />
<column name="meta_description" type="LONGVARCHAR" />
<column name="meta_keywords" type="LONGVARCHAR" />
<!-- end add seo column -->
<behavior name="timestampable" />
<behavior name="i18n">
<parameter name="i18n_columns" value="title, description, chapo, postscriptum, meta_title, meta_description, meta_keywords" />
</behavior>
</table>
<table name="selection_product" namespace="Selection\Model">
<column name="selection_id" primaryKey="true" required="true" type="INTEGER"/>
<column name="product_id" primaryKey="true" required="true" type="INTEGER"/>
<column name="position" required="true" type="INTEGER"/>
<foreign-key foreignTable="product" name="fk_selection_product_product_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="product_id"/>
</foreign-key>
<foreign-key foreignTable="selection" name="fk_selection_product_selection_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="selection_id"/>
</foreign-key>
<behavior name="timestampable" />
</table>
<table name="selection_content" namespace="Selection\Model">
<column name="selection_id" primaryKey="true" required="true" type="INTEGER"/>
<column name="content_id" primaryKey="true" required="true" type="INTEGER"/>
<column name="position" type="INTEGER"/>
<foreign-key foreignTable="content" name="fk_selection_content_content_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="content_id"/>
</foreign-key>
<foreign-key foreignTable="selection" name="fk_selection_content_selection_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="selection_id"/>
</foreign-key>
<behavior name="timestampable" />
</table>
<table name="selection_image" namespace="Selection\Model">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER"/>
<column name="selection_id" required="true" type="INTEGER"/>
<column name="file" required="true" size="255" type="VARCHAR" />
<column defaultValue="1" name="visible" required="true" type="TINYINT" />
<column name="position" type="INTEGER" />
<column name="title" size="255" type="VARCHAR" />
<column name="description" type="CLOB" />
<column name="chapo" type="LONGVARCHAR" />
<column name="postscriptum" type="LONGVARCHAR" />
<foreign-key foreignTable="selection" name="fk_selection_image_selection_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="selection_id" />
</foreign-key>
<behavior name="timestampable" />
<behavior name="i18n">
<parameter name="i18n_columns" value="title, description, chapo, postscriptum" />
</behavior>
</table>
<table name="selection_container" namespace="Selection\Model" allowPkInsert="true">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER"/>
<column name="visible" required="true" type="TINYINT"/>
<column name="code" type="VARCHAR" size="255" />
<column name="title" type="VARCHAR" size="255" />
<column name="description" type="LONGVARCHAR" />
<column name="chapo" type="LONGVARCHAR" />
<column name="postscriptum" type="LONGVARCHAR" />
<column name="position" type="INTEGER" />
<!-- add seo column -->
<column name="meta_title" size="255" type="VARCHAR" />
<column name="meta_description" type="LONGVARCHAR" />
<column name="meta_keywords" type="LONGVARCHAR" />
<!-- end add seo column -->
<behavior name="timestampable" />
<behavior name="i18n">
<parameter name="i18n_columns" value="title, description, chapo, postscriptum, meta_title, meta_description, meta_keywords" />
</behavior>
</table>
<table name="selection_container_associated_selection" namespace="Selection\Model" allowPkInsert="true">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER"/>
<column name="selection_container_id" required="true" type="INTEGER"/>
<column name="selection_id" required="true" type="INTEGER"/>
<foreign-key foreignTable="selection_container" name="selection_container_associated_selection_container_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="selection_container_id" />
</foreign-key>
<foreign-key foreignTable="selection" name="selection_container_associated_selection_selection_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="selection_id" />
</foreign-key>
<index name="idx_selection_container_associated_selection_container_id">
<index-column name="selection_container_id" />
</index>
<index name="idx_selection_container_associated_selection_id">
<index-column name="selection_id" />
</index>
<behavior name="timestampable" />
</table>
<table name="selection_container_image" namespace="Selection\Model" allowPkInsert="true">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER"/>
<column name="selection_container_id" required="true" type="INTEGER"/>
<column name="file" required="true" size="255" type="VARCHAR" />
<column defaultValue="1" name="visible" required="true" type="TINYINT" />
<column name="position" type="INTEGER" />
<column name="title" size="255" type="VARCHAR" />
<column name="description" type="CLOB" />
<column name="chapo" type="LONGVARCHAR" />
<column name="postscriptum" type="LONGVARCHAR" />
<foreign-key foreignTable="selection_container" name="fk_selection_container_image_selection_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="selection_container_id" />
</foreign-key>
<behavior name="timestampable" />
<behavior name="i18n">
<parameter name="i18n_columns" value="title, description, chapo, postscriptum" />
</behavior>
</table>
<external-schema filename="local/config/schema.xml" referenceOnly="true" />
</database>

View File

@@ -0,0 +1,261 @@
# This is a fix for InnoDB in MySQL >= 4.1.x
# It "suspends judgement" for fkey relationships until are tables are set.
SET FOREIGN_KEY_CHECKS = 0;
-- ---------------------------------------------------------------------
-- selection
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `selection`;
CREATE TABLE `selection`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`visible` TINYINT NOT NULL,
`code` VARCHAR(255),
`position` INTEGER,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- selection_product
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `selection_product`;
CREATE TABLE `selection_product`
(
`selection_id` INTEGER NOT NULL,
`product_id` INTEGER NOT NULL,
`position` INTEGER NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`selection_id`,`product_id`),
INDEX `fi_selection_product_product_id` (`product_id`),
CONSTRAINT `fk_selection_product_product_id`
FOREIGN KEY (`product_id`)
REFERENCES `product` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE,
CONSTRAINT `fk_selection_product_selection_id`
FOREIGN KEY (`selection_id`)
REFERENCES `selection` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- selection_content
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `selection_content`;
CREATE TABLE `selection_content`
(
`selection_id` INTEGER NOT NULL,
`content_id` INTEGER NOT NULL,
`position` INTEGER,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`selection_id`,`content_id`),
INDEX `fi_selection_content_content_id` (`content_id`),
CONSTRAINT `fk_selection_content_content_id`
FOREIGN KEY (`content_id`)
REFERENCES `content` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE,
CONSTRAINT `fk_selection_content_selection_id`
FOREIGN KEY (`selection_id`)
REFERENCES `selection` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- selection_image
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `selection_image`;
CREATE TABLE `selection_image`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`selection_id` INTEGER NOT NULL,
`file` VARCHAR(255) NOT NULL,
`visible` TINYINT DEFAULT 1 NOT NULL,
`position` INTEGER,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
INDEX `fi_selection_image_selection_id` (`selection_id`),
CONSTRAINT `fk_selection_image_selection_id`
FOREIGN KEY (`selection_id`)
REFERENCES `selection` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- selection_container
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `selection_container`;
CREATE TABLE `selection_container`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`visible` TINYINT NOT NULL,
`code` VARCHAR(255),
`position` INTEGER,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- selection_container_associated_selection
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `selection_container_associated_selection`;
CREATE TABLE `selection_container_associated_selection`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`selection_container_id` INTEGER NOT NULL,
`selection_id` INTEGER NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
INDEX `idx_selection_container_associated_selection_container_id` (`selection_container_id`),
INDEX `idx_selection_container_associated_selection_id` (`selection_id`),
CONSTRAINT `selection_container_associated_selection_container_id`
FOREIGN KEY (`selection_container_id`)
REFERENCES `selection_container` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE,
CONSTRAINT `selection_container_associated_selection_selection_id`
FOREIGN KEY (`selection_id`)
REFERENCES `selection` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- selection_container_image
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `selection_container_image`;
CREATE TABLE `selection_container_image`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`selection_container_id` INTEGER NOT NULL,
`file` VARCHAR(255) NOT NULL,
`visible` TINYINT DEFAULT 1 NOT NULL,
`position` INTEGER,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
INDEX `fi_selection_container_image_selection_id` (`selection_container_id`),
CONSTRAINT `fk_selection_container_image_selection_id`
FOREIGN KEY (`selection_container_id`)
REFERENCES `selection_container` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- selection_i18n
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `selection_i18n`;
CREATE TABLE `selection_i18n`
(
`id` INTEGER NOT NULL,
`locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL,
`title` VARCHAR(255),
`description` TEXT,
`chapo` TEXT,
`postscriptum` TEXT,
`meta_title` VARCHAR(255),
`meta_description` TEXT,
`meta_keywords` TEXT,
PRIMARY KEY (`id`,`locale`),
CONSTRAINT `selection_i18n_fk_765b89`
FOREIGN KEY (`id`)
REFERENCES `selection` (`id`)
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- selection_image_i18n
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `selection_image_i18n`;
CREATE TABLE `selection_image_i18n`
(
`id` INTEGER NOT NULL,
`locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL,
`title` VARCHAR(255),
`description` LONGTEXT,
`chapo` TEXT,
`postscriptum` TEXT,
PRIMARY KEY (`id`,`locale`),
CONSTRAINT `selection_image_i18n_fk_d501a8`
FOREIGN KEY (`id`)
REFERENCES `selection_image` (`id`)
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- selection_container_i18n
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `selection_container_i18n`;
CREATE TABLE `selection_container_i18n`
(
`id` INTEGER NOT NULL,
`locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL,
`title` VARCHAR(255),
`description` TEXT,
`chapo` TEXT,
`postscriptum` TEXT,
`meta_title` VARCHAR(255),
`meta_description` TEXT,
`meta_keywords` TEXT,
PRIMARY KEY (`id`,`locale`),
CONSTRAINT `selection_container_i18n_fk_25b287`
FOREIGN KEY (`id`)
REFERENCES `selection_container` (`id`)
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- selection_container_image_i18n
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `selection_container_image_i18n`;
CREATE TABLE `selection_container_image_i18n`
(
`id` INTEGER NOT NULL,
`locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL,
`title` VARCHAR(255),
`description` LONGTEXT,
`chapo` TEXT,
`postscriptum` TEXT,
PRIMARY KEY (`id`,`locale`),
CONSTRAINT `selection_container_image_i18n_fk_eed190`
FOREIGN KEY (`id`)
REFERENCES `selection_container_image` (`id`)
ON DELETE CASCADE
) ENGINE=InnoDB;
# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -0,0 +1,11 @@
SET FOREIGN_KEY_CHECKS = 0;
-- Add the 'code' column to the selection tables.
ALTER TABLE `selection` ADD `code` varchar(255) NOT NULL AFTER `visible`;
ALTER TABLE `selection_container` ADD `code` varchar(255) NOT NULL AFTER `visible`;
-- Generate a pseudo-code for each existing selection
UPDATE `selection` set `code` = CONCAT('selection_', id);
UPDATE `selection_container` set `code` = CONCAT('container_', id);
SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -0,0 +1,111 @@
ALTER TABLE selection_i18n MODIFY description LONGTEXT;
ALTER TABLE selection_i18n MODIFY chapo LONGTEXT;
ALTER TABLE selection_i18n MODIFY postscriptum LONGTEXT;
-- ---------------------------------------------------------------------
-- selection_container
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `selection_container`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`visible` TINYINT NOT NULL,
`position` INTEGER,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`)
) ENGINE = InnoDB;
-- ---------------------------------------------------------------------
-- selection_container_associated_selection
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `selection_container_associated_selection`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`selection_container_id` INTEGER NOT NULL,
`selection_id` INTEGER NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
INDEX `idx_selection_container_associated_selection_container_id`( `selection_container_id`
),
INDEX `idx_selection_container_associated_selection_id` (`selection_id`
),
CONSTRAINT `selection_container_associated_selection_container_id`
FOREIGN KEY (`selection_container_id`
)
REFERENCES `selection_container` (`id`
)
ON UPDATE RESTRICT
ON DELETE CASCADE,
CONSTRAINT `selection_container_associated_selection_selection_id`
FOREIGN KEY (`selection_id`)
REFERENCES `selection` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- selection_container_i18n
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `selection_container_i18n`
(
`id` INTEGER NOT NULL,
`locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL,
`title` VARCHAR(255),
`description` TEXT,
`chapo` TEXT,
`postscriptum` TEXT,
`meta_title` VARCHAR(255),
`meta_description` TEXT,
`meta_keywords` TEXT,
PRIMARY KEY (`id`, `locale`),
CONSTRAINT `selection_container_i18n_FK_1`
FOREIGN KEY (`id`)
REFERENCES `selection_container` (`id`)
ON DELETE CASCADE
) ENGINE = InnoDB;
-- ---------------------------------------------------------------------
-- selection_container_image
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS`selection_container_image`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`selection_container_id` INTEGER NOT NULL,
`file` VARCHAR(255) NOT NULL,
`visible` TINYINT DEFAULT 1 NOT NULL,
`position` INTEGER,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
INDEX `FI_selection_container_image_selection_id` (`selection_container_id`),
CONSTRAINT `fk_selection_container_image_selection_id`
FOREIGN KEY (`selection_container_id`)
REFERENCES `selection_container` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- selection_container_image_i18n
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `selection_container_image_i18n`
(
`id` INTEGER NOT NULL,
`locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL,
`title` VARCHAR(255),
`description` LONGTEXT,
`chapo` TEXT,
`postscriptum` TEXT,
PRIMARY KEY (`id`,`locale`),
CONSTRAINT `selection_container_image_i18n_FK_1`
FOREIGN KEY (`id`)
REFERENCES `selection_container_image` (`id`)
ON DELETE CASCADE
) ENGINE=InnoDB;
# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;