Files
2026-09-15 10:35:56 +08:00

133 lines
14 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_lingxing_store" resource="default" engine="innodb" comment="Lingxing ERP Stores">
<column xsi:type="int" name="entity_id" unsigned="true" nullable="false" identity="true" comment="Entity ID"/>
<column xsi:type="int" name="platform_code" unsigned="true" nullable="false" comment="Lingxing Platform Code"/>
<column xsi:type="varchar" name="platform_name" nullable="false" length="100" default="" comment="Platform Name"/>
<column xsi:type="varchar" name="store_id" nullable="false" length="100" comment="Lingxing Store ID"/>
<column xsi:type="varchar" name="sid" nullable="false" length="100" default="" comment="Lingxing Seller ID"/>
<column xsi:type="varchar" name="store_name" nullable="false" length="255" default="" comment="Lingxing Store Name"/>
<column xsi:type="varchar" name="currency" nullable="false" length="16" default="" comment="Store Currency"/>
<column xsi:type="smallint" name="is_sync" unsigned="true" nullable="false" default="0" comment="Store Sync Enabled"/>
<column xsi:type="smallint" name="status" unsigned="true" nullable="false" default="0" comment="Authorization Status"/>
<column xsi:type="timestamp" name="last_synced_at" nullable="false" on_update="false" comment="Last Synchronized At"/>
<column xsi:type="timestamp" name="created_at" nullable="false" default="CURRENT_TIMESTAMP" on_update="false" 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="entity_id"/></constraint>
<constraint xsi:type="unique" referenceId="ESUN_LINGXING_STORE_STORE_ID"><column name="store_id"/></constraint>
<index referenceId="ESUN_LINGXING_STORE_PLATFORM" indexType="btree"><column name="platform_code"/></index>
<index referenceId="ESUN_LINGXING_STORE_ACTIVE" indexType="btree"><column name="is_sync"/><column name="status"/></index>
</table>
<table name="esun_lingxing_warehouse" resource="default" engine="innodb" comment="Lingxing ERP Warehouses">
<column xsi:type="int" name="entity_id" unsigned="true" nullable="false" identity="true" comment="Entity ID"/>
<column xsi:type="bigint" name="wid" unsigned="true" nullable="false" comment="Lingxing Warehouse ID"/>
<column xsi:type="varchar" name="source_code" nullable="true" length="64" comment="Mapped Magento Inventory Source Code"/>
<column xsi:type="varchar" name="warehouse_name" nullable="false" length="255" comment="Lingxing Warehouse Name"/>
<column xsi:type="smallint" name="warehouse_type" unsigned="true" nullable="false" comment="Lingxing Warehouse Type"/>
<column xsi:type="varchar" name="country_code" nullable="true" length="8" comment="Country Code"/>
<column xsi:type="varchar" name="third_party_code" nullable="true" length="100" comment="Third-party Warehouse Code"/>
<column xsi:type="varchar" name="third_party_name" nullable="true" length="255" comment="Third-party Warehouse Name"/>
<column xsi:type="smallint" name="lingxing_status" unsigned="true" nullable="false" default="1" comment="Lingxing Enabled Status"/>
<column xsi:type="smallint" name="is_deleted" unsigned="true" nullable="false" default="0" comment="Lingxing Deleted Status"/>
<column xsi:type="timestamp" name="last_synced_at" nullable="true" on_update="false" comment="Last Warehouse Synchronization At"/>
<column xsi:type="timestamp" name="last_inventory_synced_at" nullable="true" on_update="false" comment="Last Inventory Synchronization At"/>
<column xsi:type="timestamp" name="created_at" nullable="false" default="CURRENT_TIMESTAMP" on_update="false" 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="entity_id"/></constraint>
<constraint xsi:type="unique" referenceId="ESUN_LINGXING_WAREHOUSE_WID"><column name="wid"/></constraint>
<constraint xsi:type="unique" referenceId="ESUN_LINGXING_WAREHOUSE_SOURCE"><column name="source_code"/></constraint>
<index referenceId="ESUN_LINGXING_WAREHOUSE_STATUS" indexType="btree"><column name="lingxing_status"/><column name="is_deleted"/></index>
</table>
<table name="esun_lingxing_order_sync" resource="default" engine="innodb" comment="Lingxing Order Synchronization">
<column xsi:type="int" name="entity_id" unsigned="true" nullable="false" identity="true" comment="Entity ID"/>
<column xsi:type="int" name="order_id" unsigned="true" nullable="false" comment="Magento Order ID"/>
<column xsi:type="varchar" name="increment_id" nullable="false" length="50" comment="Magento Order Number"/>
<column xsi:type="varchar" name="platform_order_no" nullable="false" length="100" comment="Lingxing Platform Order Number"/>
<column xsi:type="varchar" name="global_order_no" nullable="true" length="100" comment="Lingxing Global Order Number"/>
<column xsi:type="varchar" name="status" nullable="false" length="20" default="pending" comment="Sync Status"/>
<column xsi:type="int" name="attempt_count" unsigned="true" nullable="false" default="0" comment="Attempt Count"/>
<column xsi:type="timestamp" name="next_retry_at" nullable="true" on_update="false" comment="Next Retry At"/>
<column xsi:type="varchar" name="last_error_code" nullable="true" length="64" comment="Last Error Code"/>
<column xsi:type="text" name="last_error_message" nullable="true" comment="Last Error Message"/>
<column xsi:type="varchar" name="request_id" nullable="true" length="128" comment="Lingxing Request ID"/>
<column xsi:type="varchar" name="payload_hash" nullable="true" length="64" comment="Payload SHA256"/>
<column xsi:type="timestamp" name="last_attempt_at" nullable="true" on_update="false" comment="Last Attempt At"/>
<column xsi:type="timestamp" name="synced_at" nullable="true" on_update="false" comment="Synchronized At"/>
<column xsi:type="varchar" name="cancel_status" nullable="true" length="20" comment="Cancellation Sync Status"/>
<column xsi:type="varchar" name="cancel_source" nullable="true" length="24" comment="Magento Cancellation Source"/>
<column xsi:type="int" name="cancel_attempt_count" unsigned="true" nullable="false" default="0" comment="Cancellation Attempt Count"/>
<column xsi:type="timestamp" name="cancel_next_retry_at" nullable="true" on_update="false" comment="Cancellation Next Retry At"/>
<column xsi:type="varchar" name="cancel_error_code" nullable="true" length="64" comment="Cancellation Error Code"/>
<column xsi:type="text" name="cancel_error_message" nullable="true" comment="Cancellation Error Message"/>
<column xsi:type="varchar" name="cancel_request_id" nullable="true" length="128" comment="Cancellation Request ID"/>
<column xsi:type="timestamp" name="cancel_requested_at" nullable="true" on_update="false" comment="Cancellation Requested At"/>
<column xsi:type="timestamp" name="cancel_synced_at" nullable="true" on_update="false" comment="Cancellation Synchronized At"/>
<column xsi:type="timestamp" name="created_at" nullable="false" default="CURRENT_TIMESTAMP" on_update="false" 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="entity_id"/></constraint>
<constraint xsi:type="unique" referenceId="ESUN_LINGXING_ORDER_SYNC_ORDER_ID"><column name="order_id"/></constraint>
<constraint xsi:type="unique" referenceId="ESUN_LINGXING_ORDER_SYNC_PLATFORM_NO"><column name="platform_order_no"/></constraint>
<index referenceId="ESUN_LINGXING_ORDER_SYNC_GLOBAL_NO" indexType="btree"><column name="global_order_no"/></index>
<index referenceId="ESUN_LINGXING_ORDER_SYNC_STATUS_RETRY" indexType="btree"><column name="status"/><column name="next_retry_at"/></index>
<index referenceId="ESUN_LINGXING_ORDER_CANCEL_STATUS_RETRY" indexType="btree"><column name="cancel_status"/><column name="cancel_next_retry_at"/></index>
</table>
<table name="esun_lingxing_shipment_sync" resource="default" engine="innodb" comment="Lingxing Shipment Synchronization">
<column xsi:type="int" name="entity_id" unsigned="true" nullable="false" identity="true" comment="Entity ID"/>
<column xsi:type="varchar" name="external_key" nullable="false" length="191" comment="Idempotency Key"/>
<column xsi:type="int" name="order_id" unsigned="true" nullable="true" comment="Magento Order ID"/>
<column xsi:type="varchar" name="increment_id" nullable="true" length="50" comment="Magento Order Number"/>
<column xsi:type="varchar" name="global_order_no" nullable="true" length="100" comment="Lingxing Global Order Number"/>
<column xsi:type="bigint" name="wo_id" unsigned="true" nullable="true" comment="Lingxing Outbound ID"/>
<column xsi:type="varchar" name="wo_number" nullable="false" length="100" comment="Lingxing Outbound Number"/>
<column xsi:type="varchar" name="package_no" nullable="true" length="100" comment="Lingxing Package Number"/>
<column xsi:type="varchar" name="tracking_no" nullable="true" length="255" comment="Tracking Numbers"/>
<column xsi:type="int" name="shipment_id" unsigned="true" nullable="true" comment="Magento Shipment ID"/>
<column xsi:type="varchar" name="status" nullable="false" length="20" default="pending" comment="Sync Status"/>
<column xsi:type="int" name="attempt_count" unsigned="true" nullable="false" default="0" comment="Attempt Count"/>
<column xsi:type="timestamp" name="next_retry_at" nullable="true" on_update="false" comment="Next Retry At"/>
<column xsi:type="varchar" name="last_error_code" nullable="true" length="64" comment="Last Error Code"/>
<column xsi:type="text" name="last_error_message" nullable="true" comment="Last Error Message"/>
<column xsi:type="varchar" name="request_id" nullable="true" length="128" comment="Lingxing Request ID"/>
<column xsi:type="mediumtext" name="payload_json" nullable="false" comment="Normalized Fulfillment Payload"/>
<column xsi:type="timestamp" name="last_attempt_at" nullable="true" on_update="false" comment="Last Attempt At"/>
<column xsi:type="timestamp" name="synced_at" nullable="true" on_update="false" comment="Synchronized At"/>
<column xsi:type="timestamp" name="created_at" nullable="false" default="CURRENT_TIMESTAMP" on_update="false" 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="entity_id"/></constraint>
<constraint xsi:type="unique" referenceId="ESUN_LINGXING_SHIPMENT_EXTERNAL_KEY"><column name="external_key"/></constraint>
<index referenceId="ESUN_LINGXING_SHIPMENT_WO_NUMBER" indexType="btree"><column name="wo_number"/></index>
<index referenceId="ESUN_LINGXING_SHIPMENT_ORDER_ID" indexType="btree"><column name="order_id"/></index>
<index referenceId="ESUN_LINGXING_SHIPMENT_STATUS_RETRY" indexType="btree"><column name="status"/><column name="next_retry_at"/></index>
</table>
<table name="esun_lingxing_sync_log" resource="default" engine="innodb" comment="Lingxing Synchronization Attempts">
<column xsi:type="bigint" name="entity_id" unsigned="true" nullable="false" identity="true" comment="Entity ID"/>
<column xsi:type="varchar" name="direction" nullable="false" length="10" comment="Push or Pull"/>
<column xsi:type="varchar" name="operation" nullable="false" length="40" comment="Operation"/>
<column xsi:type="varchar" name="api_path" nullable="true" length="255" comment="Lingxing API Endpoint"/>
<column xsi:type="varchar" name="entity_type" nullable="false" length="20" comment="Entity Type"/>
<column xsi:type="int" name="local_entity_id" unsigned="true" nullable="true" comment="Local Sync Entity ID"/>
<column xsi:type="varchar" name="increment_id" nullable="true" length="50" comment="Magento Order Number"/>
<column xsi:type="varchar" name="external_id" nullable="true" length="191" comment="Lingxing External ID"/>
<column xsi:type="varchar" name="status" nullable="false" length="20" comment="Attempt Status"/>
<column xsi:type="int" name="attempt_number" unsigned="true" nullable="false" default="1" comment="Attempt Number"/>
<column xsi:type="varchar" name="error_code" nullable="true" length="64" comment="Error Code"/>
<column xsi:type="text" name="error_message" nullable="true" comment="Error Message"/>
<column xsi:type="varchar" name="request_id" nullable="true" length="128" comment="Lingxing Request ID"/>
<column xsi:type="mediumtext" name="request_payload" nullable="true" comment="Sanitized Request Payload"/>
<column xsi:type="mediumtext" name="response_payload" nullable="true" comment="Sanitized Response Payload"/>
<column xsi:type="int" name="duration_ms" unsigned="true" nullable="true" comment="Duration Milliseconds"/>
<column xsi:type="timestamp" name="created_at" nullable="false" default="CURRENT_TIMESTAMP" on_update="false" comment="Created At"/>
<constraint xsi:type="primary" referenceId="PRIMARY"><column name="entity_id"/></constraint>
<index referenceId="ESUN_LINGXING_LOG_STATUS_CREATED" indexType="btree"><column name="status"/><column name="created_at"/></index>
<index referenceId="ESUN_LINGXING_LOG_API_PATH" indexType="btree"><column name="api_path"/></index>
<index referenceId="ESUN_LINGXING_LOG_ORDER" indexType="btree"><column name="increment_id"/></index>
<index referenceId="ESUN_LINGXING_LOG_EXTERNAL" indexType="btree"><column name="external_id"/></index>
<index referenceId="ESUN_LINGXING_LOG_REQUEST_ID" indexType="btree"><column name="request_id"/></index>
</table>
</schema>