Add board thread interventions
This commit is contained in:
1 parent
28007b3691
commit
78dbcbe7ce
14 files changed
+990
-370
No files matched your search
@@ -0,0 +1,29 @@
|
||||
export const boardInterventionSchema = `
|
||||
alter table chat_threads add column board_state text not null default 'open';
|
||||
alter table chat_threads add column controlled_by_type text;
|
||||
alter table chat_threads add column controlled_by_id text;
|
||||
|
||||
create table if not exists board_interventions (
|
||||
id text primary key,
|
||||
org_id text not null references organizations(id) on delete cascade,
|
||||
thread_id text not null references chat_threads(id) on delete cascade,
|
||||
message_id text not null references chat_messages(id) on delete cascade,
|
||||
mode text not null,
|
||||
action text not null,
|
||||
details text not null,
|
||||
target_type text,
|
||||
target_id text,
|
||||
approval_id text references approvals(id) on delete set null,
|
||||
created_by_type text not null,
|
||||
created_by_id text,
|
||||
created_at text not null,
|
||||
unique(message_id)
|
||||
);
|
||||
|
||||
create index if not exists idx_board_interventions_org_thread on board_interventions(org_id, thread_id, created_at);
|
||||
create index if not exists idx_board_interventions_message on board_interventions(message_id);
|
||||
create index if not exists idx_chat_threads_org_board_state on chat_threads(org_id, board_state);
|
||||
|
||||
insert into schema_migrations(version, name, applied_at)
|
||||
values (11, 'board_interventions', datetime('now'));
|
||||
`;
|
||||
@@ -9,6 +9,7 @@ import { skillHardeningSchema } from "./migrations/007-skill-hardening";
|
||||
import { providerHealthSchema } from "./migrations/008-provider-health";
|
||||
import { socialGovernanceSchema } from "./migrations/009-social-governance";
|
||||
import { fileHandoffSecuritySchema } from "./migrations/010-file-handoff-security";
|
||||
import { boardInterventionSchema } from "./migrations/011-board-interventions";
|
||||
|
||||
interface Migration {
|
||||
version: number;
|
||||
@@ -27,6 +28,7 @@ const MIGRATIONS: Migration[] = [
|
||||
{ version: 8, name: "provider_health", sql: providerHealthSchema },
|
||||
{ version: 9, name: "social_governance", sql: socialGovernanceSchema },
|
||||
{ version: 10, name: "file_handoff_security", sql: fileHandoffSecuritySchema },
|
||||
{ version: 11, name: "board_interventions", sql: boardInterventionSchema },
|
||||
];
|
||||
|
||||
const SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1].version;
|
||||
|
||||
Reference in new issue
Block a user