<?xml version="1.0"?>
<!--
/**
 * @author Amasty Team
 * @copyright Copyright (c) Amasty (https://www.amasty.com)
 * @package One Step Checkout Delivery Date for Magento 2 (System)
 */-->
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
  <table name="amasty_amcheckout_delivery" resource="default" engine="innodb" comment="Amasty Checkout Delivery Table">
    <column xsi:type="int" name="id" padding="10" unsigned="true" nullable="false" identity="true" comment="Entity ID"/>
    <column xsi:type="int" name="order_id" padding="10" unsigned="true" nullable="true" identity="false" comment="Order Id"/>
    <column xsi:type="int" name="quote_id" padding="10" unsigned="true" nullable="true" identity="false" comment="Quote Id"/>
    <column xsi:type="date" name="date" comment="Delivery Date"/>
    <column xsi:type="smallint" name="time" padding="6" unsigned="false" nullable="true" identity="false" comment="Delivery Time"/>
    <column xsi:type="text" name="comment" nullable="true" comment="Delivery Comment"/>
    <constraint xsi:type="primary" referenceId="PRIMARY">
      <column name="id"/>
    </constraint>
    <constraint xsi:type="foreign" referenceId="AMASTY_AMCHECKOUT_DELIVERY_ORDER_ID_SALES_ORDER_ENTITY_ID" table="amasty_amcheckout_delivery" column="order_id" referenceTable="sales_order" referenceColumn="entity_id" onDelete="CASCADE"/>
    <constraint xsi:type="foreign" referenceId="AMASTY_AMCHECKOUT_DELIVERY_QUOTE_ID_QUOTE_ENTITY_ID" table="amasty_amcheckout_delivery" column="quote_id" referenceTable="quote" referenceColumn="entity_id" onDelete="SET NULL"/>
  </table>
</schema>
