u
This commit is contained in:
@@ -1215,6 +1215,34 @@ BEGIN
|
||||
END
|
||||
`;
|
||||
|
||||
export const INIT_QUOTESUMMARY = `
|
||||
IF NOT EXISTS (SELECT * FROM sys.tables WHERE name = 'quotesummary')
|
||||
BEGIN
|
||||
CREATE TABLE quotesummary (
|
||||
id INT IDENTITY(1,1) PRIMARY KEY,
|
||||
company_id INT NOT NULL,
|
||||
manifest_id INT NOT NULL CONSTRAINT UQ_quotesummary_manifest UNIQUE,
|
||||
quote_number NVARCHAR(100) NOT NULL,
|
||||
quote_date DATETIME2 NOT NULL,
|
||||
created_at DATETIME2 NOT NULL CONSTRAINT DF_quotesummary_created_at DEFAULT SYSUTCDATETIME(),
|
||||
entity_id INT NULL,
|
||||
customer_name NVARCHAR(255) NULL,
|
||||
positions INT NOT NULL CONSTRAINT DF_quotesummary_positions DEFAULT 0,
|
||||
gross_total FLOAT NOT NULL CONSTRAINT DF_quotesummary_gross_total DEFAULT 0,
|
||||
total_quantity FLOAT NOT NULL CONSTRAINT DF_quotesummary_total_quantity DEFAULT 0,
|
||||
CONSTRAINT FK_quotesummary_company FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE NO ACTION,
|
||||
CONSTRAINT FK_quotesummary_manifest FOREIGN KEY (manifest_id) REFERENCES manifest(id) ON DELETE CASCADE,
|
||||
CONSTRAINT FK_quotesummary_entity FOREIGN KEY (entity_id) REFERENCES entity(id) ON DELETE SET NULL
|
||||
);
|
||||
|
||||
CREATE INDEX IX_quotesummary_company_date
|
||||
ON quotesummary (company_id, quote_date DESC, manifest_id DESC);
|
||||
|
||||
CREATE INDEX IX_quotesummary_company_number
|
||||
ON quotesummary (company_id, quote_number);
|
||||
END
|
||||
`;
|
||||
|
||||
export const INIT_MCP_CLIENT = `
|
||||
IF NOT EXISTS (SELECT * FROM sys.tables WHERE name = 'mcp_client')
|
||||
BEGIN
|
||||
@@ -1338,6 +1366,7 @@ export const SCHEMA_SCRIPTS = [
|
||||
INIT_SHIPPING,
|
||||
INIT_PACKAGE,
|
||||
INIT_ORDERSUMMARY,
|
||||
INIT_QUOTESUMMARY,
|
||||
INIT_MCP_CLIENT,
|
||||
INIT_MCP_AUTH_CODE,
|
||||
INIT_MCP_TOKEN,
|
||||
|
||||
Reference in New Issue
Block a user