63 lines
6.8 KiB
XML
63 lines
6.8 KiB
XML
<?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="esun_legacy_order" resource="default" engine="innodb" comment="Legacy Orders">
|
|
<column xsi:type="int" name="legacy_order_id" unsigned="true" nullable="false" identity="true" comment="Legacy Order ID"/>
|
|
<column xsi:type="varchar" name="source_code" nullable="false" length="64" comment="Source Code"/>
|
|
<column xsi:type="varchar" name="source_order_number" nullable="false" length="64" comment="Source Order Number"/>
|
|
<column xsi:type="varchar" name="source_order_id" nullable="true" length="64" comment="Source Internal Order ID"/>
|
|
<column xsi:type="int" name="customer_id" unsigned="true" nullable="true" comment="Customer ID"/>
|
|
<column xsi:type="smallint" name="website_id" unsigned="true" nullable="false" comment="Website ID"/>
|
|
<column xsi:type="varchar" name="customer_email" nullable="false" length="255" comment="Customer Email"/>
|
|
<column xsi:type="varchar" name="link_status" nullable="false" length="32" default="unlinked" comment="Customer Link Status"/>
|
|
<column xsi:type="varchar" name="currency" nullable="false" length="3" default="USD" comment="Currency"/>
|
|
<column xsi:type="decimal" name="product_total" precision="20" scale="4" nullable="false" default="0" comment="Product Total"/>
|
|
<column xsi:type="decimal" name="discount_amount" precision="20" scale="4" nullable="false" default="0" comment="Discount"/>
|
|
<column xsi:type="varchar" name="coupon" nullable="true" length="255" comment="Coupon"/>
|
|
<column xsi:type="decimal" name="shipping_amount" precision="20" scale="4" nullable="false" default="0" comment="Shipping"/>
|
|
<column xsi:type="decimal" name="tax_amount" precision="20" scale="4" nullable="false" default="0" comment="Tax"/>
|
|
<column xsi:type="decimal" name="grand_total" precision="20" scale="4" nullable="false" default="0" comment="Grand Total"/>
|
|
<column xsi:type="decimal" name="fee_amount" precision="20" scale="4" nullable="false" default="0" comment="Fee"/>
|
|
<column xsi:type="varchar" name="payment_status" nullable="true" length="64" comment="Payment Status"/>
|
|
<column xsi:type="varchar" name="order_status" nullable="true" length="64" comment="Order Status"/>
|
|
<column xsi:type="varchar" name="shipping_status" nullable="true" length="64" comment="Shipping Status"/>
|
|
<column xsi:type="varchar" name="payment_method" nullable="true" length="128" comment="Payment Method"/>
|
|
<column xsi:type="varchar" name="payment_transaction_id" nullable="true" length="255" comment="Payment Transaction"/>
|
|
<column xsi:type="varchar" name="shipping_method" nullable="true" length="255" comment="Shipping Method"/>
|
|
<column xsi:type="varchar" name="carrier" nullable="true" length="128" comment="Carrier"/>
|
|
<column xsi:type="varchar" name="tracking_number" nullable="true" length="255" comment="Tracking Number"/>
|
|
<column xsi:type="decimal" name="weight" precision="20" scale="4" nullable="false" default="0" comment="Weight"/>
|
|
<column xsi:type="timestamp" name="ordered_at" nullable="true" comment="Order Date"/>
|
|
<column xsi:type="timestamp" name="paid_at" nullable="true" comment="Payment Date"/>
|
|
<column xsi:type="text" name="shipping_address" nullable="true" comment="Shipping Address JSON"/>
|
|
<column xsi:type="text" name="billing_address" nullable="true" comment="Billing Address JSON"/>
|
|
<column xsi:type="text" name="customer_note" nullable="true" comment="Customer Note"/>
|
|
<column xsi:type="text" name="refund_reason" nullable="true" comment="Refund Reason"/>
|
|
<column xsi:type="text" name="cancel_reason" nullable="true" comment="Cancel Reason"/>
|
|
<column xsi:type="text" name="source_data" nullable="true" comment="Source Data JSON"/>
|
|
<column xsi:type="varchar" name="import_batch" nullable="true" length="64" comment="Import Batch"/>
|
|
<column xsi:type="timestamp" name="created_at" nullable="false" default="CURRENT_TIMESTAMP" comment="Created At"/>
|
|
<column xsi:type="timestamp" name="updated_at" nullable="false" default="CURRENT_TIMESTAMP" on_update="true" comment="Updated At"/>
|
|
<constraint xsi:type="primary" referenceId="PRIMARY"><column name="legacy_order_id"/></constraint>
|
|
<constraint xsi:type="unique" referenceId="ESUN_LEGACY_ORDER_SOURCE_NUMBER_UNQ"><column name="source_code"/><column name="source_order_number"/></constraint>
|
|
<constraint xsi:type="foreign" referenceId="ESUN_LEGACY_ORDER_CUSTOMER_FK" table="esun_legacy_order" column="customer_id" referenceTable="customer_entity" referenceColumn="entity_id" onDelete="SET NULL"/>
|
|
<index referenceId="ESUN_LEGACY_ORDER_CUSTOMER_WEBSITE" indexType="btree"><column name="customer_id"/><column name="website_id"/></index>
|
|
<index referenceId="ESUN_LEGACY_ORDER_EMAIL" indexType="btree"><column name="customer_email"/></index>
|
|
<index referenceId="ESUN_LEGACY_ORDER_ORDERED_AT" indexType="btree"><column name="ordered_at"/></index>
|
|
</table>
|
|
<table name="esun_legacy_order_item" resource="default" engine="innodb" comment="Legacy Order Items">
|
|
<column xsi:type="int" name="item_id" unsigned="true" nullable="false" identity="true" comment="Item ID"/>
|
|
<column xsi:type="int" name="legacy_order_id" unsigned="true" nullable="false" comment="Legacy Order ID"/>
|
|
<column xsi:type="int" name="line_number" unsigned="true" nullable="false" comment="Source Line"/>
|
|
<column xsi:type="varchar" name="sku" nullable="false" length="255" comment="SKU"/>
|
|
<column xsi:type="varchar" name="product_name" nullable="true" length="255" comment="Product Name Snapshot"/>
|
|
<column xsi:type="decimal" name="qty" precision="12" scale="4" nullable="false" default="0" comment="Quantity"/>
|
|
<column xsi:type="decimal" name="price" precision="20" scale="4" nullable="false" default="0" comment="Unit Price"/>
|
|
<column xsi:type="decimal" name="row_total" precision="20" scale="4" nullable="false" default="0" comment="Row Total"/>
|
|
<column xsi:type="text" name="source_data" nullable="true" comment="Source Row JSON"/>
|
|
<constraint xsi:type="primary" referenceId="PRIMARY"><column name="item_id"/></constraint>
|
|
<constraint xsi:type="foreign" referenceId="ESUN_LEGACY_ITEM_ORDER_FK" table="esun_legacy_order_item" column="legacy_order_id" referenceTable="esun_legacy_order" referenceColumn="legacy_order_id" onDelete="CASCADE"/>
|
|
<constraint xsi:type="unique" referenceId="ESUN_LEGACY_ITEM_ORDER_LINE_UNQ"><column name="legacy_order_id"/><column name="line_number"/></constraint>
|
|
<index referenceId="ESUN_LEGACY_ITEM_SKU" indexType="btree"><column name="sku"/></index>
|
|
</table>
|
|
</schema>
|