u
This commit is contained in:
@@ -899,6 +899,38 @@ CREATE INDEX IF NOT EXISTS IX_quotesummary_company_number
|
||||
ON quotesummary (company_id, quote_number);
|
||||
`;
|
||||
|
||||
export const INIT_SHIPMENTSUMMARY = `
|
||||
CREATE TABLE IF NOT EXISTS shipmentsummary (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
company_id INTEGER NOT NULL,
|
||||
manifest_id INTEGER NOT NULL UNIQUE,
|
||||
shipment_number TEXT NOT NULL,
|
||||
shipment_date TEXT NOT NULL,
|
||||
created_at TEXT NOT NULL DEFAULT (${UTC_NOW}),
|
||||
order_id INTEGER NULL,
|
||||
order_number TEXT NULL,
|
||||
entity_id INTEGER NULL,
|
||||
customer_name TEXT NULL,
|
||||
positions INTEGER NOT NULL DEFAULT 0,
|
||||
total_quantity REAL NOT NULL DEFAULT 0,
|
||||
package_count INTEGER NOT NULL DEFAULT 0,
|
||||
carrier TEXT NULL,
|
||||
tracking_code TEXT NULL,
|
||||
state TEXT NOT NULL DEFAULT 'new',
|
||||
FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE NO ACTION,
|
||||
FOREIGN KEY (manifest_id) REFERENCES manifest(id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (entity_id) REFERENCES entity(id) ON DELETE SET NULL
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS IX_shipmentsummary_company_date
|
||||
ON shipmentsummary (company_id, shipment_date DESC, manifest_id DESC);
|
||||
CREATE INDEX IF NOT EXISTS IX_shipmentsummary_company_number
|
||||
ON shipmentsummary (company_id, shipment_number);
|
||||
CREATE INDEX IF NOT EXISTS IX_shipmentsummary_company_state
|
||||
ON shipmentsummary (company_id, state);
|
||||
CREATE INDEX IF NOT EXISTS IX_shipmentsummary_company_order
|
||||
ON shipmentsummary (company_id, order_id);
|
||||
`;
|
||||
|
||||
export const INIT_MCP_CLIENT = `
|
||||
CREATE TABLE IF NOT EXISTS mcp_client (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
@@ -1009,6 +1041,7 @@ export const SCHEMA_SCRIPTS = [
|
||||
INIT_PACKAGE,
|
||||
INIT_ORDERSUMMARY,
|
||||
INIT_QUOTESUMMARY,
|
||||
INIT_SHIPMENTSUMMARY,
|
||||
INIT_MCP_CLIENT,
|
||||
INIT_MCP_AUTH_CODE,
|
||||
INIT_MCP_TOKEN,
|
||||
|
||||
Reference in New Issue
Block a user