<?xml version="1.0"?>
<!--
/**
 * @author Amasty Team
 * @copyright Copyright (c) Amasty (https://www.amasty.com)
 * @package Export Orders for Magento 2
 */-->
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
  <table name="amasty_order_export_profile" resource="default" engine="innodb" comment="amasty_order_export_profile">
    <column xsi:type="int" name="id" padding="10" unsigned="true" nullable="false" identity="true" comment="Id"/>
    <column xsi:type="varchar" name="name" nullable="false" length="127" comment="Name"/>
    <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"/>
    <column xsi:type="datetime" name="exported_at" on_update="false" nullable="false" comment="Exported_at"/>
    <column xsi:type="longblob" name="serialized_config" nullable="false" comment="Serialized_config"/>
    <column xsi:type="varchar" name="file_format" nullable="false" length="255" comment="File_format"/>
    <column xsi:type="varchar" name="execution_type" nullable="false" length="255" comment="Execution_type"/>
    <column xsi:type="text" name="order_actions" nullable="false" comment="Order_actions"/>
    <constraint xsi:type="primary" referenceId="PRIMARY">
      <column name="id"/>
    </constraint>
  </table>
  <table name="amasty_order_export_profile_event" resource="default" engine="innodb" comment="amasty_order_export_profile_event">
    <column xsi:type="int" name="id" padding="10" unsigned="true" nullable="false" identity="true" comment="Id"/>
    <column xsi:type="int" name="profile_id" padding="10" unsigned="true" nullable="false" identity="false" comment="Profile_id"/>
    <column xsi:type="int" name="event_name" padding="10" unsigned="true" nullable="false" identity="false" comment="Event_name"/>
    <constraint xsi:type="primary" referenceId="PRIMARY">
      <column name="id"/>
    </constraint>
    <constraint xsi:type="foreign" referenceId="FK_88932886B3DF661E738F68A765891B3E" table="amasty_order_export_profile_event" column="profile_id" referenceTable="amasty_order_export_profile" referenceColumn="id" onDelete="CASCADE"/>
    <constraint xsi:type="unique" referenceId="AMASTY_ORDER_EXPORT_PROFILE_EVENT_PROFILE_ID_EVENT_NAME">
      <column name="profile_id"/>
      <column name="event_name"/>
    </constraint>
    <index referenceId="AMASTY_ORDER_EXPORT_PROFILE_EVENT_PROFILE_ID" indexType="btree">
      <column name="profile_id"/>
    </index>
  </table>
</schema>
