This commit is contained in:
seb
2026-10-14 13:31:23 +02:00
parent 3256ab233d
commit b718cdb047
12 changed files with 714 additions and 14 deletions

View File

@@ -876,6 +876,29 @@ CREATE INDEX IF NOT EXISTS IX_ordersummary_company_number
ON ordersummary (company_id, order_number);
`;
export const INIT_QUOTESUMMARY = `
CREATE TABLE IF NOT EXISTS quotesummary (
id INTEGER PRIMARY KEY AUTOINCREMENT,
company_id INTEGER NOT NULL,
manifest_id INTEGER NOT NULL UNIQUE,
quote_number TEXT NOT NULL,
quote_date TEXT NOT NULL,
created_at TEXT NOT NULL DEFAULT (${UTC_NOW}),
entity_id INTEGER NULL,
customer_name TEXT NULL,
positions INTEGER NOT NULL DEFAULT 0,
gross_total REAL NOT NULL DEFAULT 0,
total_quantity REAL NOT NULL DEFAULT 0,
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_quotesummary_company_date
ON quotesummary (company_id, quote_date DESC, manifest_id DESC);
CREATE INDEX IF NOT EXISTS IX_quotesummary_company_number
ON quotesummary (company_id, quote_number);
`;
export const INIT_MCP_CLIENT = `
CREATE TABLE IF NOT EXISTS mcp_client (
id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -985,6 +1008,7 @@ export const SCHEMA_SCRIPTS = [
INIT_SHIPPING,
INIT_PACKAGE,
INIT_ORDERSUMMARY,
INIT_QUOTESUMMARY,
INIT_MCP_CLIENT,
INIT_MCP_AUTH_CODE,
INIT_MCP_TOKEN,