Add document, knowledge, and automation subsystems
Migration 040 creates documents, knowledge_entries, and automation_rules tables. Full-stack services (DocumentService, KnowledgeService, AutomationService), IPC handlers, preload bridge, desktop-api types, and domain records wired into the snapshot. UI pages follow next.
This commit is contained in:
1 parent
3b115e8bec
commit
b5b8f3ba3c
13 files changed
+344
-1
No files matched your search
@@ -0,0 +1,52 @@
|
||||
export const documentsKnowledgeAutomationSchema = `
|
||||
create table if not exists documents (
|
||||
id text primary key,
|
||||
org_id text not null references organizations(id) on delete cascade,
|
||||
title text not null,
|
||||
doc_type text not null,
|
||||
content text not null,
|
||||
status text not null,
|
||||
author_agent_id text references agents(id) on delete set null,
|
||||
reviewer_agent_id text references agents(id) on delete set null,
|
||||
project_id text references projects(id) on delete set null,
|
||||
goal_id text references goals(id) on delete set null,
|
||||
task_id text references tasks(id) on delete set null,
|
||||
created_at text not null,
|
||||
updated_at text not null
|
||||
);
|
||||
|
||||
create index if not exists idx_documents_org on documents(org_id, doc_type);
|
||||
|
||||
create table if not exists knowledge_entries (
|
||||
id text primary key,
|
||||
org_id text not null references organizations(id) on delete cascade,
|
||||
topic text not null,
|
||||
category text not null,
|
||||
content text not null,
|
||||
importance text not null,
|
||||
source_type text not null,
|
||||
source_id text,
|
||||
created_at text not null,
|
||||
updated_at text not null
|
||||
);
|
||||
|
||||
create index if not exists idx_knowledge_org on knowledge_entries(org_id, category);
|
||||
|
||||
create table if not exists automation_rules (
|
||||
id text primary key,
|
||||
org_id text not null references organizations(id) on delete cascade,
|
||||
name text not null,
|
||||
trigger_event text not null,
|
||||
condition_json text not null,
|
||||
action_type text not null,
|
||||
action_config_json text not null,
|
||||
priority integer not null,
|
||||
enabled integer not null,
|
||||
last_fired_at text,
|
||||
fire_count integer not null default 0,
|
||||
created_at text not null,
|
||||
updated_at text not null
|
||||
);
|
||||
|
||||
create index if not exists idx_automation_org on automation_rules(org_id, enabled);
|
||||
`;
|
||||
@@ -38,6 +38,7 @@ import { additionalConnectorsSchema } from "./migrations/036-additional-connecto
|
||||
import { customProvidersSchema } from "./migrations/037-custom-providers";
|
||||
import { providerAuthProfileCascadeSchema } from "./migrations/038-provider-auth-profile-cascade";
|
||||
import { auditImmutabilityOrgTeardownSchema } from "./migrations/039-audit-immutability-org-teardown";
|
||||
import { documentsKnowledgeAutomationSchema } from "./migrations/040-documents-knowledge-automation";
|
||||
|
||||
interface Migration {
|
||||
version: number;
|
||||
@@ -85,6 +86,7 @@ const MIGRATIONS: Migration[] = [
|
||||
{ version: 37, name: "custom_providers", sql: customProvidersSchema },
|
||||
{ version: 38, name: "provider_auth_profile_cascade", sql: providerAuthProfileCascadeSchema },
|
||||
{ version: 39, name: "audit_immutability_org_teardown", sql: auditImmutabilityOrgTeardownSchema },
|
||||
{ version: 40, name: "documents_knowledge_automation", sql: documentsKnowledgeAutomationSchema },
|
||||
];
|
||||
|
||||
const SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1].version;
|
||||
|
||||
Reference in new issue
Block a user