This commit is contained in:
seb
2026-10-17 02:47:20 +02:00
parent 8ee080b744
commit 59395f95d8
8 changed files with 3330 additions and 3215 deletions

View File

@@ -1376,6 +1376,26 @@ BEGIN
END
`;
export const INIT_SUBAGENTSCHEDULE = `
IF NOT EXISTS (SELECT * FROM sys.tables WHERE name = 'subagentschedule')
BEGIN
CREATE TABLE subagentschedule (
id INT IDENTITY(1,1) PRIMARY KEY,
company_id INT NOT NULL,
[desc] NVARCHAR(MAX) NULL,
prompt NVARCHAR(MAX) NOT NULL,
skills NVARCHAR(MAX) NULL,
lastagentnote NVARCHAR(MAX) NULL,
max_itr INT NOT NULL CONSTRAINT DF_subagentschedule_max_itr DEFAULT 15,
cron NVARCHAR(100) NOT NULL,
created_at DATETIME2 NOT NULL CONSTRAINT DF_subagentschedule_created_at DEFAULT SYSUTCDATETIME(),
lastrun_at DATETIME2 NULL,
CONSTRAINT FK_subagentschedule_company FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE
);
CREATE INDEX IX_subagentschedule_company ON subagentschedule (company_id);
END
`;
/** DDL scripts in dependency order for schema init. */
export const SCHEMA_SCRIPTS = [
INIT_META,
@@ -1450,4 +1470,5 @@ export const SCHEMA_SCRIPTS = [
INIT_MCP_CLIENT,
INIT_MCP_AUTH_CODE,
INIT_MCP_TOKEN,
INIT_SUBAGENTSCHEDULE,
];

View File

@@ -1011,6 +1011,23 @@ CREATE TABLE IF NOT EXISTS mcp_token (
);
`;
export const INIT_SUBAGENTSCHEDULE = `
CREATE TABLE IF NOT EXISTS subagentschedule (
id INTEGER PRIMARY KEY AUTOINCREMENT,
company_id INTEGER NOT NULL,
"desc" TEXT,
prompt TEXT NOT NULL,
skills TEXT,
lastagentnote TEXT,
max_itr INTEGER NOT NULL DEFAULT 15,
cron TEXT NOT NULL,
created_at TEXT NOT NULL DEFAULT (${UTC_NOW}),
lastrun_at TEXT,
FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE
);
CREATE INDEX IF NOT EXISTS IX_subagentschedule_company ON subagentschedule (company_id);
`;
/** DDL scripts in dependency order for SQLite schema initialization. */
export const SCHEMA_SCRIPTS = [
INIT_META,
@@ -1082,4 +1099,5 @@ export const SCHEMA_SCRIPTS = [
INIT_MCP_CLIENT,
INIT_MCP_AUTH_CODE,
INIT_MCP_TOKEN,
INIT_SUBAGENTSCHEDULE,
];