db_schema.xml 17 KB
<?xml version="1.0"?>
<!--
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
    <table name="catalogrule" resource="default" engine="innodb" comment="CatalogRule">
        <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="true"
                comment="Entity ID"/>
        <column xsi:type="varchar" name="name" nullable="true" length="255" comment="Name"/>
        <column xsi:type="text" name="description" nullable="true" comment="Description"/>
        <column xsi:type="date" name="from_date" comment="From"/>
        <column xsi:type="date" name="to_date" comment="To"/>
        <column xsi:type="smallint" name="is_active" padding="6" unsigned="false" nullable="false" identity="false"
                default="0" comment="Is Active"/>
        <column xsi:type="mediumtext" name="conditions_serialized" nullable="true" comment="Conditions Serialized"/>
        <column xsi:type="mediumtext" name="actions_serialized" nullable="true" comment="Actions Serialized"/>
        <column xsi:type="smallint" name="stop_rules_processing" padding="6" unsigned="false" nullable="false"
                identity="false" default="1" comment="Stop Rules Processing"/>
        <column xsi:type="int" name="sort_order" padding="10" unsigned="true" nullable="false" identity="false"
                default="0" comment="Sort Order"/>
        <column xsi:type="varchar" name="simple_action" nullable="true" length="32" comment="Simple Action"/>
        <column xsi:type="decimal" name="discount_amount" scale="4" precision="20" unsigned="false" nullable="false"
                default="0" comment="Discount Amount"/>
        <constraint xsi:type="primary" referenceId="PRIMARY">
            <column name="rule_id"/>
        </constraint>
        <index referenceId="CATALOGRULE_IS_ACTIVE_SORT_ORDER_TO_DATE_FROM_DATE" indexType="btree">
            <column name="is_active"/>
            <column name="sort_order"/>
            <column name="to_date"/>
            <column name="from_date"/>
        </index>
    </table>
    <table name="catalogrule_product" resource="default" engine="innodb" comment="CatalogRule Product">
        <column xsi:type="int" name="rule_product_id" padding="10" unsigned="true" nullable="false" identity="true"
                comment="Rule Product Id"/>
        <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="false" default="0"
                comment="Rule ID"/>
        <column xsi:type="int" name="from_time" padding="10" unsigned="true" nullable="false" identity="false"
                default="0" comment="From Time"/>
        <column xsi:type="int" name="to_time" padding="10" unsigned="true" nullable="false" identity="false" default="0"
                comment="To time"/>
        <column xsi:type="int" name="customer_group_id" padding="11" unsigned="false" nullable="true" identity="false"/>
        <column xsi:type="int" name="product_id" padding="10" unsigned="true" nullable="false" identity="false"
                default="0" comment="Product Id"/>
        <column xsi:type="varchar" name="action_operator" nullable="true" length="10" default="to_fixed"
                comment="Action Operator"/>
        <column xsi:type="decimal" name="action_amount" scale="4" precision="20" unsigned="false" nullable="false"
                default="0" comment="Action Amount"/>
        <column xsi:type="smallint" name="action_stop" padding="6" unsigned="false" nullable="false" identity="false"
                default="0" comment="Action Stop"/>
        <column xsi:type="int" name="sort_order" padding="10" unsigned="true" nullable="false" identity="false"
                default="0" comment="Sort Order"/>
        <column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false"
                comment="Website Id"/>
        <constraint xsi:type="primary" referenceId="PRIMARY">
            <column name="rule_product_id"/>
        </constraint>
        <constraint xsi:type="unique" referenceId="UNQ_EAA51B56FF092A0DCB795D1CEF812B7B">
            <column name="rule_id"/>
            <column name="from_time"/>
            <column name="to_time"/>
            <column name="website_id"/>
            <column name="customer_group_id"/>
            <column name="product_id"/>
            <column name="sort_order"/>
        </constraint>
        <index referenceId="CATALOGRULE_PRODUCT_CUSTOMER_GROUP_ID" indexType="btree">
            <column name="customer_group_id"/>
        </index>
        <index referenceId="CATALOGRULE_PRODUCT_WEBSITE_ID" indexType="btree">
            <column name="website_id"/>
        </index>
        <index referenceId="CATALOGRULE_PRODUCT_FROM_TIME" indexType="btree">
            <column name="from_time"/>
        </index>
        <index referenceId="CATALOGRULE_PRODUCT_TO_TIME" indexType="btree">
            <column name="to_time"/>
        </index>
        <index referenceId="CATALOGRULE_PRODUCT_PRODUCT_ID" indexType="btree">
            <column name="product_id"/>
        </index>
    </table>
    <table name="catalogrule_product_price" resource="default" engine="innodb" comment="CatalogRule Product Price">
        <column xsi:type="int" name="rule_product_price_id" padding="10" unsigned="true" nullable="false"
                identity="true" comment="Rule Product PriceId"/>
        <column xsi:type="date" name="rule_date" nullable="false" comment="Rule Date"/>
        <column xsi:type="int" name="customer_group_id" padding="11" unsigned="false" nullable="true" identity="false"/>
        <column xsi:type="int" name="product_id" padding="10" unsigned="true" nullable="false" identity="false"
                default="0" comment="Product Id"/>
        <column xsi:type="decimal" name="rule_price" scale="4" precision="12" unsigned="false" nullable="false"
                default="0" comment="Rule Price"/>
        <column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false"
                comment="Website Id"/>
        <column xsi:type="date" name="latest_start_date" comment="Latest StartDate"/>
        <column xsi:type="date" name="earliest_end_date" comment="Earliest EndDate"/>
        <constraint xsi:type="primary" referenceId="PRIMARY">
            <column name="rule_product_price_id"/>
        </constraint>
        <constraint xsi:type="unique" referenceId="CATRULE_PRD_PRICE_RULE_DATE_WS_ID_CSTR_GROUP_ID_PRD_ID">
            <column name="rule_date"/>
            <column name="website_id"/>
            <column name="customer_group_id"/>
            <column name="product_id"/>
        </constraint>
        <index referenceId="CATALOGRULE_PRODUCT_PRICE_CUSTOMER_GROUP_ID" indexType="btree">
            <column name="customer_group_id"/>
        </index>
        <index referenceId="CATALOGRULE_PRODUCT_PRICE_WEBSITE_ID" indexType="btree">
            <column name="website_id"/>
        </index>
        <index referenceId="CATALOGRULE_PRODUCT_PRICE_PRODUCT_ID" indexType="btree">
            <column name="product_id"/>
        </index>
    </table>
    <table name="catalogrule_group_website" resource="default" engine="innodb" comment="CatalogRule Group Website">
        <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="false" default="0"
                comment="Rule ID"/>
        <column xsi:type="int" name="customer_group_id" padding="10" unsigned="true" nullable="false" identity="false"
                default="0" comment="Customer Group Id"/>
        <column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false"
                default="0" comment="Website Id"/>
        <constraint xsi:type="primary" referenceId="PRIMARY">
            <column name="rule_id"/>
            <column name="customer_group_id"/>
            <column name="website_id"/>
        </constraint>
        <index referenceId="CATALOGRULE_GROUP_WEBSITE_CUSTOMER_GROUP_ID" indexType="btree">
            <column name="customer_group_id"/>
        </index>
        <index referenceId="CATALOGRULE_GROUP_WEBSITE_WEBSITE_ID" indexType="btree">
            <column name="website_id"/>
        </index>
    </table>
    <table name="catalogrule_website" resource="default" engine="innodb" comment="Catalog Rules To Websites Relations">
        <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="false"
                comment="Rule ID"/>
        <column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false"
                comment="Website Id"/>
        <constraint xsi:type="primary" referenceId="PRIMARY">
            <column name="rule_id"/>
            <column name="website_id"/>
        </constraint>
        <constraint xsi:type="foreign" referenceId="CATALOGRULE_WEBSITE_RULE_ID_CATALOGRULE_RULE_ID"
                    table="catalogrule_website" column="rule_id" referenceTable="catalogrule" referenceColumn="rule_id"
                    onDelete="CASCADE"/>
        <constraint xsi:type="foreign" referenceId="CATALOGRULE_WEBSITE_WEBSITE_ID_STORE_WEBSITE_WEBSITE_ID"
                    table="catalogrule_website" column="website_id" referenceTable="store_website"
                    referenceColumn="website_id" onDelete="CASCADE"/>
        <index referenceId="CATALOGRULE_WEBSITE_WEBSITE_ID" indexType="btree">
            <column name="website_id"/>
        </index>
    </table>
    <table name="catalogrule_customer_group" resource="default" engine="innodb"
           comment="Catalog Rules To Customer Groups Relations">
        <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="false"
                comment="Rule ID"/>
        <column xsi:type="int" name="customer_group_id" padding="10" unsigned="true" nullable="false" identity="false"
                comment="Customer Group Id"/>
        <constraint xsi:type="primary" referenceId="PRIMARY">
            <column name="rule_id"/>
            <column name="customer_group_id"/>
        </constraint>
        <constraint xsi:type="foreign" referenceId="CATALOGRULE_CUSTOMER_GROUP_RULE_ID_CATALOGRULE_RULE_ID"
                    table="catalogrule_customer_group" column="rule_id" referenceTable="catalogrule"
                    referenceColumn="rule_id" onDelete="CASCADE"/>
        <constraint xsi:type="foreign" referenceId="CATRULE_CSTR_GROUP_CSTR_GROUP_ID_CSTR_GROUP_CSTR_GROUP_ID"
                    table="catalogrule_customer_group" column="customer_group_id" referenceTable="customer_group"
                    referenceColumn="customer_group_id" onDelete="CASCADE"/>
        <index referenceId="CATALOGRULE_CUSTOMER_GROUP_CUSTOMER_GROUP_ID" indexType="btree">
            <column name="customer_group_id"/>
        </index>
    </table>
    <table name="catalogrule_product_replica" resource="default" engine="innodb" comment="CatalogRule Product">
        <column xsi:type="int" name="rule_product_id" padding="10" unsigned="true" nullable="false" identity="true"
                comment="Rule Product Id"/>
        <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="false" default="0"
                comment="Rule ID"/>
        <column xsi:type="int" name="from_time" padding="10" unsigned="true" nullable="false" identity="false"
                default="0" comment="From Time"/>
        <column xsi:type="int" name="to_time" padding="10" unsigned="true" nullable="false" identity="false" default="0"
                comment="To time"/>
        <column xsi:type="int" name="customer_group_id" padding="11" unsigned="false" nullable="true" identity="false"/>
        <column xsi:type="int" name="product_id" padding="10" unsigned="true" nullable="false" identity="false"
                default="0" comment="Product Id"/>
        <column xsi:type="varchar" name="action_operator" nullable="true" default="to_fixed" length="10"
                comment="Action Operator"/>
        <column xsi:type="decimal" name="action_amount" scale="4" precision="12" unsigned="false" nullable="false"
                default="0" comment="Action Amount"/>
        <column xsi:type="smallint" name="action_stop" padding="6" unsigned="false" nullable="false" identity="false"
                default="0" comment="Action Stop"/>
        <column xsi:type="int" name="sort_order" padding="10" unsigned="true" nullable="false" identity="false"
                default="0" comment="Sort Order"/>
        <column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false"
                comment="Website Id"/>
        <constraint xsi:type="primary" referenceId="PRIMARY">
            <column name="rule_product_id"/>
        </constraint>
        <constraint xsi:type="unique" referenceId="UNQ_EAA51B56FF092A0DCB795D1CEF812B7B">
            <column name="rule_id"/>
            <column name="from_time"/>
            <column name="to_time"/>
            <column name="website_id"/>
            <column name="customer_group_id"/>
            <column name="product_id"/>
            <column name="sort_order"/>
        </constraint>
        <index referenceId="CATALOGRULE_PRODUCT_CUSTOMER_GROUP_ID" indexType="btree">
            <column name="customer_group_id"/>
        </index>
        <index referenceId="CATALOGRULE_PRODUCT_WEBSITE_ID" indexType="btree">
            <column name="website_id"/>
        </index>
        <index referenceId="CATALOGRULE_PRODUCT_FROM_TIME" indexType="btree">
            <column name="from_time"/>
        </index>
        <index referenceId="CATALOGRULE_PRODUCT_TO_TIME" indexType="btree">
            <column name="to_time"/>
        </index>
        <index referenceId="CATALOGRULE_PRODUCT_PRODUCT_ID" indexType="btree">
            <column name="product_id"/>
        </index>
    </table>
    <table name="catalogrule_product_price_replica" resource="default" engine="innodb"
           comment="CatalogRule Product Price">
        <column xsi:type="int" name="rule_product_price_id" padding="10" unsigned="true" nullable="false"
                identity="true" comment="Rule Product PriceId"/>
        <column xsi:type="date" name="rule_date" nullable="false" comment="Rule Date"/>
        <column xsi:type="int" name="customer_group_id" padding="11" unsigned="false" nullable="true" identity="false"/>
        <column xsi:type="int" name="product_id" padding="10" unsigned="true" nullable="false" identity="false"
                default="0" comment="Product Id"/>
        <column xsi:type="decimal" name="rule_price" scale="4" precision="12" unsigned="false" nullable="false"
                default="0" comment="Rule Price"/>
        <column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false"
                comment="Website Id"/>
        <column xsi:type="date" name="latest_start_date" comment="Latest StartDate"/>
        <column xsi:type="date" name="earliest_end_date" comment="Earliest EndDate"/>
        <constraint xsi:type="primary" referenceId="PRIMARY">
            <column name="rule_product_price_id"/>
        </constraint>
        <constraint xsi:type="unique" referenceId="CATRULE_PRD_PRICE_RULE_DATE_WS_ID_CSTR_GROUP_ID_PRD_ID">
            <column name="rule_date"/>
            <column name="website_id"/>
            <column name="customer_group_id"/>
            <column name="product_id"/>
        </constraint>
        <index referenceId="CATALOGRULE_PRODUCT_PRICE_CUSTOMER_GROUP_ID" indexType="btree">
            <column name="customer_group_id"/>
        </index>
        <index referenceId="CATALOGRULE_PRODUCT_PRICE_WEBSITE_ID" indexType="btree">
            <column name="website_id"/>
        </index>
        <index referenceId="CATALOGRULE_PRODUCT_PRICE_PRODUCT_ID" indexType="btree">
            <column name="product_id"/>
        </index>
    </table>
    <table name="catalogrule_group_website_replica" resource="default" engine="innodb"
           comment="CatalogRule Group Website">
        <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="false" default="0"
                comment="Rule ID"/>
        <column xsi:type="int" name="customer_group_id" padding="10" unsigned="true" nullable="false" identity="false"
                default="0" comment="Customer Group Id"/>
        <column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false"
                default="0" comment="Website Id"/>
        <constraint xsi:type="primary" referenceId="PRIMARY">
            <column name="rule_id"/>
            <column name="customer_group_id"/>
            <column name="website_id"/>
        </constraint>
        <index referenceId="CATALOGRULE_GROUP_WEBSITE_CUSTOMER_GROUP_ID" indexType="btree">
            <column name="customer_group_id"/>
        </index>
        <index referenceId="CATALOGRULE_GROUP_WEBSITE_WEBSITE_ID" indexType="btree">
            <column name="website_id"/>
        </index>
    </table>
</schema>