<?xml version="1.0"?>
<!--
/**
 * @author Amasty Team
 * @copyright Copyright (c) Amasty (https://www.amasty.com)
 * @package Export Pro 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_export_cron_job" resource="default" engine="innodb" comment="amasty_export_cron_job">
        <column xsi:type="int" name="job_id" padding="10" unsigned="true" nullable="false" identity="true" comment="Job_id"/>
        <column xsi:type="varchar" name="title" nullable="false" length="127" comment="Title"/>
        <column xsi:type="varchar" name="entity_code" nullable="false" length="127" comment="Entity_code"/>
        <column xsi:type="smallint" name="indexed_status" padding="6" unsigned="false" nullable="false" identity="false" comment="Indexed_status"/>
        <column xsi:type="longblob" name="config" nullable="true" comment="Config"/>
        <constraint xsi:type="primary" referenceId="PRIMARY">
            <column name="job_id"/>
        </constraint>
        <constraint xsi:type="unique" referenceId="AMASTY_EXPORT_CRON_JOB_JOB_ID">
            <column name="job_id"/>
        </constraint>
    </table>
    <table name="amasty_export_history" resource="default" engine="innodb" comment="amasty_export_history">
        <column xsi:type="int" name="history_id" padding="10" unsigned="true" nullable="false" identity="true" comment="History_id"/>
        <column xsi:type="varchar" name="type" nullable="true" length="127" comment="Type"/>
        <column xsi:type="int" name="job_id" padding="11" unsigned="false" nullable="true" identity="false" comment="Job_id"/>
        <column xsi:type="varchar" name="name" nullable="true" length="255" comment="Name"/>
        <column xsi:type="varchar" name="entity_code" nullable="false" length="127" comment="Entity_code"/>
        <column xsi:type="timestamp" name="exported_at" on_update="false" nullable="false" default="CURRENT_TIMESTAMP" comment="Exported_at"/>
        <column xsi:type="timestamp" name="finished_at" on_update="false" nullable="true" comment="Finished_at"/>
        <column xsi:type="varchar" name="identity" nullable="false" length="127" comment="Identity"/>
        <column xsi:type="varchar" name="status" nullable="false" length="127" default="0" comment="Status"/>
        <column xsi:type="text" name="log" nullable="false" comment="Log"/>
        <column xsi:type="boolean" name="is_deleted_file" nullable="false" comment="Is_deleted_file"/>
        <constraint xsi:type="primary" referenceId="PRIMARY">
            <column name="history_id"/>
        </constraint>
    </table>
    <table name="amasty_export_last_exported_id" resource="default" engine="innodb" comment="amasty_export_last_exported_id">
        <column xsi:type="int" name="id" padding="10" unsigned="true" nullable="false" identity="true" comment="Id"/>
        <column xsi:type="varchar" name="type" nullable="false" length="127" comment="Type"/>
        <column xsi:type="int" name="external_id" padding="11" unsigned="false" nullable="false" identity="false" comment="External_id"/>
        <column xsi:type="int" name="last_exported_id" padding="11" unsigned="false" nullable="false" identity="false" comment="Last_exported_id"/>
        <constraint xsi:type="primary" referenceId="PRIMARY">
            <column name="id"/>
        </constraint>
        <constraint xsi:type="unique" referenceId="AMASTY_EXPORT_LAST_EXPORTED_ID_ID">
            <column name="id"/>
        </constraint>
    </table>
    <table name="amasty_export_connection" resource="default" engine="innodb" comment="amasty_order_export_connection">
        <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="varchar" name="export_type" nullable="false" length="127" comment="Export Type"/>
        <column xsi:type="varchar" name="table_to_join" nullable="false" length="127" comment="Table To Join"/>
        <column xsi:type="varchar" name="parent_entity" nullable="false" length="127" comment="Parent Entity"/>
        <column xsi:type="varchar" name="entity_code" nullable="false" length="127" comment="Entity Code"/>
        <column xsi:type="varchar" name="base_table_key" nullable="false" length="127" comment="Base Table Key"/>
        <column xsi:type="varchar" name="referenced_table_key" nullable="false" length="127" comment="Referenced Table Key"/>
        <constraint xsi:type="primary" referenceId="PRIMARY">
            <column name="id"/>
        </constraint>
    </table>
</schema>
