Files
baiyue-firstleg/firstleg/src/main/resources/db/phase3-direct-delivery-schema.sql
T

20 lines
1.2 KiB
SQL

-- Current schema for actual destination unloading; never an overseas warehouse receipt.
CREATE TABLE IF NOT EXISTS fl_direct_delivery_unloading (
container_booking_id BIGINT UNSIGNED NOT NULL,
inbound_id BIGINT UNSIGNED NOT NULL COMMENT 'Immutable physically loaded inbound source',
actual_at DATETIME(3) NOT NULL COMMENT 'Actual destination local time',
timezone VARCHAR(64) NOT NULL COMMENT 'Explicit destination IANA timezone',
received_by VARCHAR(128) NOT NULL COMMENT 'Actual recipient',
evidence_no VARCHAR(128) NOT NULL COMMENT 'Actual delivery receipt reference',
remark VARCHAR(1000) NULL,
version INT NOT NULL DEFAULT 1,
idempotency_key VARCHAR(128) NOT NULL,
request_hash CHAR(64) NOT NULL,
created_by BIGINT UNSIGNED NOT NULL,
created_by_name VARCHAR(64) NULL,
created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
PRIMARY KEY (container_booking_id,inbound_id),
UNIQUE KEY uk_direct_unloading_command (container_booking_id,idempotency_key),
CONSTRAINT fk_direct_unloading_container FOREIGN KEY (container_booking_id) REFERENCES fl_container_booking(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='直送目的仓真实卸货凭据';