<?xml version="1.0"?>
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
    <table name="consumer_promo" resource="default" engine="innodb" comment="">
        <column xsi:type="int" name="entity_id" unsigned="true" nullable="false" identity="true"/>
        <column xsi:type="int" name="rule_id" unsigned="true"/>
        <column xsi:type="int" name="customer_id" unsigned="true"  nullable="true" identity="false"/>
        <column xsi:type="varchar" name="customer_email"  nullable="true" />
        <column xsi:type="varchar" name="coupon_code" nullable="false"/>
        <column xsi:type="timestamp" name="created_at" on_update="false" nullable="false" default="CURRENT_TIMESTAMP" comment="Created At"/>
        <column xsi:type="timestamp" name="updated_at" on_update="true" nullable="false" default="CURRENT_TIMESTAMP" comment="Updated At"/>
        <constraint xsi:type="primary" referenceId="PRIMARY">
            <column name="entity_id"/>
        </constraint>
        <constraint xsi:type="foreign" referenceId="SALESRULE_RULE_ID_CONSUMER_PROMO_RULE_ID" table="consumer_promo"
                    column="rule_id" referenceTable="salesrule" referenceColumn="rule_id" onDelete="CASCADE"/>
        <index referenceId="CONSUMER_PROMO_ENTITY_ID" indexType="btree">
            <column name="entity_id"/>
        </index>
    </table>
    <table name="sales_order" resource="default" engine="innodb" comment="">
        <column xsi:type="int" name="order_accepted" unsigned="true"/>
    </table>
    <table name="sales_order_grid" resource="default" engine="innodb" comment="">
        <column xsi:type="int" name="order_accepted" unsigned="true"/>
    </table>
</schema>
