π€― LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
ποΈ feat(database): add task labels and task label links tables (#22175)
Rdmclin2f4b362645644
diff --git a/docs/development/database-schema.dbml b/docs/development/database-schema.dbmlindex 8aee0f658cb..3b035e154f6 100644--- a/docs/development/database-schema.dbml+++ b/docs/development/database-schema.dbml@@ -4326,6 +4326,46 @@ table task_external_links {}}+table task_label_links {+ id uuid [pk, not null, default: `gen_random_uuid()`]+ task_id text [not null]+ label_id uuid [not null]+ user_id text [not null]+ workspace_id text+ created_at "timestamp with time zone" [not null, default: `now()`]++ indexes {+ (task_id, label_id) [name: 'task_label_links_task_id_label_id_unique', unique]+ label_id [name: 'task_label_links_label_id_idx']+ user_id [name: 'task_label_links_user_id_idx']+ workspace_id [name: 'task_label_links_workspace_id_idx']+ }+}++table task_labels {+ id uuid [pk, not null, default: `gen_random_uuid()`]+ user_id text+ workspace_id text+ parent_id uuid+ is_group boolean [not null, default: false]+ name text [not null]+ description text+ color text+ sort_order integer [not null, default: 0]+ accessed_at "timestamp with time zone" [not null, default: `now()`]+ created_at "timestamp with time zone" [not null, default: `now()`]+ updated_at "timestamp with time zone" [not null, default: `now()`]++ indexes {++ user_id [name: 'task_labels_user_id_idx']+ workspace_id [name: 'task_labels_workspace_id_idx']+ parent_id [name: 'task_labels_parent_id_idx']+ (user_id, name) [name: 'task_labels_user_id_name_unique', unique]+ (workspace_id, name) [name: 'task_labels_workspace_id_name_unique', unique]+ }+}+table threads {id text [pk, not null]title textdiff --git a/packages/database/migrations/0202_task_labels.sql b/packages/database/migrations/0202_task_labels.sqlnew file mode 100644index 00000000000..1eff76cb83f--- /dev/null+++ b/packages/database/migrations/0202_task_labels.sql@@ -0,0 +1,47 @@+CREATE TABLE IF NOT EXISTS "task_label_links" (+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,+ "task_id" text NOT NULL,+ "label_id" uuid NOT NULL,+ "user_id" text NOT NULL,+ "workspace_id" text,+ "created_at" timestamp with time zone DEFAULT now() NOT NULL+);+--> statement-breakpoint+CREATE TABLE IF NOT EXISTS "task_labels" (+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,+ "user_id" text,+ "workspace_id" text,+ "parent_id" uuid,+ "is_group" boolean DEFAULT false NOT NULL,+ "name" text NOT NULL,+ "description" text,+ "color" text,+ "sort_order" integer DEFAULT 0 NOT NULL,+ "accessed_at" timestamp with time zone DEFAULT now() NOT NULL,+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL+);+--> statement-breakpoint+ALTER TABLE "task_label_links" DROP CONSTRAINT IF EXISTS "task_label_links_task_id_tasks_id_fk";--> statement-breakpoint+ALTER TABLE "task_label_links" ADD CONSTRAINT "task_label_links_task_id_tasks_id_fk" FOREIGN KEY ("task_id") REFERENCES "public"."tasks"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "task_label_links" DROP CONSTRAINT IF EXISTS "task_label_links_label_id_task_labels_id_fk";--> statement-breakpoint+ALTER TABLE "task_label_links" ADD CONSTRAINT "task_label_links_label_id_task_labels_id_fk" FOREIGN KEY ("label_id") REFERENCES "public"."task_labels"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "task_label_links" DROP CONSTRAINT IF EXISTS "task_label_links_user_id_users_id_fk";--> statement-breakpoint+ALTER TABLE "task_label_links" ADD CONSTRAINT "task_label_links_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "task_label_links" DROP CONSTRAINT IF EXISTS "task_label_links_workspace_id_workspaces_id_fk";--> statement-breakpoint+ALTER TABLE "task_label_links" ADD CONSTRAINT "task_label_links_workspace_id_workspaces_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspaces"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "task_labels" DROP CONSTRAINT IF EXISTS "task_labels_user_id_users_id_fk";--> statement-breakpoint+ALTER TABLE "task_labels" ADD CONSTRAINT "task_labels_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "task_labels" DROP CONSTRAINT IF EXISTS "task_labels_workspace_id_workspaces_id_fk";--> statement-breakpoint+ALTER TABLE "task_labels" ADD CONSTRAINT "task_labels_workspace_id_workspaces_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspaces"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "task_labels" DROP CONSTRAINT IF EXISTS "task_labels_parent_id_task_labels_id_fk";--> statement-breakpoint+ALTER TABLE "task_labels" ADD CONSTRAINT "task_labels_parent_id_task_labels_id_fk" FOREIGN KEY ("parent_id") REFERENCES "public"."task_labels"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+CREATE UNIQUE INDEX IF NOT EXISTS "task_label_links_task_id_label_id_unique" ON "task_label_links" USING btree ("task_id","label_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "task_label_links_label_id_idx" ON "task_label_links" USING btree ("label_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "task_label_links_user_id_idx" ON "task_label_links" USING btree ("user_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "task_label_links_workspace_id_idx" ON "task_label_links" USING btree ("workspace_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "task_labels_user_id_idx" ON "task_labels" USING btree ("user_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "task_labels_workspace_id_idx" ON "task_labels" USING btree ("workspace_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "task_labels_parent_id_idx" ON "task_labels" USING btree ("parent_id");--> statement-breakpoint+CREATE UNIQUE INDEX IF NOT EXISTS "task_labels_user_id_name_unique" ON "task_labels" USING btree ("user_id",lower("name")) WHERE "task_labels"."workspace_id" IS NULL;--> statement-breakpoint+CREATE UNIQUE INDEX IF NOT EXISTS "task_labels_workspace_id_name_unique" ON "task_labels" USING btree ("workspace_id",lower("name")) WHERE "task_labels"."workspace_id" IS NOT NULL;\ No newline at end of filediff --git a/packages/database/migrations/meta/0192_snapshot.json b/packages/database/migrations/meta/0202_snapshot.jsonsimilarity index 87%rename from packages/database/migrations/meta/0192_snapshot.jsonrename to packages/database/migrations/meta/0202_snapshot.jsonindex cf5ed0b202e..dc6ba4d25c2 100644--- a/packages/database/migrations/meta/0192_snapshot.json+++ b/packages/database/migrations/meta/0202_snapshot.json@@ -1,28 +1,8 @@{- "_meta": {- "columns": {},- "schemas": {},- "tables": {}- },+ "id": "285ec8a4-45bc-409c-adfc-993edac7a4f8",+ "prevId": "e8a1f357-1bc4-496e-a22d-946c48f501f6",+ "version": "7","dialect": "postgresql",- "enums": {},- "id": "9aa70021-b222-4c91-9e85-e665a3b0762f",- "policies": {},- "prevId": "eba5e982-254a-4b19-a7f0-44c72dfab9dc",- "roles": {},- "schemas": {},- "sequences": {- "public.fts_search_sync_revision_seq": {- "name": "fts_search_sync_revision_seq",- "schema": "public",- "increment": "1",- "startWith": "1",- "minValue": "1",- "maxValue": "9223372036854775807",- "cache": "1",- "cycle": false- }- },"tables": {"public.acceptance_comments": {"name": "acceptance_comments",@@ -307,8 +287,12 @@"name": "acceptance_comments_acceptance_id_acceptances_id_fk","tableFrom": "acceptance_comments","tableTo": "acceptances",- "columnsFrom": ["acceptance_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "acceptance_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -316,8 +300,12 @@"name": "acceptance_comments_author_user_id_users_id_fk","tableFrom": "acceptance_comments","tableTo": "users",- "columnsFrom": ["author_user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "author_user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -325,8 +313,12 @@"name": "acceptance_comments_author_agent_id_agents_id_fk","tableFrom": "acceptance_comments","tableTo": "agents",- "columnsFrom": ["author_agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "author_agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -334,8 +326,12 @@"name": "acceptance_comments_workspace_id_workspaces_id_fk","tableFrom": "acceptance_comments","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -343,8 +339,12 @@"name": "acceptance_comments_parent_comment_id_acceptance_comments_id_fk","tableFrom": "acceptance_comments","tableTo": "acceptance_comments",- "columnsFrom": ["parent_comment_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "parent_comment_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "no action","onUpdate": "no action"},@@ -352,8 +352,12 @@"name": "acceptance_comments_context_run_id_verify_runs_id_fk","tableFrom": "acceptance_comments","tableTo": "verify_runs",- "columnsFrom": ["context_run_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "context_run_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -361,8 +365,12 @@"name": "acceptance_comments_evidence_id_verify_evidence_id_fk","tableFrom": "acceptance_comments","tableTo": "verify_evidence",- "columnsFrom": ["evidence_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "evidence_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -370,8 +378,12 @@"name": "acceptance_comments_resolved_by_user_id_users_id_fk","tableFrom": "acceptance_comments","tableTo": "users",- "columnsFrom": ["resolved_by_user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "resolved_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -480,8 +492,12 @@"name": "acceptance_flow_edges_flow_id_acceptance_flows_id_fk","tableFrom": "acceptance_flow_edges","tableTo": "acceptance_flows",- "columnsFrom": ["flow_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "flow_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -489,8 +505,14 @@"name": "acceptance_flow_edges_flow_id_source_node_id_acceptance_flow_nodes_flow_id_id_fk","tableFrom": "acceptance_flow_edges","tableTo": "acceptance_flow_nodes",- "columnsFrom": ["flow_id", "source_node_id"],- "columnsTo": ["flow_id", "id"],+ "columnsFrom": [+ "flow_id",+ "source_node_id"+ ],+ "columnsTo": [+ "flow_id",+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -498,8 +520,14 @@"name": "acceptance_flow_edges_flow_id_target_node_id_acceptance_flow_nodes_flow_id_id_fk","tableFrom": "acceptance_flow_edges","tableTo": "acceptance_flow_nodes",- "columnsFrom": ["flow_id", "target_node_id"],- "columnsTo": ["flow_id", "id"],+ "columnsFrom": [+ "flow_id",+ "target_node_id"+ ],+ "columnsTo": [+ "flow_id",+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -627,8 +655,12 @@"name": "acceptance_flow_nodes_flow_id_acceptance_flows_id_fk","tableFrom": "acceptance_flow_nodes","tableTo": "acceptance_flows",- "columnsFrom": ["flow_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "flow_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -636,8 +668,12 @@"name": "acceptance_flow_nodes_criterion_id_verify_criteria_id_fk","tableFrom": "acceptance_flow_nodes","tableTo": "verify_criteria",- "columnsFrom": ["criterion_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "criterion_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "no action","onUpdate": "no action"},@@ -645,8 +681,12 @@"name": "acceptance_flow_nodes_sub_flow_id_acceptance_flows_id_fk","tableFrom": "acceptance_flow_nodes","tableTo": "acceptance_flows",- "columnsFrom": ["sub_flow_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "sub_flow_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "no action","onUpdate": "no action"}@@ -729,8 +769,12 @@"name": "acceptance_flows_acceptance_id_acceptances_id_fk","tableFrom": "acceptance_flows","tableTo": "acceptances",- "columnsFrom": ["acceptance_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "acceptance_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -1159,8 +1203,12 @@"name": "agents_user_id_users_id_fk","tableFrom": "agents","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -1168,8 +1216,12 @@"name": "agents_workspace_id_workspaces_id_fk","tableFrom": "agents","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -1177,8 +1229,12 @@"name": "agents_session_group_id_session_groups_id_fk","tableFrom": "agents","tableTo": "session_groups",- "columnsFrom": ["session_group_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "session_group_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -1313,8 +1369,12 @@"name": "agents_files_file_id_files_id_fk","tableFrom": "agents_files","tableTo": "files",- "columnsFrom": ["file_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "file_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -1322,8 +1382,12 @@"name": "agents_files_agent_id_agents_id_fk","tableFrom": "agents_files","tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -1331,8 +1395,12 @@"name": "agents_files_user_id_users_id_fk","tableFrom": "agents_files","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -1340,8 +1408,12 @@"name": "agents_files_workspace_id_workspaces_id_fk","tableFrom": "agents_files","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -1349,7 +1421,11 @@"compositePrimaryKeys": {"agents_files_file_id_agent_id_user_id_pk": {"name": "agents_files_file_id_agent_id_user_id_pk",- "columns": ["file_id", "agent_id", "user_id"]+ "columns": [+ "file_id",+ "agent_id",+ "user_id"+ ]}},"uniqueConstraints": {},@@ -1481,8 +1557,12 @@"name": "agents_knowledge_bases_agent_id_agents_id_fk","tableFrom": "agents_knowledge_bases","tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -1490,8 +1570,12 @@"name": "agents_knowledge_bases_knowledge_base_id_knowledge_bases_id_fk","tableFrom": "agents_knowledge_bases","tableTo": "knowledge_bases",- "columnsFrom": ["knowledge_base_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "knowledge_base_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -1499,8 +1583,12 @@"name": "agents_knowledge_bases_user_id_users_id_fk","tableFrom": "agents_knowledge_bases","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -1508,8 +1596,12 @@"name": "agents_knowledge_bases_workspace_id_workspaces_id_fk","tableFrom": "agents_knowledge_bases","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -1517,7 +1609,10 @@"compositePrimaryKeys": {"agents_knowledge_bases_agent_id_knowledge_base_id_pk": {"name": "agents_knowledge_bases_agent_id_knowledge_base_id_pk",- "columns": ["agent_id", "knowledge_base_id"]+ "columns": [+ "agent_id",+ "knowledge_base_id"+ ]}},"uniqueConstraints": {},@@ -1746,8 +1841,12 @@"name": "agent_accounts_agent_id_agents_id_fk","tableFrom": "agent_accounts","tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -1755,8 +1854,12 @@"name": "agent_accounts_user_id_users_id_fk","tableFrom": "agent_accounts","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -1764,8 +1867,12 @@"name": "agent_accounts_workspace_id_workspaces_id_fk","tableFrom": "agent_accounts","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -1947,8 +2054,12 @@"name": "agent_bot_providers_agent_id_agents_id_fk","tableFrom": "agent_bot_providers","tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -1956,8 +2067,12 @@"name": "agent_bot_providers_user_id_users_id_fk","tableFrom": "agent_bot_providers","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -1965,8 +2080,12 @@"name": "agent_bot_providers_workspace_id_workspaces_id_fk","tableFrom": "agent_bot_providers","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -2232,8 +2351,12 @@"name": "agent_cron_jobs_agent_id_agents_id_fk","tableFrom": "agent_cron_jobs","tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -2241,8 +2364,12 @@"name": "agent_cron_jobs_group_id_chat_groups_id_fk","tableFrom": "agent_cron_jobs","tableTo": "chat_groups",- "columnsFrom": ["group_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "group_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -2250,8 +2377,12 @@"name": "agent_cron_jobs_user_id_users_id_fk","tableFrom": "agent_cron_jobs","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -2259,8 +2390,12 @@"name": "agent_cron_jobs_workspace_id_workspaces_id_fk","tableFrom": "agent_cron_jobs","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -2698,8 +2833,12 @@"name": "agent_documents_user_id_users_id_fk","tableFrom": "agent_documents","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -2707,8 +2846,12 @@"name": "agent_documents_workspace_id_workspaces_id_fk","tableFrom": "agent_documents","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -2716,8 +2859,12 @@"name": "agent_documents_agent_id_agents_id_fk","tableFrom": "agent_documents","tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -2725,8 +2872,12 @@"name": "agent_documents_document_id_documents_id_fk","tableFrom": "agent_documents","tableTo": "documents",- "columnsFrom": ["document_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -2734,8 +2885,12 @@"name": "agent_documents_deleted_by_user_id_users_id_fk","tableFrom": "agent_documents","tableTo": "users",- "columnsFrom": ["deleted_by_user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "deleted_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -2743,8 +2898,12 @@"name": "agent_documents_deleted_by_agent_id_agents_id_fk","tableFrom": "agent_documents","tableTo": "agents",- "columnsFrom": ["deleted_by_agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "deleted_by_agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -2938,8 +3097,12 @@"name": "agent_eval_benchmarks_user_id_users_id_fk","tableFrom": "agent_eval_benchmarks","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -2947,8 +3110,12 @@"name": "agent_eval_benchmarks_workspace_id_workspaces_id_fk","tableFrom": "agent_eval_benchmarks","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -3162,8 +3329,12 @@"name": "agent_eval_datasets_benchmark_id_agent_eval_benchmarks_id_fk","tableFrom": "agent_eval_datasets","tableTo": "agent_eval_benchmarks",- "columnsFrom": ["benchmark_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "benchmark_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -3171,8 +3342,12 @@"name": "agent_eval_datasets_source_experiment_id_agent_eval_experiments_id_fk","tableFrom": "agent_eval_datasets","tableTo": "agent_eval_experiments",- "columnsFrom": ["source_experiment_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "source_experiment_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -3180,8 +3355,12 @@"name": "agent_eval_datasets_user_id_users_id_fk","tableFrom": "agent_eval_datasets","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -3189,8 +3368,12 @@"name": "agent_eval_datasets_workspace_id_workspaces_id_fk","tableFrom": "agent_eval_datasets","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -3289,8 +3472,12 @@"name": "agent_eval_experiment_benchmarks_experiment_id_agent_eval_experiments_id_fk","tableFrom": "agent_eval_experiment_benchmarks","tableTo": "agent_eval_experiments",- "columnsFrom": ["experiment_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "experiment_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -3298,8 +3485,12 @@"name": "agent_eval_experiment_benchmarks_benchmark_id_agent_eval_benchmarks_id_fk","tableFrom": "agent_eval_experiment_benchmarks","tableTo": "agent_eval_benchmarks",- "columnsFrom": ["benchmark_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "benchmark_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -3307,8 +3498,12 @@"name": "agent_eval_experiment_benchmarks_user_id_users_id_fk","tableFrom": "agent_eval_experiment_benchmarks","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -3316,8 +3511,12 @@"name": "agent_eval_experiment_benchmarks_workspace_id_workspaces_id_fk","tableFrom": "agent_eval_experiment_benchmarks","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -3325,7 +3524,10 @@"compositePrimaryKeys": {"agent_eval_experiment_benchmarks_experiment_id_benchmark_id_pk": {"name": "agent_eval_experiment_benchmarks_experiment_id_benchmark_id_pk",- "columns": ["experiment_id", "benchmark_id"]+ "columns": [+ "experiment_id",+ "benchmark_id"+ ]}},"uniqueConstraints": {},@@ -3432,8 +3634,12 @@"name": "agent_eval_experiments_user_id_users_id_fk","tableFrom": "agent_eval_experiments","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -3441,8 +3647,12 @@"name": "agent_eval_experiments_workspace_id_workspaces_id_fk","tableFrom": "agent_eval_experiments","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -3586,8 +3796,12 @@"name": "agent_eval_run_topics_user_id_users_id_fk","tableFrom": "agent_eval_run_topics","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -3595,8 +3809,12 @@"name": "agent_eval_run_topics_workspace_id_workspaces_id_fk","tableFrom": "agent_eval_run_topics","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -3604,8 +3822,12 @@"name": "agent_eval_run_topics_run_id_agent_eval_runs_id_fk","tableFrom": "agent_eval_run_topics","tableTo": "agent_eval_runs",- "columnsFrom": ["run_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "run_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -3613,8 +3835,12 @@"name": "agent_eval_run_topics_topic_id_topics_id_fk","tableFrom": "agent_eval_run_topics","tableTo": "topics",- "columnsFrom": ["topic_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "topic_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -3622,8 +3848,12 @@"name": "agent_eval_run_topics_test_case_id_agent_eval_test_cases_id_fk","tableFrom": "agent_eval_run_topics","tableTo": "agent_eval_test_cases",- "columnsFrom": ["test_case_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "test_case_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -3631,7 +3861,10 @@"compositePrimaryKeys": {"agent_eval_run_topics_run_id_topic_id_pk": {"name": "agent_eval_run_topics_run_id_topic_id_pk",- "columns": ["run_id", "topic_id"]+ "columns": [+ "run_id",+ "topic_id"+ ]}},"uniqueConstraints": {},@@ -3850,8 +4083,12 @@"name": "agent_eval_runs_dataset_id_agent_eval_datasets_id_fk","tableFrom": "agent_eval_runs","tableTo": "agent_eval_datasets",- "columnsFrom": ["dataset_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "dataset_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -3859,8 +4096,12 @@"name": "agent_eval_runs_experiment_id_agent_eval_experiments_id_fk","tableFrom": "agent_eval_runs","tableTo": "agent_eval_experiments",- "columnsFrom": ["experiment_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "experiment_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "no action","onUpdate": "no action"},@@ -3868,8 +4109,12 @@"name": "agent_eval_runs_target_agent_id_agents_id_fk","tableFrom": "agent_eval_runs","tableTo": "agents",- "columnsFrom": ["target_agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "target_agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -3877,8 +4122,12 @@"name": "agent_eval_runs_user_id_users_id_fk","tableFrom": "agent_eval_runs","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -3886,8 +4135,12 @@"name": "agent_eval_runs_workspace_id_workspaces_id_fk","tableFrom": "agent_eval_runs","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -3895,8 +4148,12 @@"name": "agent_eval_runs_parent_run_id_agent_eval_runs_id_fk","tableFrom": "agent_eval_runs","tableTo": "agent_eval_runs",- "columnsFrom": ["parent_run_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "parent_run_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "no action","onUpdate": "no action"}@@ -4054,8 +4311,12 @@"name": "agent_eval_test_cases_user_id_users_id_fk","tableFrom": "agent_eval_test_cases","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -4063,8 +4324,12 @@"name": "agent_eval_test_cases_workspace_id_workspaces_id_fk","tableFrom": "agent_eval_test_cases","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -4072,8 +4337,12 @@"name": "agent_eval_test_cases_dataset_id_agent_eval_datasets_id_fk","tableFrom": "agent_eval_test_cases","tableTo": "agent_eval_datasets",- "columnsFrom": ["dataset_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "dataset_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -4151,8 +4420,12 @@"name": "agent_history_job_agents_job_id_agent_history_jobs_id_fk","tableFrom": "agent_history_job_agents","tableTo": "agent_history_jobs",- "columnsFrom": ["job_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "job_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -4160,8 +4433,12 @@"name": "agent_history_job_agents_agent_id_agents_id_fk","tableFrom": "agent_history_job_agents","tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -4239,8 +4516,12 @@"name": "agent_history_job_groups_job_id_agent_history_jobs_id_fk","tableFrom": "agent_history_job_groups","tableTo": "agent_history_jobs",- "columnsFrom": ["job_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "job_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -4248,8 +4529,12 @@"name": "agent_history_job_groups_group_id_chat_groups_id_fk","tableFrom": "agent_history_job_groups","tableTo": "chat_groups",- "columnsFrom": ["group_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "group_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -4373,8 +4658,12 @@"name": "agent_history_job_topics_job_id_agent_history_jobs_id_fk","tableFrom": "agent_history_job_topics","tableTo": "agent_history_jobs",- "columnsFrom": ["job_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "job_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -4382,8 +4671,12 @@"name": "agent_history_job_topics_topic_id_topics_id_fk","tableFrom": "agent_history_job_topics","tableTo": "topics",- "columnsFrom": ["topic_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "topic_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -4870,8 +5163,12 @@"name": "agent_inbox_messages_agent_id_agents_id_fk","tableFrom": "agent_inbox_messages","tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -4879,8 +5176,12 @@"name": "agent_inbox_messages_user_id_users_id_fk","tableFrom": "agent_inbox_messages","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -4888,8 +5189,12 @@"name": "agent_inbox_messages_workspace_id_workspaces_id_fk","tableFrom": "agent_inbox_messages","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -4897,8 +5202,12 @@"name": "agent_inbox_messages_account_id_agent_accounts_id_fk","tableFrom": "agent_inbox_messages","tableTo": "agent_accounts",- "columnsFrom": ["account_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "account_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -4906,8 +5215,12 @@"name": "agent_inbox_messages_topic_id_topics_id_fk","tableFrom": "agent_inbox_messages","tableTo": "topics",- "columnsFrom": ["topic_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "topic_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -5221,8 +5534,12 @@"name": "agent_intervention_resolutions_operation_id_agent_operations_id_fk","tableFrom": "agent_intervention_resolutions","tableTo": "agent_operations",- "columnsFrom": ["operation_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "operation_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -5230,8 +5547,12 @@"name": "agent_intervention_resolutions_user_id_users_id_fk","tableFrom": "agent_intervention_resolutions","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -5239,8 +5560,12 @@"name": "agent_intervention_resolutions_workspace_id_workspaces_id_fk","tableFrom": "agent_intervention_resolutions","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -5704,8 +6029,12 @@"name": "agent_interventions_operation_id_agent_operations_id_fk","tableFrom": "agent_interventions","tableTo": "agent_operations",- "columnsFrom": ["operation_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "operation_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -5713,8 +6042,12 @@"name": "agent_interventions_user_id_users_id_fk","tableFrom": "agent_interventions","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -5722,8 +6055,12 @@"name": "agent_interventions_workspace_id_workspaces_id_fk","tableFrom": "agent_interventions","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -5731,8 +6068,12 @@"name": "agent_interventions_resolution_id_agent_intervention_resolutions_id_fk","tableFrom": "agent_interventions","tableTo": "agent_intervention_resolutions",- "columnsFrom": ["resolution_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "resolution_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -5894,8 +6235,12 @@"name": "agent_label_assignments_label_id_agent_labels_id_fk","tableFrom": "agent_label_assignments","tableTo": "agent_labels",- "columnsFrom": ["label_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "label_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -5903,8 +6248,12 @@"name": "agent_label_assignments_agent_id_agents_id_fk","tableFrom": "agent_label_assignments","tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -5912,8 +6261,12 @@"name": "agent_label_assignments_user_id_users_id_fk","tableFrom": "agent_label_assignments","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -5921,8 +6274,12 @@"name": "agent_label_assignments_workspace_id_workspaces_id_fk","tableFrom": "agent_label_assignments","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -6084,8 +6441,12 @@"name": "agent_labels_user_id_users_id_fk","tableFrom": "agent_labels","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -6093,8 +6454,12 @@"name": "agent_labels_workspace_id_workspaces_id_fk","tableFrom": "agent_labels","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -6377,8 +6742,12 @@"name": "agent_mails_agent_id_agents_id_fk","tableFrom": "agent_mails","tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -6386,8 +6755,12 @@"name": "agent_mails_user_id_users_id_fk","tableFrom": "agent_mails","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -6395,8 +6768,12 @@"name": "agent_mails_workspace_id_workspaces_id_fk","tableFrom": "agent_mails","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -6404,8 +6781,12 @@"name": "agent_mails_account_id_agent_accounts_id_fk","tableFrom": "agent_mails","tableTo": "agent_accounts",- "columnsFrom": ["account_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "account_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -6413,8 +6794,12 @@"name": "agent_mails_signal_id_signals_id_fk","tableFrom": "agent_mails","tableTo": "signals",- "columnsFrom": ["signal_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "signal_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -6877,8 +7262,12 @@"name": "agent_operations_workspace_id_workspaces_id_fk","tableFrom": "agent_operations","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -6886,8 +7275,12 @@"name": "agent_operations_agent_id_agents_id_fk","tableFrom": "agent_operations","tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -6895,8 +7288,12 @@"name": "agent_operations_topic_id_topics_id_fk","tableFrom": "agent_operations","tableTo": "topics",- "columnsFrom": ["topic_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "topic_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -6904,8 +7301,12 @@"name": "agent_operations_thread_id_threads_id_fk","tableFrom": "agent_operations","tableTo": "threads",- "columnsFrom": ["thread_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "thread_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -6913,8 +7314,12 @@"name": "agent_operations_task_id_tasks_id_fk","tableFrom": "agent_operations","tableTo": "tasks",- "columnsFrom": ["task_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "task_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -6922,8 +7327,12 @@"name": "agent_operations_chat_group_id_chat_groups_id_fk","tableFrom": "agent_operations","tableTo": "chat_groups",- "columnsFrom": ["chat_group_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "chat_group_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -7123,8 +7532,12 @@"name": "agent_account_bindings_agent_id_agents_id_fk","tableFrom": "agent_account_bindings","tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -7132,8 +7545,12 @@"name": "agent_account_bindings_account_id_agent_provider_accounts_id_fk","tableFrom": "agent_account_bindings","tableTo": "agent_provider_accounts",- "columnsFrom": ["account_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "account_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -7141,8 +7558,12 @@"name": "agent_account_bindings_user_id_users_id_fk","tableFrom": "agent_account_bindings","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -7150,8 +7571,12 @@"name": "agent_account_bindings_workspace_id_workspaces_id_fk","tableFrom": "agent_account_bindings","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -7162,8 +7587,8 @@"checkConstraints": {},"isRLSEnabled": false},- "public.agent_provider_accounts": {- "name": "agent_provider_accounts",+ "public.agent_device_account_bindings": {+ "name": "agent_device_account_bindings","schema": "","columns": {"id": {@@ -7173,6 +7598,12 @@"notNull": true,"default": "gen_random_uuid()"},+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },"user_id": {"name": "user_id","type": "text",@@ -7185,104 +7616,532 @@"primaryKey": false,"notNull": false},- "provider": {- "name": "provider",- "type": "text",+ "device_id": {+ "name": "device_id",+ "type": "uuid","primaryKey": false,"notNull": true},- "external_account_id": {- "name": "external_account_id",- "type": "text",- "primaryKey": false,- "notNull": false- },- "email": {- "name": "email",- "type": "text",- "primaryKey": false,- "notNull": false- },- "display_name": {- "name": "display_name",- "type": "text",- "primaryKey": false,- "notNull": false- },- "organization_id": {- "name": "organization_id",- "type": "text",- "primaryKey": false,- "notNull": false- },- "plan_tier": {- "name": "plan_tier",- "type": "text",- "primaryKey": false,- "notNull": false- },- "rate_limit_tier": {- "name": "rate_limit_tier",- "type": "text",- "primaryKey": false,- "notNull": false- },- "label": {- "name": "label",- "type": "varchar(255)",- "primaryKey": false,- "notNull": false- },- "credential_mode": {- "name": "credential_mode",- "type": "text",- "primaryKey": false,- "notNull": true,- "default": "'referenced'"- },- "credentials": {- "name": "credentials",- "type": "text",- "primaryKey": false,- "notNull": false- },- "credential_ref": {- "name": "credential_ref",- "type": "jsonb",- "primaryKey": false,- "notNull": false- },- "token_expires_at": {- "name": "token_expires_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": false- },- "status": {- "name": "status",- "type": "text",- "primaryKey": false,- "notNull": true,- "default": "'active'"- },- "enabled": {- "name": "enabled",- "type": "boolean",- "primaryKey": false,- "notNull": true,- "default": true- },- "last_validated_at": {- "name": "last_validated_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": false- },- "metadata": {- "name": "metadata",- "type": "jsonb",+ "account_id": {+ "name": "account_id",+ "type": "uuid","primaryKey": false,- "notNull": false+ "notNull": true+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_device_account_bindings_agent_device_unique": {+ "name": "agent_device_account_bindings_agent_device_unique",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "device_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_device_account_bindings_device_id_idx": {+ "name": "agent_device_account_bindings_device_id_idx",+ "columns": [+ {+ "expression": "device_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_device_account_bindings_account_device_idx": {+ "name": "agent_device_account_bindings_account_device_idx",+ "columns": [+ {+ "expression": "account_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "device_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_device_account_bindings_user_id_idx": {+ "name": "agent_device_account_bindings_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_device_account_bindings_workspace_id_idx": {+ "name": "agent_device_account_bindings_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_device_account_bindings_agent_id_agents_id_fk": {+ "name": "agent_device_account_bindings_agent_id_agents_id_fk",+ "tableFrom": "agent_device_account_bindings",+ "tableTo": "agents",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_device_account_bindings_user_id_users_id_fk": {+ "name": "agent_device_account_bindings_user_id_users_id_fk",+ "tableFrom": "agent_device_account_bindings",+ "tableTo": "users",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_device_account_bindings_workspace_id_workspaces_id_fk": {+ "name": "agent_device_account_bindings_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_device_account_bindings",+ "tableTo": "workspaces",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_device_account_bindings_device_id_devices_id_fk": {+ "name": "agent_device_account_bindings_device_id_devices_id_fk",+ "tableFrom": "agent_device_account_bindings",+ "tableTo": "devices",+ "columnsFrom": [+ "device_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_device_account_bindings_account_id_agent_provider_accounts_id_fk": {+ "name": "agent_device_account_bindings_account_id_agent_provider_accounts_id_fk",+ "tableFrom": "agent_device_account_bindings",+ "tableTo": "agent_provider_accounts",+ "columnsFrom": [+ "account_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_device_account_bindings_login_fk": {+ "name": "agent_device_account_bindings_login_fk",+ "tableFrom": "agent_device_account_bindings",+ "tableTo": "agent_provider_account_logins",+ "columnsFrom": [+ "account_id",+ "device_id"+ ],+ "columnsTo": [+ "account_id",+ "device_id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_provider_account_logins": {+ "name": "agent_provider_account_logins",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "account_id": {+ "name": "account_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "device_id": {+ "name": "device_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "first_seen_at": {+ "name": "first_seen_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "last_seen_at": {+ "name": "last_seen_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_provider_account_logins_device_id_idx": {+ "name": "agent_provider_account_logins_device_id_idx",+ "columns": [+ {+ "expression": "device_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_provider_account_logins_user_id_idx": {+ "name": "agent_provider_account_logins_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_provider_account_logins_workspace_id_idx": {+ "name": "agent_provider_account_logins_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_provider_account_logins_account_id_agent_provider_accounts_id_fk": {+ "name": "agent_provider_account_logins_account_id_agent_provider_accounts_id_fk",+ "tableFrom": "agent_provider_account_logins",+ "tableTo": "agent_provider_accounts",+ "columnsFrom": [+ "account_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_provider_account_logins_device_id_devices_id_fk": {+ "name": "agent_provider_account_logins_device_id_devices_id_fk",+ "tableFrom": "agent_provider_account_logins",+ "tableTo": "devices",+ "columnsFrom": [+ "device_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_provider_account_logins_user_id_users_id_fk": {+ "name": "agent_provider_account_logins_user_id_users_id_fk",+ "tableFrom": "agent_provider_account_logins",+ "tableTo": "users",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_provider_account_logins_workspace_id_workspaces_id_fk": {+ "name": "agent_provider_account_logins_workspace_id_workspaces_id_fk",+ "tableFrom": "agent_provider_account_logins",+ "tableTo": "workspaces",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "agent_provider_account_logins_account_device_unique": {+ "name": "agent_provider_account_logins_account_device_unique",+ "nullsNotDistinct": false,+ "columns": [+ "account_id",+ "device_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_provider_accounts": {+ "name": "agent_provider_accounts",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'public'"+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "external_account_id": {+ "name": "external_account_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "email": {+ "name": "email",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "display_name": {+ "name": "display_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "organization_id": {+ "name": "organization_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "plan_tier": {+ "name": "plan_tier",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "rate_limit_tier": {+ "name": "rate_limit_tier",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "label": {+ "name": "label",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "credential_mode": {+ "name": "credential_mode",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'referenced'"+ },+ "credentials": {+ "name": "credentials",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "credential_ref": {+ "name": "credential_ref",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "token_expires_at": {+ "name": "token_expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "last_validated_at": {+ "name": "last_validated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false},"accessed_at": {"name": "accessed_at",@@ -7337,6 +8196,33 @@"method": "btree","with": {}},+ "agent_provider_accounts_workspace_visibility_idx": {+ "name": "agent_provider_accounts_workspace_visibility_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "visibility",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },"agent_provider_accounts_token_expires_at_idx": {"name": "agent_provider_accounts_token_expires_at_idx","columns": [@@ -7414,8 +8300,12 @@"name": "agent_provider_accounts_user_id_users_id_fk","tableFrom": "agent_provider_accounts","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -7423,8 +8313,12 @@"name": "agent_provider_accounts_workspace_id_workspaces_id_fk","tableFrom": "agent_provider_accounts","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -7610,8 +8504,12 @@"name": "agent_quota_calibrations_account_id_agent_provider_accounts_id_fk","tableFrom": "agent_quota_calibrations","tableTo": "agent_provider_accounts",- "columnsFrom": ["account_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "account_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -7619,8 +8517,12 @@"name": "agent_quota_calibrations_user_id_users_id_fk","tableFrom": "agent_quota_calibrations","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -7628,8 +8530,12 @@"name": "agent_quota_calibrations_workspace_id_workspaces_id_fk","tableFrom": "agent_quota_calibrations","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -7839,8 +8745,12 @@"name": "agent_quota_snapshots_account_id_agent_provider_accounts_id_fk","tableFrom": "agent_quota_snapshots","tableTo": "agent_provider_accounts",- "columnsFrom": ["account_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "account_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -7848,8 +8758,12 @@"name": "agent_quota_snapshots_user_id_users_id_fk","tableFrom": "agent_quota_snapshots","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -7857,8 +8771,12 @@"name": "agent_quota_snapshots_workspace_id_workspaces_id_fk","tableFrom": "agent_quota_snapshots","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -7866,8 +8784,12 @@"name": "agent_quota_snapshots_device_id_devices_id_fk","tableFrom": "agent_quota_snapshots","tableTo": "devices",- "columnsFrom": ["device_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "device_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -8142,8 +9064,12 @@"name": "agent_quota_usage_ledger_account_id_agent_provider_accounts_id_fk","tableFrom": "agent_quota_usage_ledger","tableTo": "agent_provider_accounts",- "columnsFrom": ["account_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "account_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -8151,8 +9077,12 @@"name": "agent_quota_usage_ledger_user_id_users_id_fk","tableFrom": "agent_quota_usage_ledger","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -8160,8 +9090,12 @@"name": "agent_quota_usage_ledger_workspace_id_workspaces_id_fk","tableFrom": "agent_quota_usage_ledger","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -8169,8 +9103,12 @@"name": "agent_quota_usage_ledger_message_id_messages_id_fk","tableFrom": "agent_quota_usage_ledger","tableTo": "messages",- "columnsFrom": ["message_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "message_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -8178,8 +9116,12 @@"name": "agent_quota_usage_ledger_operation_id_agent_operations_id_fk","tableFrom": "agent_quota_usage_ledger","tableTo": "agent_operations",- "columnsFrom": ["operation_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "operation_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -8187,8 +9129,12 @@"name": "agent_quota_usage_ledger_topic_id_topics_id_fk","tableFrom": "agent_quota_usage_ledger","tableTo": "topics",- "columnsFrom": ["topic_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "topic_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -8196,8 +9142,12 @@"name": "agent_quota_usage_ledger_agent_id_agents_id_fk","tableFrom": "agent_quota_usage_ledger","tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -8437,8 +9387,12 @@"name": "agent_quota_windows_account_id_agent_provider_accounts_id_fk","tableFrom": "agent_quota_windows","tableTo": "agent_provider_accounts",- "columnsFrom": ["account_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "account_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -8446,8 +9400,12 @@"name": "agent_quota_windows_user_id_users_id_fk","tableFrom": "agent_quota_windows","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -8455,8 +9413,12 @@"name": "agent_quota_windows_workspace_id_workspaces_id_fk","tableFrom": "agent_quota_windows","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -8563,8 +9525,12 @@"name": "agent_shares_agent_id_agents_id_fk","tableFrom": "agent_shares","tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -8813,8 +9779,12 @@"name": "agent_skills_zip_file_hash_global_files_hash_id_fk","tableFrom": "agent_skills","tableTo": "global_files",- "columnsFrom": ["zip_file_hash"],- "columnsTo": ["hash_id"],+ "columnsFrom": [+ "zip_file_hash"+ ],+ "columnsTo": [+ "hash_id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -8822,8 +9792,12 @@"name": "agent_skills_user_id_users_id_fk","tableFrom": "agent_skills","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -8831,8 +9805,12 @@"name": "agent_skills_workspace_id_workspaces_id_fk","tableFrom": "agent_skills","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -9087,8 +10065,12 @@"name": "ai_models_user_id_users_id_fk","tableFrom": "ai_models","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -9096,8 +10078,12 @@"name": "ai_models_workspace_id_workspaces_id_fk","tableFrom": "ai_models","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -9312,8 +10298,12 @@"name": "ai_providers_user_id_users_id_fk","tableFrom": "ai_providers","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -9321,8 +10311,12 @@"name": "ai_providers_workspace_id_workspaces_id_fk","tableFrom": "ai_providers","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -9457,8 +10451,12 @@"name": "api_keys_user_id_users_id_fk","tableFrom": "api_keys","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -9466,8 +10464,12 @@"name": "api_keys_workspace_id_workspaces_id_fk","tableFrom": "api_keys","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -9477,12 +10479,16 @@"api_keys_key_unique": {"name": "api_keys_key_unique","nullsNotDistinct": false,- "columns": ["key"]+ "columns": [+ "key"+ ]},"api_keys_key_hash_unique": {"name": "api_keys_key_hash_unique","nullsNotDistinct": false,- "columns": ["key_hash"]+ "columns": [+ "key_hash"+ ]}},"policies": {},@@ -9680,8 +10686,12 @@"name": "async_tasks_user_id_users_id_fk","tableFrom": "async_tasks","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -9689,8 +10699,12 @@"name": "async_tasks_workspace_id_workspaces_id_fk","tableFrom": "async_tasks","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -9807,8 +10821,12 @@"name": "accounts_user_id_users_id_fk","tableFrom": "accounts","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -9928,8 +10946,12 @@"name": "passkey_userId_users_id_fk","tableFrom": "passkey","tableTo": "users",- "columnsFrom": ["userId"],- "columnsTo": ["id"],+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -10022,8 +11044,12 @@"name": "auth_sessions_user_id_users_id_fk","tableFrom": "auth_sessions","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -10033,7 +11059,9 @@"auth_sessions_token_unique": {"name": "auth_sessions_token_unique","nullsNotDistinct": false,- "columns": ["token"]+ "columns": [+ "token"+ ]}},"policies": {},@@ -10106,8 +11134,12 @@"name": "two_factor_user_id_users_id_fk","tableFrom": "two_factor","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -10290,8 +11322,12 @@"name": "channel_audit_channel_id_channels_id_fk","tableFrom": "channel_audit","tableTo": "channels",- "columnsFrom": ["channel_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "channel_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -10343,13 +11379,6 @@"primaryKey": false,"notNull": true},- "delivery_key": {- "name": "delivery_key",- "type": "text",- "primaryKey": false,- "notNull": true,- "default": "'initial'"- },"status": {"name": "status","type": "text",@@ -10491,12 +11520,6 @@"isExpression": false,"asc": true,"nulls": "last"- },- {- "expression": "delivery_key",- "isExpression": false,- "asc": true,- "nulls": "last"}],"isUnique": true,@@ -10666,8 +11689,12 @@"name": "channel_jobs_channel_id_channels_id_fk","tableFrom": "channel_jobs","tableTo": "channels",- "columnsFrom": ["channel_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "channel_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -10675,8 +11702,12 @@"name": "channel_jobs_topic_id_topics_id_fk","tableFrom": "channel_jobs","tableTo": "topics",- "columnsFrom": ["topic_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "topic_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -10684,8 +11715,12 @@"name": "channel_jobs_operation_id_agent_operations_id_fk","tableFrom": "channel_jobs","tableTo": "agent_operations",- "columnsFrom": ["operation_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "operation_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -10693,8 +11728,14 @@"name": "channel_jobs_member_fk","tableFrom": "channel_jobs","tableTo": "channel_members",- "columnsFrom": ["channel_id", "member_id"],- "columnsTo": ["channel_id", "id"],+ "columnsFrom": [+ "channel_id",+ "member_id"+ ],+ "columnsTo": [+ "channel_id",+ "id"+ ],"onDelete": "no action","onUpdate": "no action"},@@ -10702,8 +11743,14 @@"name": "channel_jobs_requester_fk","tableFrom": "channel_jobs","tableTo": "channel_members",- "columnsFrom": ["channel_id", "requester_member_id"],- "columnsTo": ["channel_id", "id"],+ "columnsFrom": [+ "channel_id",+ "requester_member_id"+ ],+ "columnsTo": [+ "channel_id",+ "id"+ ],"onDelete": "no action","onUpdate": "no action"},@@ -10711,8 +11758,14 @@"name": "channel_jobs_message_fk","tableFrom": "channel_jobs","tableTo": "channel_messages",- "columnsFrom": ["channel_id", "message_id"],- "columnsTo": ["channel_id", "id"],+ "columnsFrom": [+ "channel_id",+ "message_id"+ ],+ "columnsTo": [+ "channel_id",+ "id"+ ],"onDelete": "no action","onUpdate": "no action"},@@ -10720,8 +11773,14 @@"name": "channel_jobs_thread_fk","tableFrom": "channel_jobs","tableTo": "channel_threads",- "columnsFrom": ["channel_id", "thread_id"],- "columnsTo": ["channel_id", "id"],+ "columnsFrom": [+ "channel_id",+ "thread_id"+ ],+ "columnsTo": [+ "channel_id",+ "id"+ ],"onDelete": "no action","onUpdate": "no action"}@@ -10731,12 +11790,17 @@"channel_jobs_operation_id_unique": {"name": "channel_jobs_operation_id_unique","nullsNotDistinct": false,- "columns": ["operation_id"]+ "columns": [+ "operation_id"+ ]},"channel_jobs_scope_unique": {"name": "channel_jobs_scope_unique","nullsNotDistinct": false,- "columns": ["channel_id", "id"]+ "columns": [+ "channel_id",+ "id"+ ]}},"policies": {},@@ -10880,8 +11944,12 @@"name": "channel_member_grants_channel_id_channels_id_fk","tableFrom": "channel_member_grants","tableTo": "channels",- "columnsFrom": ["channel_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "channel_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -10889,8 +11957,12 @@"name": "channel_member_grants_device_owner_id_users_id_fk","tableFrom": "channel_member_grants","tableTo": "users",- "columnsFrom": ["device_owner_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "device_owner_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -10898,8 +11970,14 @@"name": "channel_member_grants_member_fk","tableFrom": "channel_member_grants","tableTo": "channel_members",- "columnsFrom": ["channel_id", "member_id"],- "columnsTo": ["channel_id", "id"],+ "columnsFrom": [+ "channel_id",+ "member_id"+ ],+ "columnsTo": [+ "channel_id",+ "id"+ ],"onDelete": "no action","onUpdate": "no action"},@@ -10907,8 +11985,14 @@"name": "channel_member_grants_requester_fk","tableFrom": "channel_member_grants","tableTo": "channel_members",- "columnsFrom": ["channel_id", "requested_by_member_id"],- "columnsTo": ["channel_id", "id"],+ "columnsFrom": [+ "channel_id",+ "requested_by_member_id"+ ],+ "columnsTo": [+ "channel_id",+ "id"+ ],"onDelete": "no action","onUpdate": "no action"}@@ -11073,8 +12157,12 @@"name": "channel_members_channel_id_channels_id_fk","tableFrom": "channel_members","tableTo": "channels",- "columnsFrom": ["channel_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "channel_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -11082,8 +12170,12 @@"name": "channel_members_user_id_users_id_fk","tableFrom": "channel_members","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -11091,8 +12183,12 @@"name": "channel_members_agent_id_agents_id_fk","tableFrom": "channel_members","tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -11102,7 +12198,10 @@"channel_members_scope_unique": {"name": "channel_members_scope_unique","nullsNotDistinct": false,- "columns": ["channel_id", "id"]+ "columns": [+ "channel_id",+ "id"+ ]}},"policies": {},@@ -11190,8 +12289,12 @@"name": "channel_message_files_message_id_channel_messages_id_fk","tableFrom": "channel_message_files","tableTo": "channel_messages",- "columnsFrom": ["message_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "message_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -11199,8 +12302,12 @@"name": "channel_message_files_file_id_files_id_fk","tableFrom": "channel_message_files","tableTo": "files",- "columnsFrom": ["file_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "file_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -11210,7 +12317,10 @@"channel_message_files_message_file_unique": {"name": "channel_message_files_message_file_unique","nullsNotDistinct": false,- "columns": ["message_id", "file_id"]+ "columns": [+ "message_id",+ "file_id"+ ]}},"policies": {},@@ -11456,8 +12566,12 @@"name": "channel_messages_channel_id_channels_id_fk","tableFrom": "channel_messages","tableTo": "channels",- "columnsFrom": ["channel_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "channel_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -11465,8 +12579,12 @@"name": "channel_messages_user_id_users_id_fk","tableFrom": "channel_messages","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -11474,8 +12592,12 @@"name": "channel_messages_agent_id_agents_id_fk","tableFrom": "channel_messages","tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -11483,8 +12605,14 @@"name": "channel_messages_thread_fk","tableFrom": "channel_messages","tableTo": "channel_threads",- "columnsFrom": ["channel_id", "thread_id"],- "columnsTo": ["channel_id", "id"],+ "columnsFrom": [+ "channel_id",+ "thread_id"+ ],+ "columnsTo": [+ "channel_id",+ "id"+ ],"onDelete": "no action","onUpdate": "no action"}@@ -11494,7 +12622,10 @@"channel_messages_scope_unique": {"name": "channel_messages_scope_unique","nullsNotDistinct": false,- "columns": ["channel_id", "id"]+ "columns": [+ "channel_id",+ "id"+ ]}},"policies": {},@@ -11612,8 +12743,12 @@"name": "channel_threads_channel_id_channels_id_fk","tableFrom": "channel_threads","tableTo": "channels",- "columnsFrom": ["channel_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "channel_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -11621,8 +12756,14 @@"name": "channel_threads_root_fk","tableFrom": "channel_threads","tableTo": "channel_messages",- "columnsFrom": ["channel_id", "root_message_id"],- "columnsTo": ["channel_id", "id"],+ "columnsFrom": [+ "channel_id",+ "root_message_id"+ ],+ "columnsTo": [+ "channel_id",+ "id"+ ],"onDelete": "no action","onUpdate": "no action"}@@ -11632,7 +12773,10 @@"channel_threads_scope_unique": {"name": "channel_threads_scope_unique","nullsNotDistinct": false,- "columns": ["channel_id", "id"]+ "columns": [+ "channel_id",+ "id"+ ]}},"policies": {},@@ -11700,6 +12844,12 @@"notNull": true,"default": "'private'"},+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },"metadata": {"name": "metadata","type": "jsonb",@@ -11821,8 +12971,12 @@"name": "channels_user_id_users_id_fk","tableFrom": "channels","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -11830,8 +12984,12 @@"name": "channels_workspace_id_workspaces_id_fk","tableFrom": "channels","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -11839,8 +12997,12 @@"name": "channels_project_id_projects_id_fk","tableFrom": "channels","tableTo": "projects",- "columnsFrom": ["project_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -11848,8 +13010,12 @@"name": "channels_agent_id_agents_id_fk","tableFrom": "channels","tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -12095,8 +13261,12 @@"name": "chat_groups_user_id_users_id_fk","tableFrom": "chat_groups","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -12104,8 +13274,12 @@"name": "chat_groups_workspace_id_workspaces_id_fk","tableFrom": "chat_groups","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -12113,8 +13287,12 @@"name": "chat_groups_group_id_session_groups_id_fk","tableFrom": "chat_groups","tableTo": "session_groups",- "columnsFrom": ["group_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "group_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -12233,8 +13411,12 @@"name": "chat_groups_agents_chat_group_id_chat_groups_id_fk","tableFrom": "chat_groups_agents","tableTo": "chat_groups",- "columnsFrom": ["chat_group_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "chat_group_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -12242,8 +13424,12 @@"name": "chat_groups_agents_agent_id_agents_id_fk","tableFrom": "chat_groups_agents","tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -12251,8 +13437,12 @@"name": "chat_groups_agents_user_id_users_id_fk","tableFrom": "chat_groups_agents","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -12260,8 +13450,12 @@"name": "chat_groups_agents_workspace_id_workspaces_id_fk","tableFrom": "chat_groups_agents","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -12269,7 +13463,10 @@"compositePrimaryKeys": {"chat_groups_agents_chat_group_id_agent_id_pk": {"name": "chat_groups_agents_chat_group_id_agent_id_pk",- "columns": ["chat_group_id", "agent_id"]+ "columns": [+ "chat_group_id",+ "agent_id"+ ]}},"uniqueConstraints": {},@@ -12474,8 +13671,12 @@"name": "user_connector_tools_user_connector_id_user_connectors_id_fk","tableFrom": "user_connector_tools","tableTo": "user_connectors",- "columnsFrom": ["user_connector_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_connector_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -12483,8 +13684,12 @@"name": "user_connector_tools_user_id_users_id_fk","tableFrom": "user_connector_tools","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -12492,8 +13697,12 @@"name": "user_connector_tools_workspace_id_workspaces_id_fk","tableFrom": "user_connector_tools","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -12767,8 +13976,12 @@"name": "user_connectors_user_id_users_id_fk","tableFrom": "user_connectors","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -12776,8 +13989,12 @@"name": "user_connectors_workspace_id_workspaces_id_fk","tableFrom": "user_connectors","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -12785,8 +14002,12 @@"name": "user_connectors_agent_id_agents_id_fk","tableFrom": "user_connectors","tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -12893,8 +14114,12 @@"name": "user_installed_plugins_user_id_users_id_fk","tableFrom": "user_installed_plugins","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -12902,8 +14127,12 @@"name": "user_installed_plugins_workspace_id_workspaces_id_fk","tableFrom": "user_installed_plugins","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -12911,7 +14140,10 @@"compositePrimaryKeys": {"user_installed_plugins_user_id_identifier_pk": {"name": "user_installed_plugins_user_id_identifier_pk",- "columns": ["user_id", "identifier"]+ "columns": [+ "user_id",+ "identifier"+ ]}},"uniqueConstraints": {},@@ -13083,8 +14315,12 @@"name": "dashboard_items_dashboard_id_dashboards_id_fk","tableFrom": "dashboard_items","tableTo": "dashboards",- "columnsFrom": ["dashboard_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "dashboard_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -13092,8 +14328,12 @@"name": "dashboard_items_widget_id_widgets_id_fk","tableFrom": "dashboard_items","tableTo": "widgets",- "columnsFrom": ["widget_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "widget_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -13101,8 +14341,12 @@"name": "dashboard_items_user_id_users_id_fk","tableFrom": "dashboard_items","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -13110,8 +14354,12 @@"name": "dashboard_items_workspace_id_workspaces_id_fk","tableFrom": "dashboard_items","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -13354,8 +14602,12 @@"name": "dashboards_user_id_users_id_fk","tableFrom": "dashboards","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -13363,8 +14615,12 @@"name": "dashboards_workspace_id_workspaces_id_fk","tableFrom": "dashboards","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -13372,8 +14628,12 @@"name": "dashboards_project_id_projects_id_fk","tableFrom": "dashboards","tableTo": "projects",- "columnsFrom": ["project_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -13381,8 +14641,12 @@"name": "dashboards_agent_id_agents_id_fk","tableFrom": "dashboards","tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -13635,8 +14899,12 @@"name": "devices_user_id_users_id_fk","tableFrom": "devices","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -13644,8 +14912,12 @@"name": "devices_workspace_id_workspaces_id_fk","tableFrom": "devices","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -13757,8 +15029,12 @@"name": "document_comment_mentions_comment_id_document_comments_id_fk","tableFrom": "document_comment_mentions","tableTo": "document_comments",- "columnsFrom": ["comment_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "comment_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -13766,8 +15042,12 @@"name": "document_comment_mentions_mentioned_user_id_users_id_fk","tableFrom": "document_comment_mentions","tableTo": "users",- "columnsFrom": ["mentioned_user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "mentioned_user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -13775,8 +15055,12 @@"name": "document_comment_mentions_workspace_id_workspaces_id_fk","tableFrom": "document_comment_mentions","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -14006,8 +15290,12 @@"name": "document_comments_document_id_documents_id_fk","tableFrom": "document_comments","tableTo": "documents",- "columnsFrom": ["document_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -14015,8 +15303,12 @@"name": "document_comments_parent_comment_id_document_comments_id_fk","tableFrom": "document_comments","tableTo": "document_comments",- "columnsFrom": ["parent_comment_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "parent_comment_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "no action","onUpdate": "no action"},@@ -14024,8 +15316,12 @@"name": "document_comments_reply_to_comment_id_document_comments_id_fk","tableFrom": "document_comments","tableTo": "document_comments",- "columnsFrom": ["reply_to_comment_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "reply_to_comment_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -14033,8 +15329,12 @@"name": "document_comments_author_user_id_users_id_fk","tableFrom": "document_comments","tableTo": "users",- "columnsFrom": ["author_user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "author_user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -14042,8 +15342,12 @@"name": "document_comments_workspace_id_workspaces_id_fk","tableFrom": "document_comments","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -14099,6 +15403,24 @@"primaryKey": false,"notNull": true},+ "editor_ids": {+ "name": "editor_ids",+ "type": "text[]",+ "primaryKey": false,+ "notNull": false+ },+ "operation_id": {+ "name": "operation_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },"saved_at": {"name": "saved_at","type": "timestamp with time zone",@@ -14173,8 +15495,12 @@"name": "document_histories_document_id_documents_id_fk","tableFrom": "document_histories","tableTo": "documents",- "columnsFrom": ["document_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -14182,8 +15508,12 @@"name": "document_histories_user_id_users_id_fk","tableFrom": "document_histories","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -14191,8 +15521,12 @@"name": "document_histories_workspace_id_workspaces_id_fk","tableFrom": "document_histories","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -14319,8 +15653,12 @@"name": "document_likes_document_id_documents_id_fk","tableFrom": "document_likes","tableTo": "documents",- "columnsFrom": ["document_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -14328,8 +15666,12 @@"name": "document_likes_user_id_users_id_fk","tableFrom": "document_likes","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -14337,8 +15679,12 @@"name": "document_likes_workspace_id_workspaces_id_fk","tableFrom": "document_likes","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -14473,8 +15819,12 @@"name": "document_shares_document_id_documents_id_fk","tableFrom": "document_shares","tableTo": "documents",- "columnsFrom": ["document_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -14482,8 +15832,12 @@"name": "document_shares_user_id_users_id_fk","tableFrom": "document_shares","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -14491,8 +15845,12 @@"name": "document_shares_workspace_id_workspaces_id_fk","tableFrom": "document_shares","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -14694,8 +16052,12 @@"name": "environments_user_id_users_id_fk","tableFrom": "environments","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "restrict","onUpdate": "no action"},@@ -14703,8 +16065,12 @@"name": "environments_workspace_id_workspaces_id_fk","tableFrom": "environments","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "restrict","onUpdate": "no action"}@@ -14948,8 +16314,12 @@"name": "environment_instances_environment_id_environments_id_fk","tableFrom": "environment_instances","tableTo": "environments",- "columnsFrom": ["environment_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "environment_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "restrict","onUpdate": "no action"},@@ -14957,8 +16327,12 @@"name": "environment_instances_device_id_devices_id_fk","tableFrom": "environment_instances","tableTo": "devices",- "columnsFrom": ["device_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "device_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "restrict","onUpdate": "no action"}@@ -15211,8 +16585,12 @@"name": "expertise_bindings_domain_id_expertise_domains_id_fk","tableFrom": "expertise_bindings","tableTo": "expertise_domains",- "columnsFrom": ["domain_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "domain_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -15220,8 +16598,12 @@"name": "expertise_bindings_agent_id_agents_id_fk","tableFrom": "expertise_bindings","tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -15229,8 +16611,12 @@"name": "expertise_bindings_project_id_projects_id_fk","tableFrom": "expertise_bindings","tableTo": "projects",- "columnsFrom": ["project_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -15238,8 +16624,12 @@"name": "expertise_bindings_bound_workspace_id_workspaces_id_fk","tableFrom": "expertise_bindings","tableTo": "workspaces",- "columnsFrom": ["bound_workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "bound_workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -15247,8 +16637,12 @@"name": "expertise_bindings_bound_user_id_users_id_fk","tableFrom": "expertise_bindings","tableTo": "users",- "columnsFrom": ["bound_user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "bound_user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -15256,8 +16650,12 @@"name": "expertise_bindings_added_by_user_id_users_id_fk","tableFrom": "expertise_bindings","tableTo": "users",- "columnsFrom": ["added_by_user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "added_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -15265,8 +16663,12 @@"name": "expertise_bindings_workspace_id_workspaces_id_fk","tableFrom": "expertise_bindings","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -15496,8 +16898,12 @@"name": "expertise_domain_snapshots_domain_id_expertise_domains_id_fk","tableFrom": "expertise_domain_snapshots","tableTo": "expertise_domains",- "columnsFrom": ["domain_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "domain_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -15505,8 +16911,12 @@"name": "expertise_domain_snapshots_run_id_expertise_runs_id_fk","tableFrom": "expertise_domain_snapshots","tableTo": "expertise_runs",- "columnsFrom": ["run_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "run_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -15514,8 +16924,14 @@"name": "expertise_domain_snapshots_run_domain_fk","tableFrom": "expertise_domain_snapshots","tableTo": "expertise_runs",- "columnsFrom": ["run_id", "domain_id"],- "columnsTo": ["id", "domain_id"],+ "columnsFrom": [+ "run_id",+ "domain_id"+ ],+ "columnsTo": [+ "id",+ "domain_id"+ ],"onDelete": "no action","onUpdate": "no action"}@@ -15800,8 +17216,12 @@"name": "expertise_domains_user_id_users_id_fk","tableFrom": "expertise_domains","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -15809,8 +17229,12 @@"name": "expertise_domains_workspace_id_workspaces_id_fk","tableFrom": "expertise_domains","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -15818,8 +17242,12 @@"name": "expertise_domains_parent_domain_id_expertise_domains_id_fk","tableFrom": "expertise_domains","tableTo": "expertise_domains",- "columnsFrom": ["parent_domain_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "parent_domain_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -15827,8 +17255,12 @@"name": "expertise_domains_canon_document_id_documents_id_fk","tableFrom": "expertise_domains","tableTo": "documents",- "columnsFrom": ["canon_document_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "canon_document_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -15836,8 +17268,12 @@"name": "expertise_domains_lesson_base_document_id_documents_id_fk","tableFrom": "expertise_domains","tableTo": "documents",- "columnsFrom": ["lesson_base_document_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "lesson_base_document_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -15845,8 +17281,12 @@"name": "expertise_domains_anchor_chosen_by_user_id_users_id_fk","tableFrom": "expertise_domains","tableTo": "users",- "columnsFrom": ["anchor_chosen_by_user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "anchor_chosen_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -16055,8 +17495,12 @@"name": "expertise_hits_domain_id_expertise_domains_id_fk","tableFrom": "expertise_hits","tableTo": "expertise_domains",- "columnsFrom": ["domain_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "domain_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -16064,8 +17508,12 @@"name": "expertise_hits_evidence_id_verify_evidence_id_fk","tableFrom": "expertise_hits","tableTo": "verify_evidence",- "columnsFrom": ["evidence_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "evidence_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -16073,8 +17521,12 @@"name": "expertise_hits_operation_id_agent_operations_id_fk","tableFrom": "expertise_hits","tableTo": "agent_operations",- "columnsFrom": ["operation_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "operation_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -16082,8 +17534,12 @@"name": "expertise_hits_source_check_result_id_verify_check_results_id_fk","tableFrom": "expertise_hits","tableTo": "verify_check_results",- "columnsFrom": ["source_check_result_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "source_check_result_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -16091,8 +17547,12 @@"name": "expertise_hits_source_message_id_messages_id_fk","tableFrom": "expertise_hits","tableTo": "messages",- "columnsFrom": ["source_message_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "source_message_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -16100,8 +17560,14 @@"name": "expertise_hits_run_domain_fk","tableFrom": "expertise_hits","tableTo": "expertise_runs",- "columnsFrom": ["run_id", "domain_id"],- "columnsTo": ["id", "domain_id"],+ "columnsFrom": [+ "run_id",+ "domain_id"+ ],+ "columnsTo": [+ "id",+ "domain_id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -16109,8 +17575,14 @@"name": "expertise_hits_lesson_domain_fk","tableFrom": "expertise_hits","tableTo": "expertise_lessons",- "columnsFrom": ["lesson_id", "domain_id"],- "columnsTo": ["id", "domain_id"],+ "columnsFrom": [+ "lesson_id",+ "domain_id"+ ],+ "columnsTo": [+ "id",+ "domain_id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -16297,8 +17769,12 @@"name": "expertise_insights_domain_id_expertise_domains_id_fk","tableFrom": "expertise_insights","tableTo": "expertise_domains",- "columnsFrom": ["domain_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "domain_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -16306,8 +17782,12 @@"name": "expertise_insights_user_id_users_id_fk","tableFrom": "expertise_insights","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -16315,8 +17795,12 @@"name": "expertise_insights_workspace_id_workspaces_id_fk","tableFrom": "expertise_insights","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -16324,8 +17808,12 @@"name": "expertise_insights_generated_by_operation_id_agent_operations_id_fk","tableFrom": "expertise_insights","tableTo": "agent_operations",- "columnsFrom": ["generated_by_operation_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "generated_by_operation_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -16465,8 +17953,12 @@"name": "expertise_lesson_revisions_lesson_id_expertise_lessons_id_fk","tableFrom": "expertise_lesson_revisions","tableTo": "expertise_lessons",- "columnsFrom": ["lesson_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "lesson_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -16474,8 +17966,12 @@"name": "expertise_lesson_revisions_changed_by_user_id_users_id_fk","tableFrom": "expertise_lesson_revisions","tableTo": "users",- "columnsFrom": ["changed_by_user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "changed_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -16483,8 +17979,12 @@"name": "expertise_lesson_revisions_operation_id_agent_operations_id_fk","tableFrom": "expertise_lesson_revisions","tableTo": "agent_operations",- "columnsFrom": ["operation_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "operation_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -16818,8 +18318,12 @@"name": "expertise_lessons_domain_id_expertise_domains_id_fk","tableFrom": "expertise_lessons","tableTo": "expertise_domains",- "columnsFrom": ["domain_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "domain_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -16827,8 +18331,12 @@"name": "expertise_lessons_created_by_user_id_users_id_fk","tableFrom": "expertise_lessons","tableTo": "users",- "columnsFrom": ["created_by_user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "created_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -16836,8 +18344,12 @@"name": "expertise_lessons_salvaged_from_id_expertise_lessons_id_fk","tableFrom": "expertise_lessons","tableTo": "expertise_lessons",- "columnsFrom": ["salvaged_from_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "salvaged_from_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -16845,8 +18357,12 @@"name": "expertise_lessons_compiled_criterion_id_verify_criteria_id_fk","tableFrom": "expertise_lessons","tableTo": "verify_criteria",- "columnsFrom": ["compiled_criterion_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "compiled_criterion_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -16856,7 +18372,10 @@"expertise_lessons_id_domain_unique": {"name": "expertise_lessons_id_domain_unique","nullsNotDistinct": false,- "columns": ["id", "domain_id"]+ "columns": [+ "id",+ "domain_id"+ ]}},"policies": {},@@ -17123,8 +18642,12 @@"name": "expertise_runs_domain_id_expertise_domains_id_fk","tableFrom": "expertise_runs","tableTo": "expertise_domains",- "columnsFrom": ["domain_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "domain_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -17132,8 +18655,12 @@"name": "expertise_runs_user_id_users_id_fk","tableFrom": "expertise_runs","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -17141,8 +18668,12 @@"name": "expertise_runs_workspace_id_workspaces_id_fk","tableFrom": "expertise_runs","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -17152,7 +18683,10 @@"expertise_runs_id_domain_unique": {"name": "expertise_runs_id_domain_unique","nullsNotDistinct": false,- "columns": ["id", "domain_id"]+ "columns": [+ "id",+ "domain_id"+ ]}},"policies": {},@@ -17340,8 +18874,12 @@"name": "user_favorites_user_id_users_id_fk","tableFrom": "user_favorites","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -17349,8 +18887,12 @@"name": "user_favorites_workspace_id_workspaces_id_fk","tableFrom": "user_favorites","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -17745,8 +19287,12 @@"name": "documents_file_id_files_id_fk","tableFrom": "documents","tableTo": "files",- "columnsFrom": ["file_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "file_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -17754,8 +19300,12 @@"name": "documents_knowledge_base_id_knowledge_bases_id_fk","tableFrom": "documents","tableTo": "knowledge_bases",- "columnsFrom": ["knowledge_base_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "knowledge_base_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -17763,8 +19313,12 @@"name": "documents_parent_id_documents_id_fk","tableFrom": "documents","tableTo": "documents",- "columnsFrom": ["parent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "parent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -17772,8 +19326,12 @@"name": "documents_user_id_users_id_fk","tableFrom": "documents","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -17781,8 +19339,12 @@"name": "documents_workspace_id_workspaces_id_fk","tableFrom": "documents","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -17999,8 +19561,12 @@"name": "file_uploads_user_id_users_id_fk","tableFrom": "file_uploads","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -18008,8 +19574,12 @@"name": "file_uploads_workspace_id_workspaces_id_fk","tableFrom": "file_uploads","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -18017,8 +19587,12 @@"name": "file_uploads_file_id_files_id_fk","tableFrom": "file_uploads","tableTo": "files",- "columnsFrom": ["file_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "file_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -18303,8 +19877,12 @@"name": "files_user_id_users_id_fk","tableFrom": "files","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -18312,8 +19890,12 @@"name": "files_file_hash_global_files_hash_id_fk","tableFrom": "files","tableTo": "global_files",- "columnsFrom": ["file_hash"],- "columnsTo": ["hash_id"],+ "columnsFrom": [+ "file_hash"+ ],+ "columnsTo": [+ "hash_id"+ ],"onDelete": "no action","onUpdate": "no action"},@@ -18321,8 +19903,12 @@"name": "files_parent_id_documents_id_fk","tableFrom": "files","tableTo": "documents",- "columnsFrom": ["parent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "parent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -18330,8 +19916,12 @@"name": "files_chunk_task_id_async_tasks_id_fk","tableFrom": "files","tableTo": "async_tasks",- "columnsFrom": ["chunk_task_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "chunk_task_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -18339,8 +19929,12 @@"name": "files_embedding_task_id_async_tasks_id_fk","tableFrom": "files","tableTo": "async_tasks",- "columnsFrom": ["embedding_task_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "embedding_task_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -18348,8 +19942,12 @@"name": "files_workspace_id_workspaces_id_fk","tableFrom": "files","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -18437,8 +20035,12 @@"name": "global_files_creator_users_id_fk","tableFrom": "global_files","tableTo": "users",- "columnsFrom": ["creator"],- "columnsTo": ["id"],+ "columnsFrom": [+ "creator"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -18552,8 +20154,12 @@"name": "knowledge_base_files_knowledge_base_id_knowledge_bases_id_fk","tableFrom": "knowledge_base_files","tableTo": "knowledge_bases",- "columnsFrom": ["knowledge_base_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "knowledge_base_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -18561,8 +20167,12 @@"name": "knowledge_base_files_file_id_files_id_fk","tableFrom": "knowledge_base_files","tableTo": "files",- "columnsFrom": ["file_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "file_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -18570,8 +20180,12 @@"name": "knowledge_base_files_user_id_users_id_fk","tableFrom": "knowledge_base_files","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -18579,8 +20193,12 @@"name": "knowledge_base_files_workspace_id_workspaces_id_fk","tableFrom": "knowledge_base_files","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -18588,7 +20206,10 @@"compositePrimaryKeys": {"knowledge_base_files_knowledge_base_id_file_id_pk": {"name": "knowledge_base_files_knowledge_base_id_file_id_pk",- "columns": ["knowledge_base_id", "file_id"]+ "columns": [+ "knowledge_base_id",+ "file_id"+ ]}},"uniqueConstraints": {},@@ -18787,8 +20408,12 @@"name": "knowledge_bases_user_id_users_id_fk","tableFrom": "knowledge_bases","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -18796,8 +20421,182 @@"name": "knowledge_bases_workspace_id_workspaces_id_fk","tableFrom": "knowledge_bases","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.file_shares": {+ "name": "file_shares",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "file_id": {+ "name": "file_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "page_view_count": {+ "name": "page_view_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'private'"+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "file_shares_file_id_unique": {+ "name": "file_shares_file_id_unique",+ "columns": [+ {+ "expression": "file_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "file_shares_user_id_idx": {+ "name": "file_shares_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "file_shares_workspace_id_idx": {+ "name": "file_shares_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "file_shares_file_id_files_id_fk": {+ "name": "file_shares_file_id_files_id_fk",+ "tableFrom": "file_shares",+ "tableTo": "files",+ "columnsFrom": [+ "file_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "file_shares_user_id_users_id_fk": {+ "name": "file_shares_user_id_users_id_fk",+ "tableFrom": "file_shares",+ "tableTo": "users",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "file_shares_workspace_id_workspaces_id_fk": {+ "name": "file_shares_workspace_id_workspaces_id_fk",+ "tableFrom": "file_shares",+ "tableTo": "workspaces",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -19163,8 +20962,12 @@"name": "generation_batches_user_id_users_id_fk","tableFrom": "generation_batches","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -19172,8 +20975,12 @@"name": "generation_batches_workspace_id_workspaces_id_fk","tableFrom": "generation_batches","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -19181,8 +20988,12 @@"name": "generation_batches_generation_topic_id_generation_topics_id_fk","tableFrom": "generation_batches","tableTo": "generation_topics",- "columnsFrom": ["generation_topic_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "generation_topic_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -19339,8 +21150,12 @@"name": "generation_topics_user_id_users_id_fk","tableFrom": "generation_topics","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -19348,8 +21163,12 @@"name": "generation_topics_workspace_id_workspaces_id_fk","tableFrom": "generation_topics","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -19513,8 +21332,12 @@"name": "generations_user_id_users_id_fk","tableFrom": "generations","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -19522,8 +21345,12 @@"name": "generations_workspace_id_workspaces_id_fk","tableFrom": "generations","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -19531,8 +21358,12 @@"name": "generations_generation_batch_id_generation_batches_id_fk","tableFrom": "generations","tableTo": "generation_batches",- "columnsFrom": ["generation_batch_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "generation_batch_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -19540,8 +21371,12 @@"name": "generations_async_task_id_async_tasks_id_fk","tableFrom": "generations","tableTo": "async_tasks",- "columnsFrom": ["async_task_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "async_task_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -19549,8 +21384,12 @@"name": "generations_file_id_files_id_fk","tableFrom": "generations","tableTo": "files",- "columnsFrom": ["file_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "file_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -19656,6 +21495,19 @@"primaryKey": false,"notNull": false},+ "archived_at": {+ "name": "archived_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'public'"+ },"deleted_at": {"name": "deleted_at","type": "timestamp with time zone",@@ -19714,6 +21566,33 @@"method": "btree","with": {}},+ "goals_workspace_visibility_idx": {+ "name": "goals_workspace_visibility_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "visibility",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },"goals_agent_id_idx": {"name": "goals_agent_id_idx","columns": [@@ -19786,8 +21665,12 @@"name": "goals_user_id_users_id_fk","tableFrom": "goals","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -19795,8 +21678,12 @@"name": "goals_workspace_id_workspaces_id_fk","tableFrom": "goals","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -19804,8 +21691,12 @@"name": "goals_agent_id_agents_id_fk","tableFrom": "goals","tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -19813,8 +21704,12 @@"name": "goals_project_id_projects_id_fk","tableFrom": "goals","tableTo": "projects",- "columnsFrom": ["project_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -19932,8 +21827,12 @@"name": "goal_edges_goal_id_goals_id_fk","tableFrom": "goal_edges","tableTo": "goals",- "columnsFrom": ["goal_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "goal_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -19941,8 +21840,14 @@"name": "goal_edges_goal_source_node_fk","tableFrom": "goal_edges","tableTo": "goal_nodes",- "columnsFrom": ["goal_id", "source_node_id"],- "columnsTo": ["goal_id", "id"],+ "columnsFrom": [+ "goal_id",+ "source_node_id"+ ],+ "columnsTo": [+ "goal_id",+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -19950,8 +21855,14 @@"name": "goal_edges_goal_target_node_fk","tableFrom": "goal_edges","tableTo": "goal_nodes",- "columnsFrom": ["goal_id", "target_node_id"],- "columnsTo": ["goal_id", "id"],+ "columnsFrom": [+ "goal_id",+ "target_node_id"+ ],+ "columnsTo": [+ "goal_id",+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -20119,8 +22030,12 @@"name": "goal_events_goal_id_goals_id_fk","tableFrom": "goal_events","tableTo": "goals",- "columnsFrom": ["goal_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "goal_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -20128,8 +22043,12 @@"name": "goal_events_task_id_tasks_id_fk","tableFrom": "goal_events","tableTo": "tasks",- "columnsFrom": ["task_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "task_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -20331,8 +22250,12 @@"name": "goal_node_decisions_node_id_goal_nodes_id_fk","tableFrom": "goal_node_decisions","tableTo": "goal_nodes",- "columnsFrom": ["node_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "node_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -20340,8 +22263,12 @@"name": "goal_node_decisions_requested_user_id_users_id_fk","tableFrom": "goal_node_decisions","tableTo": "users",- "columnsFrom": ["requested_user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "requested_user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -20349,8 +22276,12 @@"name": "goal_node_decisions_resolved_by_user_id_users_id_fk","tableFrom": "goal_node_decisions","tableTo": "users",- "columnsFrom": ["resolved_by_user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "resolved_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -20358,8 +22289,12 @@"name": "goal_node_decisions_resolved_by_agent_id_agents_id_fk","tableFrom": "goal_node_decisions","tableTo": "agents",- "columnsFrom": ["resolved_by_agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "resolved_by_agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -20456,8 +22391,12 @@"name": "goal_node_work_versions_node_id_goal_nodes_id_fk","tableFrom": "goal_node_work_versions","tableTo": "goal_nodes",- "columnsFrom": ["node_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "node_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -20465,8 +22404,12 @@"name": "goal_node_work_versions_work_version_id_work_versions_id_fk","tableFrom": "goal_node_work_versions","tableTo": "work_versions",- "columnsFrom": ["work_version_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "work_version_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -20658,8 +22601,12 @@"name": "goal_nodes_goal_id_goals_id_fk","tableFrom": "goal_nodes","tableTo": "goals",- "columnsFrom": ["goal_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "goal_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -20667,8 +22614,12 @@"name": "goal_nodes_task_id_tasks_id_fk","tableFrom": "goal_nodes","tableTo": "tasks",- "columnsFrom": ["task_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "task_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -20676,8 +22627,12 @@"name": "goal_nodes_created_by_user_id_users_id_fk","tableFrom": "goal_nodes","tableTo": "users",- "columnsFrom": ["created_by_user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "created_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -20685,8 +22640,12 @@"name": "goal_nodes_created_by_agent_id_agents_id_fk","tableFrom": "goal_nodes","tableTo": "agents",- "columnsFrom": ["created_by_agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -20696,7 +22655,10 @@"goal_nodes_goal_id_id_unique": {"name": "goal_nodes_goal_id_id_unique","nullsNotDistinct": false,- "columns": ["goal_id", "id"]+ "columns": [+ "goal_id",+ "id"+ ]}},"policies": {},@@ -20708,6 +22670,176 @@},"isRLSEnabled": false},+ "public.goal_shares": {+ "name": "goal_shares",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "goal_id": {+ "name": "goal_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "page_view_count": {+ "name": "page_view_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'private'"+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "goal_shares_goal_id_unique": {+ "name": "goal_shares_goal_id_unique",+ "columns": [+ {+ "expression": "goal_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "goal_shares_user_id_idx": {+ "name": "goal_shares_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "goal_shares_workspace_id_idx": {+ "name": "goal_shares_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "goal_shares_goal_id_goals_id_fk": {+ "name": "goal_shares_goal_id_goals_id_fk",+ "tableFrom": "goal_shares",+ "tableTo": "goals",+ "columnsFrom": [+ "goal_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "goal_shares_user_id_users_id_fk": {+ "name": "goal_shares_user_id_users_id_fk",+ "tableFrom": "goal_shares",+ "tableTo": "users",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "goal_shares_workspace_id_workspaces_id_fk": {+ "name": "goal_shares_workspace_id_workspaces_id_fk",+ "tableFrom": "goal_shares",+ "tableTo": "workspaces",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },"public.goal_subscriptions": {"name": "goal_subscriptions","schema": "",@@ -20996,8 +23128,12 @@"name": "goal_subscriptions_goal_id_goals_id_fk","tableFrom": "goal_subscriptions","tableTo": "goals",- "columnsFrom": ["goal_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "goal_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -21005,8 +23141,12 @@"name": "goal_subscriptions_widget_id_widgets_id_fk","tableFrom": "goal_subscriptions","tableTo": "widgets",- "columnsFrom": ["widget_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "widget_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -21014,8 +23154,12 @@"name": "goal_subscriptions_metric_id_metrics_id_fk","tableFrom": "goal_subscriptions","tableTo": "metrics",- "columnsFrom": ["metric_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "metric_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -21023,8 +23167,12 @@"name": "goal_subscriptions_user_id_users_id_fk","tableFrom": "goal_subscriptions","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -21032,8 +23180,12 @@"name": "goal_subscriptions_workspace_id_workspaces_id_fk","tableFrom": "goal_subscriptions","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -21041,8 +23193,12 @@"name": "goal_subscriptions_confirmed_version_id_widget_versions_id_fk","tableFrom": "goal_subscriptions","tableTo": "widget_versions",- "columnsFrom": ["confirmed_version_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "confirmed_version_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -21228,8 +23384,12 @@"name": "goal_traces_goal_id_goals_id_fk","tableFrom": "goal_traces","tableTo": "goals",- "columnsFrom": ["goal_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "goal_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -21427,8 +23587,12 @@"name": "linear_connections_user_id_users_id_fk","tableFrom": "linear_connections","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -21436,8 +23600,12 @@"name": "linear_connections_workspace_id_workspaces_id_fk","tableFrom": "linear_connections","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -21614,8 +23782,12 @@"name": "linear_sync_rules_project_id_projects_id_fk","tableFrom": "linear_sync_rules","tableTo": "projects",- "columnsFrom": ["project_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -21623,8 +23795,12 @@"name": "linear_sync_rules_connection_id_linear_connections_id_fk","tableFrom": "linear_sync_rules","tableTo": "linear_connections",- "columnsFrom": ["connection_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "connection_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -21632,8 +23808,12 @@"name": "linear_sync_rules_user_id_users_id_fk","tableFrom": "linear_sync_rules","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -21641,8 +23821,12 @@"name": "linear_sync_rules_workspace_id_workspaces_id_fk","tableFrom": "linear_sync_rules","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -22062,8 +24246,12 @@"name": "llm_generation_tracing_workspace_id_workspaces_id_fk","tableFrom": "llm_generation_tracing","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -22155,8 +24343,12 @@"name": "message_chunks_message_id_messages_id_fk","tableFrom": "message_chunks","tableTo": "messages",- "columnsFrom": ["message_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "message_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -22164,8 +24356,12 @@"name": "message_chunks_chunk_id_chunks_id_fk","tableFrom": "message_chunks","tableTo": "chunks",- "columnsFrom": ["chunk_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "chunk_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -22173,8 +24369,12 @@"name": "message_chunks_user_id_users_id_fk","tableFrom": "message_chunks","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -22182,8 +24382,12 @@"name": "message_chunks_workspace_id_workspaces_id_fk","tableFrom": "message_chunks","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -22191,7 +24395,10 @@"compositePrimaryKeys": {"message_chunks_chunk_id_message_id_pk": {"name": "message_chunks_chunk_id_message_id_pk",- "columns": ["chunk_id", "message_id"]+ "columns": [+ "chunk_id",+ "message_id"+ ]}},"uniqueConstraints": {},@@ -22421,8 +24628,12 @@"name": "message_groups_topic_id_topics_id_fk","tableFrom": "message_groups","tableTo": "topics",- "columnsFrom": ["topic_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "topic_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -22430,8 +24641,12 @@"name": "message_groups_user_id_users_id_fk","tableFrom": "message_groups","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -22439,8 +24654,12 @@"name": "message_groups_workspace_id_workspaces_id_fk","tableFrom": "message_groups","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -22448,8 +24667,12 @@"name": "message_groups_parent_group_id_message_groups_id_fk","tableFrom": "message_groups","tableTo": "message_groups",- "columnsFrom": ["parent_group_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "parent_group_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -22457,8 +24680,12 @@"name": "message_groups_parent_message_id_messages_id_fk","tableFrom": "message_groups","tableTo": "messages",- "columnsFrom": ["parent_message_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "parent_message_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -22620,8 +24847,12 @@"name": "message_plugins_id_messages_id_fk","tableFrom": "message_plugins","tableTo": "messages",- "columnsFrom": ["id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -22629,8 +24860,12 @@"name": "message_plugins_user_id_users_id_fk","tableFrom": "message_plugins","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -22638,8 +24873,12 @@"name": "message_plugins_workspace_id_workspaces_id_fk","tableFrom": "message_plugins","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -22792,8 +25031,12 @@"name": "message_queries_message_id_messages_id_fk","tableFrom": "message_queries","tableTo": "messages",- "columnsFrom": ["message_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "message_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -22801,8 +25044,12 @@"name": "message_queries_user_id_users_id_fk","tableFrom": "message_queries","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -22810,8 +25057,12 @@"name": "message_queries_workspace_id_workspaces_id_fk","tableFrom": "message_queries","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -22819,8 +25070,12 @@"name": "message_queries_embeddings_id_embeddings_id_fk","tableFrom": "message_queries","tableTo": "embeddings",- "columnsFrom": ["embeddings_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "embeddings_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -22939,8 +25194,12 @@"name": "message_query_chunks_id_messages_id_fk","tableFrom": "message_query_chunks","tableTo": "messages",- "columnsFrom": ["id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -22948,8 +25207,12 @@"name": "message_query_chunks_query_id_message_queries_id_fk","tableFrom": "message_query_chunks","tableTo": "message_queries",- "columnsFrom": ["query_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "query_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -22957,8 +25220,12 @@"name": "message_query_chunks_chunk_id_chunks_id_fk","tableFrom": "message_query_chunks","tableTo": "chunks",- "columnsFrom": ["chunk_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "chunk_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -22966,8 +25233,12 @@"name": "message_query_chunks_user_id_users_id_fk","tableFrom": "message_query_chunks","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -22975,8 +25246,12 @@"name": "message_query_chunks_workspace_id_workspaces_id_fk","tableFrom": "message_query_chunks","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -22984,7 +25259,11 @@"compositePrimaryKeys": {"message_query_chunks_chunk_id_id_query_id_pk": {"name": "message_query_chunks_chunk_id_id_query_id_pk",- "columns": ["chunk_id", "id", "query_id"]+ "columns": [+ "chunk_id",+ "id",+ "query_id"+ ]}},"uniqueConstraints": {},@@ -23097,8 +25376,12 @@"name": "message_tts_id_messages_id_fk","tableFrom": "message_tts","tableTo": "messages",- "columnsFrom": ["id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -23106,8 +25389,12 @@"name": "message_tts_file_id_files_id_fk","tableFrom": "message_tts","tableTo": "files",- "columnsFrom": ["file_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "file_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -23115,8 +25402,12 @@"name": "message_tts_user_id_users_id_fk","tableFrom": "message_tts","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -23124,8 +25415,12 @@"name": "message_tts_workspace_id_workspaces_id_fk","tableFrom": "message_tts","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -23241,8 +25536,12 @@"name": "message_translates_id_messages_id_fk","tableFrom": "message_translates","tableTo": "messages",- "columnsFrom": ["id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -23250,8 +25549,12 @@"name": "message_translates_user_id_users_id_fk","tableFrom": "message_translates","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -23259,8 +25562,12 @@"name": "message_translates_workspace_id_workspaces_id_fk","tableFrom": "message_translates","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -23722,8 +26029,12 @@"name": "messages_user_id_users_id_fk","tableFrom": "messages","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -23731,8 +26042,12 @@"name": "messages_session_id_sessions_id_fk","tableFrom": "messages","tableTo": "sessions",- "columnsFrom": ["session_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "session_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -23740,8 +26055,12 @@"name": "messages_topic_id_topics_id_fk","tableFrom": "messages","tableTo": "topics",- "columnsFrom": ["topic_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "topic_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -23749,8 +26068,12 @@"name": "messages_thread_id_threads_id_fk","tableFrom": "messages","tableTo": "threads",- "columnsFrom": ["thread_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "thread_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -23758,8 +26081,12 @@"name": "messages_parent_id_messages_id_fk","tableFrom": "messages","tableTo": "messages",- "columnsFrom": ["parent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "parent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -23767,8 +26094,12 @@"name": "messages_quota_id_messages_id_fk","tableFrom": "messages","tableTo": "messages",- "columnsFrom": ["quota_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "quota_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -23776,8 +26107,12 @@"name": "messages_agent_id_agents_id_fk","tableFrom": "messages","tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -23785,8 +26120,12 @@"name": "messages_group_id_chat_groups_id_fk","tableFrom": "messages","tableTo": "chat_groups",- "columnsFrom": ["group_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "group_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -23794,8 +26133,12 @@"name": "messages_message_group_id_message_groups_id_fk","tableFrom": "messages","tableTo": "message_groups",- "columnsFrom": ["message_group_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "message_group_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -23803,8 +26146,12 @@"name": "messages_workspace_id_workspaces_id_fk","tableFrom": "messages","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -23896,8 +26243,12 @@"name": "messages_files_file_id_files_id_fk","tableFrom": "messages_files","tableTo": "files",- "columnsFrom": ["file_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "file_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -23905,8 +26256,12 @@"name": "messages_files_message_id_messages_id_fk","tableFrom": "messages_files","tableTo": "messages",- "columnsFrom": ["message_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "message_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -23914,8 +26269,12 @@"name": "messages_files_user_id_users_id_fk","tableFrom": "messages_files","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -23923,8 +26282,12 @@"name": "messages_files_workspace_id_workspaces_id_fk","tableFrom": "messages_files","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -23932,7 +26295,10 @@"compositePrimaryKeys": {"messages_files_file_id_message_id_pk": {"name": "messages_files_file_id_message_id_pk",- "columns": ["file_id", "message_id"]+ "columns": [+ "file_id",+ "message_id"+ ]}},"uniqueConstraints": {},@@ -24147,8 +26513,12 @@"name": "messenger_account_links_user_id_users_id_fk","tableFrom": "messenger_account_links","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -24156,8 +26526,12 @@"name": "messenger_account_links_workspace_id_workspaces_id_fk","tableFrom": "messenger_account_links","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -24165,8 +26539,12 @@"name": "messenger_account_links_active_agent_id_agents_id_fk","tableFrom": "messenger_account_links","tableTo": "agents",- "columnsFrom": ["active_agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "active_agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -24341,8 +26719,12 @@"name": "messenger_installations_installed_by_user_id_users_id_fk","tableFrom": "messenger_installations","tableTo": "users",- "columnsFrom": ["installed_by_user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "installed_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -24490,8 +26872,12 @@"name": "metric_points_metric_id_metrics_id_fk","tableFrom": "metric_points","tableTo": "metrics",- "columnsFrom": ["metric_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "metric_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -24499,8 +26885,12 @@"name": "metric_points_user_id_users_id_fk","tableFrom": "metric_points","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -24508,8 +26898,12 @@"name": "metric_points_workspace_id_workspaces_id_fk","tableFrom": "metric_points","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -24682,8 +27076,12 @@"name": "metrics_user_id_users_id_fk","tableFrom": "metrics","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -24691,8 +27089,12 @@"name": "metrics_workspace_id_workspaces_id_fk","tableFrom": "metrics","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -24796,8 +27198,12 @@"name": "nextauth_accounts_user_id_users_id_fk","tableFrom": "nextauth_accounts","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -24805,7 +27211,10 @@"compositePrimaryKeys": {"nextauth_accounts_provider_providerAccountId_pk": {"name": "nextauth_accounts_provider_providerAccountId_pk",- "columns": ["provider", "providerAccountId"]+ "columns": [+ "provider",+ "providerAccountId"+ ]}},"uniqueConstraints": {},@@ -24872,8 +27281,12 @@"name": "nextauth_authenticators_user_id_users_id_fk","tableFrom": "nextauth_authenticators","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -24881,14 +27294,19 @@"compositePrimaryKeys": {"nextauth_authenticators_user_id_credentialID_pk": {"name": "nextauth_authenticators_user_id_credentialID_pk",- "columns": ["user_id", "credentialID"]+ "columns": [+ "user_id",+ "credentialID"+ ]}},"uniqueConstraints": {"nextauth_authenticators_credentialID_unique": {"name": "nextauth_authenticators_credentialID_unique","nullsNotDistinct": false,- "columns": ["credentialID"]+ "columns": [+ "credentialID"+ ]}},"policies": {},@@ -24940,8 +27358,12 @@"name": "nextauth_sessions_user_id_users_id_fk","tableFrom": "nextauth_sessions","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -24980,7 +27402,10 @@"compositePrimaryKeys": {"nextauth_verificationtokens_identifier_token_pk": {"name": "nextauth_verificationtokens_identifier_token_pk",- "columns": ["identifier", "token"]+ "columns": [+ "identifier",+ "token"+ ]}},"uniqueConstraints": {},@@ -25095,8 +27520,12 @@"name": "notification_deliveries_notification_id_notifications_id_fk","tableFrom": "notification_deliveries","tableTo": "notifications",- "columnsFrom": ["notification_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "notification_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -25352,8 +27781,12 @@"name": "notifications_user_id_users_id_fk","tableFrom": "notifications","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -25361,8 +27794,12 @@"name": "notifications_workspace_id_workspaces_id_fk","tableFrom": "notifications","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -25515,8 +27952,12 @@"name": "oidc_access_tokens_user_id_users_id_fk","tableFrom": "oidc_access_tokens","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -25617,8 +28058,12 @@"name": "oidc_authorization_codes_user_id_users_id_fk","tableFrom": "oidc_authorization_codes","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -25807,8 +28252,12 @@"name": "oidc_clients_user_id_users_id_fk","tableFrom": "oidc_clients","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -25816,8 +28265,12 @@"name": "oidc_clients_workspace_id_workspaces_id_fk","tableFrom": "oidc_clients","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -25884,8 +28337,12 @@"name": "oidc_consents_user_id_users_id_fk","tableFrom": "oidc_consents","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -25893,8 +28350,12 @@"name": "oidc_consents_client_id_oidc_clients_id_fk","tableFrom": "oidc_consents","tableTo": "oidc_clients",- "columnsFrom": ["client_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "client_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -25902,7 +28363,10 @@"compositePrimaryKeys": {"oidc_consents_user_id_client_id_pk": {"name": "oidc_consents_user_id_client_id_pk",- "columns": ["user_id", "client_id"]+ "columns": [+ "user_id",+ "client_id"+ ]}},"uniqueConstraints": {},@@ -26006,8 +28470,12 @@"name": "oidc_device_codes_user_id_users_id_fk","tableFrom": "oidc_device_codes","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -26102,8 +28570,12 @@"name": "oidc_grants_user_id_users_id_fk","tableFrom": "oidc_grants","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -26256,8 +28728,12 @@"name": "oidc_refresh_tokens_user_id_users_id_fk","tableFrom": "oidc_refresh_tokens","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -26340,8 +28816,12 @@"name": "oidc_sessions_user_id_users_id_fk","tableFrom": "oidc_sessions","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -26514,8 +28994,12 @@"name": "project_agents_project_id_projects_id_fk","tableFrom": "project_agents","tableTo": "projects",- "columnsFrom": ["project_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -26523,8 +29007,12 @@"name": "project_agents_agent_id_agents_id_fk","tableFrom": "project_agents","tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -26532,8 +29020,12 @@"name": "project_agents_added_by_user_id_users_id_fk","tableFrom": "project_agents","tableTo": "users",- "columnsFrom": ["added_by_user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "added_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -26541,8 +29033,12 @@"name": "project_agents_workspace_id_workspaces_id_fk","tableFrom": "project_agents","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -26715,8 +29211,12 @@"name": "project_chat_groups_project_id_projects_id_fk","tableFrom": "project_chat_groups","tableTo": "projects",- "columnsFrom": ["project_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -26724,8 +29224,12 @@"name": "project_chat_groups_chat_group_id_chat_groups_id_fk","tableFrom": "project_chat_groups","tableTo": "chat_groups",- "columnsFrom": ["chat_group_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "chat_group_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -26733,8 +29237,12 @@"name": "project_chat_groups_added_by_user_id_users_id_fk","tableFrom": "project_chat_groups","tableTo": "users",- "columnsFrom": ["added_by_user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "added_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -26742,8 +29250,12 @@"name": "project_chat_groups_workspace_id_workspaces_id_fk","tableFrom": "project_chat_groups","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -26902,8 +29414,12 @@"name": "project_completion_reviews_project_id_projects_id_fk","tableFrom": "project_completion_reviews","tableTo": "projects",- "columnsFrom": ["project_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -26911,8 +29427,12 @@"name": "project_completion_reviews_reviewer_user_id_users_id_fk","tableFrom": "project_completion_reviews","tableTo": "users",- "columnsFrom": ["reviewer_user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "reviewer_user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -26920,8 +29440,12 @@"name": "project_completion_reviews_workspace_id_workspaces_id_fk","tableFrom": "project_completion_reviews","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -27087,8 +29611,12 @@"name": "project_knowledge_bases_project_id_projects_id_fk","tableFrom": "project_knowledge_bases","tableTo": "projects",- "columnsFrom": ["project_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -27096,8 +29624,12 @@"name": "project_knowledge_bases_knowledge_base_id_knowledge_bases_id_fk","tableFrom": "project_knowledge_bases","tableTo": "knowledge_bases",- "columnsFrom": ["knowledge_base_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "knowledge_base_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -27105,8 +29637,12 @@"name": "project_knowledge_bases_added_by_user_id_users_id_fk","tableFrom": "project_knowledge_bases","tableTo": "users",- "columnsFrom": ["added_by_user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "added_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -27114,8 +29650,12 @@"name": "project_knowledge_bases_workspace_id_workspaces_id_fk","tableFrom": "project_knowledge_bases","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -27317,8 +29857,12 @@"name": "project_working_directories_project_id_projects_id_fk","tableFrom": "project_working_directories","tableTo": "projects",- "columnsFrom": ["project_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -27326,8 +29870,12 @@"name": "project_working_directories_device_id_devices_id_fk","tableFrom": "project_working_directories","tableTo": "devices",- "columnsFrom": ["device_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "device_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -27335,8 +29883,12 @@"name": "project_working_directories_workspace_id_workspaces_id_fk","tableFrom": "project_working_directories","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -27344,8 +29896,12 @@"name": "project_working_directories_added_by_user_id_users_id_fk","tableFrom": "project_working_directories","tableTo": "users",- "columnsFrom": ["added_by_user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "added_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -27731,8 +30287,12 @@"name": "projects_coordinator_agent_id_agents_id_fk","tableFrom": "projects","tableTo": "agents",- "columnsFrom": ["coordinator_agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "coordinator_agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -27740,8 +30300,12 @@"name": "projects_user_id_users_id_fk","tableFrom": "projects","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -27749,8 +30313,12 @@"name": "projects_workspace_id_workspaces_id_fk","tableFrom": "projects","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -27975,8 +30543,12 @@"name": "project_environments_project_id_projects_id_fk","tableFrom": "project_environments","tableTo": "projects",- "columnsFrom": ["project_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -27984,8 +30556,12 @@"name": "project_environments_environment_id_environments_id_fk","tableFrom": "project_environments","tableTo": "environments",- "columnsFrom": ["environment_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "environment_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "restrict","onUpdate": "no action"},@@ -27993,8 +30569,12 @@"name": "project_environments_workspace_id_workspaces_id_fk","tableFrom": "project_environments","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -28002,8 +30582,12 @@"name": "project_environments_added_by_user_id_users_id_fk","tableFrom": "project_environments","tableTo": "users",- "columnsFrom": ["added_by_user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "added_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -28011,8 +30595,14 @@"name": "project_environments_default_instance_fk","tableFrom": "project_environments","tableTo": "environment_instances",- "columnsFrom": ["environment_id", "default_instance_id"],- "columnsTo": ["environment_id", "id"],+ "columnsFrom": [+ "environment_id",+ "default_instance_id"+ ],+ "columnsTo": [+ "environment_id",+ "id"+ ],"onDelete": "restrict","onUpdate": "no action"}@@ -28150,8 +30740,12 @@"name": "project_members_project_id_projects_id_fk","tableFrom": "project_members","tableTo": "projects",- "columnsFrom": ["project_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -28159,8 +30753,12 @@"name": "project_members_user_id_users_id_fk","tableFrom": "project_members","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -28168,8 +30766,12 @@"name": "project_members_added_by_user_id_users_id_fk","tableFrom": "project_members","tableTo": "users",- "columnsFrom": ["added_by_user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "added_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -28285,8 +30887,12 @@"name": "project_sites_project_id_projects_id_fk","tableFrom": "project_sites","tableTo": "projects",- "columnsFrom": ["project_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -28294,8 +30900,12 @@"name": "project_sites_workspace_id_workspaces_id_fk","tableFrom": "project_sites","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -28303,8 +30913,12 @@"name": "project_sites_created_by_user_id_users_id_fk","tableFrom": "project_sites","tableTo": "users",- "columnsFrom": ["created_by_user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "created_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -28312,8 +30926,12 @@"name": "project_sites_acceptance_id_acceptances_id_fk","tableFrom": "project_sites","tableTo": "acceptances",- "columnsFrom": ["acceptance_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "acceptance_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -28476,8 +31094,12 @@"name": "project_works_project_id_projects_id_fk","tableFrom": "project_works","tableTo": "projects",- "columnsFrom": ["project_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -28485,8 +31107,12 @@"name": "project_works_work_id_works_id_fk","tableFrom": "project_works","tableTo": "works",- "columnsFrom": ["work_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "work_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -28494,8 +31120,12 @@"name": "project_works_added_by_user_id_users_id_fk","tableFrom": "project_works","tableTo": "users",- "columnsFrom": ["added_by_user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "added_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -28503,8 +31133,12 @@"name": "project_works_workspace_id_workspaces_id_fk","tableFrom": "project_works","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -28674,8 +31308,12 @@"name": "push_live_activities_user_id_users_id_fk","tableFrom": "push_live_activities","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -28823,8 +31461,12 @@"name": "push_tokens_user_id_users_id_fk","tableFrom": "push_tokens","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -28979,8 +31621,12 @@"name": "chunks_user_id_users_id_fk","tableFrom": "chunks","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -28988,8 +31634,12 @@"name": "chunks_workspace_id_workspaces_id_fk","tableFrom": "chunks","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -29109,8 +31759,12 @@"name": "document_chunks_document_id_documents_id_fk","tableFrom": "document_chunks","tableTo": "documents",- "columnsFrom": ["document_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -29118,8 +31772,12 @@"name": "document_chunks_chunk_id_chunks_id_fk","tableFrom": "document_chunks","tableTo": "chunks",- "columnsFrom": ["chunk_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "chunk_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -29127,8 +31785,12 @@"name": "document_chunks_user_id_users_id_fk","tableFrom": "document_chunks","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -29136,8 +31798,12 @@"name": "document_chunks_workspace_id_workspaces_id_fk","tableFrom": "document_chunks","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -29145,7 +31811,10 @@"compositePrimaryKeys": {"document_chunks_document_id_chunk_id_pk": {"name": "document_chunks_document_id_chunk_id_pk",- "columns": ["document_id", "chunk_id"]+ "columns": [+ "document_id",+ "chunk_id"+ ]}},"uniqueConstraints": {},@@ -29274,8 +31943,12 @@"name": "embeddings_chunk_id_chunks_id_fk","tableFrom": "embeddings","tableTo": "chunks",- "columnsFrom": ["chunk_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "chunk_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -29283,8 +31956,12 @@"name": "embeddings_user_id_users_id_fk","tableFrom": "embeddings","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -29292,8 +31969,12 @@"name": "embeddings_workspace_id_workspaces_id_fk","tableFrom": "embeddings","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -29303,7 +31984,9 @@"embeddings_chunk_id_unique": {"name": "embeddings_chunk_id_unique","nullsNotDistinct": false,- "columns": ["chunk_id"]+ "columns": [+ "chunk_id"+ ]}},"policies": {},@@ -29491,8 +32174,12 @@"name": "unstructured_chunks_composite_id_chunks_id_fk","tableFrom": "unstructured_chunks","tableTo": "chunks",- "columnsFrom": ["composite_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "composite_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -29500,8 +32187,12 @@"name": "unstructured_chunks_user_id_users_id_fk","tableFrom": "unstructured_chunks","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -29509,8 +32200,12 @@"name": "unstructured_chunks_workspace_id_workspaces_id_fk","tableFrom": "unstructured_chunks","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -29518,8 +32213,12 @@"name": "unstructured_chunks_file_id_files_id_fk","tableFrom": "unstructured_chunks","tableTo": "files",- "columnsFrom": ["file_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "file_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -29641,8 +32340,12 @@"name": "rag_eval_dataset_records_dataset_id_rag_eval_datasets_id_fk","tableFrom": "rag_eval_dataset_records","tableTo": "rag_eval_datasets",- "columnsFrom": ["dataset_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "dataset_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -29650,8 +32353,12 @@"name": "rag_eval_dataset_records_user_id_users_id_fk","tableFrom": "rag_eval_dataset_records","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -29659,8 +32366,12 @@"name": "rag_eval_dataset_records_workspace_id_workspaces_id_fk","tableFrom": "rag_eval_dataset_records","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -29770,8 +32481,12 @@"name": "rag_eval_datasets_knowledge_base_id_knowledge_bases_id_fk","tableFrom": "rag_eval_datasets","tableTo": "knowledge_bases",- "columnsFrom": ["knowledge_base_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "knowledge_base_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -29779,8 +32494,12 @@"name": "rag_eval_datasets_user_id_users_id_fk","tableFrom": "rag_eval_datasets","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -29788,8 +32507,12 @@"name": "rag_eval_datasets_workspace_id_workspaces_id_fk","tableFrom": "rag_eval_datasets","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -29935,8 +32658,12 @@"name": "rag_eval_evaluations_dataset_id_rag_eval_datasets_id_fk","tableFrom": "rag_eval_evaluations","tableTo": "rag_eval_datasets",- "columnsFrom": ["dataset_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "dataset_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -29944,8 +32671,12 @@"name": "rag_eval_evaluations_knowledge_base_id_knowledge_bases_id_fk","tableFrom": "rag_eval_evaluations","tableTo": "knowledge_bases",- "columnsFrom": ["knowledge_base_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "knowledge_base_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -29953,8 +32684,12 @@"name": "rag_eval_evaluations_user_id_users_id_fk","tableFrom": "rag_eval_evaluations","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -29962,8 +32697,12 @@"name": "rag_eval_evaluations_workspace_id_workspaces_id_fk","tableFrom": "rag_eval_evaluations","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -30127,8 +32866,12 @@"name": "rag_eval_evaluation_records_question_embedding_id_embeddings_id_fk","tableFrom": "rag_eval_evaluation_records","tableTo": "embeddings",- "columnsFrom": ["question_embedding_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "question_embedding_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -30136,8 +32879,12 @@"name": "rag_eval_evaluation_records_dataset_record_id_rag_eval_dataset_records_id_fk","tableFrom": "rag_eval_evaluation_records","tableTo": "rag_eval_dataset_records",- "columnsFrom": ["dataset_record_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "dataset_record_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -30145,8 +32892,12 @@"name": "rag_eval_evaluation_records_evaluation_id_rag_eval_evaluations_id_fk","tableFrom": "rag_eval_evaluation_records","tableTo": "rag_eval_evaluations",- "columnsFrom": ["evaluation_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "evaluation_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -30154,8 +32905,12 @@"name": "rag_eval_evaluation_records_user_id_users_id_fk","tableFrom": "rag_eval_evaluation_records","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -30163,8 +32918,12 @@"name": "rag_eval_evaluation_records_workspace_id_workspaces_id_fk","tableFrom": "rag_eval_evaluation_records","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -30245,7 +33004,9 @@"rbac_permissions_code_unique": {"name": "rbac_permissions_code_unique","nullsNotDistinct": false,- "columns": ["code"]+ "columns": [+ "code"+ ]}},"policies": {},@@ -30313,8 +33074,12 @@"name": "rbac_role_permissions_role_id_rbac_roles_id_fk","tableFrom": "rbac_role_permissions","tableTo": "rbac_roles",- "columnsFrom": ["role_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "role_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -30322,8 +33087,12 @@"name": "rbac_role_permissions_permission_id_rbac_permissions_id_fk","tableFrom": "rbac_role_permissions","tableTo": "rbac_permissions",- "columnsFrom": ["permission_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "permission_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -30331,7 +33100,10 @@"compositePrimaryKeys": {"rbac_role_permissions_role_id_permission_id_pk": {"name": "rbac_role_permissions_role_id_permission_id_pk",- "columns": ["role_id", "permission_id"]+ "columns": [+ "role_id",+ "permission_id"+ ]}},"uniqueConstraints": {},@@ -30459,8 +33231,12 @@"name": "rbac_roles_workspace_id_workspaces_id_fk","tableFrom": "rbac_roles","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -30593,8 +33369,12 @@"name": "rbac_user_roles_user_id_users_id_fk","tableFrom": "rbac_user_roles","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -30602,8 +33382,12 @@"name": "rbac_user_roles_role_id_rbac_roles_id_fk","tableFrom": "rbac_user_roles","tableTo": "rbac_roles",- "columnsFrom": ["role_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "role_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -30611,8 +33395,12 @@"name": "rbac_user_roles_workspace_id_workspaces_id_fk","tableFrom": "rbac_user_roles","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -30719,8 +33507,12 @@"name": "agents_to_sessions_agent_id_agents_id_fk","tableFrom": "agents_to_sessions","tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -30728,8 +33520,12 @@"name": "agents_to_sessions_session_id_sessions_id_fk","tableFrom": "agents_to_sessions","tableTo": "sessions",- "columnsFrom": ["session_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "session_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -30737,8 +33533,12 @@"name": "agents_to_sessions_user_id_users_id_fk","tableFrom": "agents_to_sessions","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -30746,8 +33546,12 @@"name": "agents_to_sessions_workspace_id_workspaces_id_fk","tableFrom": "agents_to_sessions","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -30755,7 +33559,10 @@"compositePrimaryKeys": {"agents_to_sessions_agent_id_session_id_pk": {"name": "agents_to_sessions_agent_id_session_id_pk",- "columns": ["agent_id", "session_id"]+ "columns": [+ "agent_id",+ "session_id"+ ]}},"uniqueConstraints": {},@@ -30866,8 +33673,12 @@"name": "file_chunks_file_id_files_id_fk","tableFrom": "file_chunks","tableTo": "files",- "columnsFrom": ["file_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "file_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -30875,8 +33686,12 @@"name": "file_chunks_chunk_id_chunks_id_fk","tableFrom": "file_chunks","tableTo": "chunks",- "columnsFrom": ["chunk_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "chunk_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -30884,8 +33699,12 @@"name": "file_chunks_user_id_users_id_fk","tableFrom": "file_chunks","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -30893,8 +33712,12 @@"name": "file_chunks_workspace_id_workspaces_id_fk","tableFrom": "file_chunks","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -30902,7 +33725,10 @@"compositePrimaryKeys": {"file_chunks_file_id_chunk_id_pk": {"name": "file_chunks_file_id_chunk_id_pk",- "columns": ["file_id", "chunk_id"]+ "columns": [+ "file_id",+ "chunk_id"+ ]}},"uniqueConstraints": {},@@ -31006,8 +33832,12 @@"name": "files_to_sessions_file_id_files_id_fk","tableFrom": "files_to_sessions","tableTo": "files",- "columnsFrom": ["file_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "file_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -31015,8 +33845,12 @@"name": "files_to_sessions_session_id_sessions_id_fk","tableFrom": "files_to_sessions","tableTo": "sessions",- "columnsFrom": ["session_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "session_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -31024,8 +33858,12 @@"name": "files_to_sessions_user_id_users_id_fk","tableFrom": "files_to_sessions","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -31033,8 +33871,12 @@"name": "files_to_sessions_workspace_id_workspaces_id_fk","tableFrom": "files_to_sessions","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -31042,7 +33884,10 @@"compositePrimaryKeys": {"files_to_sessions_file_id_session_id_pk": {"name": "files_to_sessions_file_id_session_id_pk",- "columns": ["file_id", "session_id"]+ "columns": [+ "file_id",+ "session_id"+ ]}},"uniqueConstraints": {},@@ -31275,8 +34120,12 @@"name": "resource_permissions_workspace_id_workspaces_id_fk","tableFrom": "resource_permissions","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -31284,8 +34133,12 @@"name": "resource_permissions_user_id_users_id_fk","tableFrom": "resource_permissions","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -31293,8 +34146,12 @@"name": "resource_permissions_created_by_users_id_fk","tableFrom": "resource_permissions","tableTo": "users",- "columnsFrom": ["created_by"],- "columnsTo": ["id"],+ "columnsFrom": [+ "created_by"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -31464,8 +34321,12 @@"name": "resource_transfer_requests_workspace_id_workspaces_id_fk","tableFrom": "resource_transfer_requests","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -31473,8 +34334,12 @@"name": "resource_transfer_requests_initiator_id_users_id_fk","tableFrom": "resource_transfer_requests","tableTo": "users",- "columnsFrom": ["initiator_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "initiator_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -31482,8 +34347,12 @@"name": "resource_transfer_requests_recipient_id_users_id_fk","tableFrom": "resource_transfer_requests","tableTo": "users",- "columnsFrom": ["recipient_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "recipient_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -31491,8 +34360,12 @@"name": "resource_transfer_requests_previous_owner_id_users_id_fk","tableFrom": "resource_transfer_requests","tableTo": "users",- "columnsFrom": ["previous_owner_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "previous_owner_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -31887,8 +34760,12 @@"name": "scm_change_requests_user_id_users_id_fk","tableFrom": "scm_change_requests","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -31896,8 +34773,12 @@"name": "scm_change_requests_workspace_id_workspaces_id_fk","tableFrom": "scm_change_requests","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -31905,8 +34786,12 @@"name": "scm_change_requests_installation_id_scm_installations_id_fk","tableFrom": "scm_change_requests","tableTo": "scm_installations",- "columnsFrom": ["installation_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "installation_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -31914,8 +34799,12 @@"name": "scm_change_requests_acceptance_id_acceptances_id_fk","tableFrom": "scm_change_requests","tableTo": "acceptances",- "columnsFrom": ["acceptance_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "acceptance_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -31923,8 +34812,12 @@"name": "scm_change_requests_work_id_works_id_fk","tableFrom": "scm_change_requests","tableTo": "works",- "columnsFrom": ["work_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "work_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -31932,8 +34825,12 @@"name": "scm_change_requests_topic_id_topics_id_fk","tableFrom": "scm_change_requests","tableTo": "topics",- "columnsFrom": ["topic_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "topic_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -31941,8 +34838,12 @@"name": "scm_change_requests_task_id_tasks_id_fk","tableFrom": "scm_change_requests","tableTo": "tasks",- "columnsFrom": ["task_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "task_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -32093,8 +34994,12 @@"name": "scm_identities_user_id_users_id_fk","tableFrom": "scm_identities","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -32303,8 +35208,12 @@"name": "scm_installations_user_id_users_id_fk","tableFrom": "scm_installations","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -32312,8 +35221,12 @@"name": "scm_installations_workspace_id_workspaces_id_fk","tableFrom": "scm_installations","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -32614,8 +35527,12 @@"name": "session_groups_user_id_users_id_fk","tableFrom": "session_groups","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -32623,8 +35540,12 @@"name": "session_groups_workspace_id_workspaces_id_fk","tableFrom": "session_groups","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -32894,8 +35815,12 @@"name": "sessions_user_id_users_id_fk","tableFrom": "sessions","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -32903,8 +35828,12 @@"name": "sessions_group_id_session_groups_id_fk","tableFrom": "sessions","tableTo": "session_groups",- "columnsFrom": ["group_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "group_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -32912,8 +35841,12 @@"name": "sessions_workspace_id_workspaces_id_fk","tableFrom": "sessions","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -33191,8 +36124,12 @@"name": "signals_user_id_users_id_fk","tableFrom": "signals","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -33200,8 +36137,12 @@"name": "signals_workspace_id_workspaces_id_fk","tableFrom": "signals","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -33209,8 +36150,12 @@"name": "signals_account_id_agent_accounts_id_fk","tableFrom": "signals","tableTo": "agent_accounts",- "columnsFrom": ["account_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "account_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -33218,8 +36163,12 @@"name": "signals_agent_id_agents_id_fk","tableFrom": "signals","tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -33314,8 +36263,12 @@"name": "signal_decision_labels_decision_id_signal_decisions_id_fk","tableFrom": "signal_decision_labels","tableTo": "signal_decisions",- "columnsFrom": ["decision_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "decision_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -33529,8 +36482,12 @@"name": "signal_decisions_signal_id_signals_id_fk","tableFrom": "signal_decisions","tableTo": "signals",- "columnsFrom": ["signal_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "signal_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -33538,8 +36495,12 @@"name": "signal_decisions_agent_id_agents_id_fk","tableFrom": "signal_decisions","tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -33547,8 +36508,12 @@"name": "signal_decisions_user_id_users_id_fk","tableFrom": "signal_decisions","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -33556,8 +36521,12 @@"name": "signal_decisions_workspace_id_workspaces_id_fk","tableFrom": "signal_decisions","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -33565,8 +36534,12 @@"name": "signal_decisions_topic_id_topics_id_fk","tableFrom": "signal_decisions","tableTo": "topics",- "columnsFrom": ["topic_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "topic_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -33947,8 +36920,12 @@"name": "briefs_user_id_users_id_fk","tableFrom": "briefs","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -33956,8 +36933,12 @@"name": "briefs_workspace_id_workspaces_id_fk","tableFrom": "briefs","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -33965,8 +36946,12 @@"name": "briefs_task_id_tasks_id_fk","tableFrom": "briefs","tableTo": "tasks",- "columnsFrom": ["task_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "task_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -33974,8 +36959,12 @@"name": "briefs_cron_job_id_agent_cron_jobs_id_fk","tableFrom": "briefs","tableTo": "agent_cron_jobs",- "columnsFrom": ["cron_job_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "cron_job_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -34133,8 +37122,12 @@"name": "task_activities_task_id_tasks_id_fk","tableFrom": "task_activities","tableTo": "tasks",- "columnsFrom": ["task_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "task_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -34142,8 +37135,12 @@"name": "task_activities_user_id_users_id_fk","tableFrom": "task_activities","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -34151,8 +37148,12 @@"name": "task_activities_workspace_id_workspaces_id_fk","tableFrom": "task_activities","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -34160,8 +37161,12 @@"name": "task_activities_actor_user_id_users_id_fk","tableFrom": "task_activities","tableTo": "users",- "columnsFrom": ["actor_user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "actor_user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -34169,8 +37174,12 @@"name": "task_activities_actor_agent_id_agents_id_fk","tableFrom": "task_activities","tableTo": "agents",- "columnsFrom": ["actor_agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "actor_agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -34413,8 +37422,12 @@"name": "task_comments_task_id_tasks_id_fk","tableFrom": "task_comments","tableTo": "tasks",- "columnsFrom": ["task_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "task_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -34422,8 +37435,12 @@"name": "task_comments_user_id_users_id_fk","tableFrom": "task_comments","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -34431,8 +37448,12 @@"name": "task_comments_workspace_id_workspaces_id_fk","tableFrom": "task_comments","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -34440,8 +37461,12 @@"name": "task_comments_author_user_id_users_id_fk","tableFrom": "task_comments","tableTo": "users",- "columnsFrom": ["author_user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "author_user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -34449,8 +37474,12 @@"name": "task_comments_author_agent_id_agents_id_fk","tableFrom": "task_comments","tableTo": "agents",- "columnsFrom": ["author_agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "author_agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -34458,8 +37487,12 @@"name": "task_comments_brief_id_briefs_id_fk","tableFrom": "task_comments","tableTo": "briefs",- "columnsFrom": ["brief_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "brief_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -34467,8 +37500,12 @@"name": "task_comments_topic_id_topics_id_fk","tableFrom": "task_comments","tableTo": "topics",- "columnsFrom": ["topic_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "topic_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -34657,8 +37694,12 @@"name": "task_dependencies_task_id_tasks_id_fk","tableFrom": "task_dependencies","tableTo": "tasks",- "columnsFrom": ["task_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "task_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -34666,8 +37707,12 @@"name": "task_dependencies_depends_on_id_tasks_id_fk","tableFrom": "task_dependencies","tableTo": "tasks",- "columnsFrom": ["depends_on_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "depends_on_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -34675,8 +37720,12 @@"name": "task_dependencies_user_id_users_id_fk","tableFrom": "task_dependencies","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -34684,8 +37733,12 @@"name": "task_dependencies_workspace_id_workspaces_id_fk","tableFrom": "task_dependencies","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -34868,8 +37921,12 @@"name": "task_documents_task_id_tasks_id_fk","tableFrom": "task_documents","tableTo": "tasks",- "columnsFrom": ["task_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "task_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -34877,8 +37934,12 @@"name": "task_documents_document_id_documents_id_fk","tableFrom": "task_documents","tableTo": "documents",- "columnsFrom": ["document_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -34886,8 +37947,12 @@"name": "task_documents_user_id_users_id_fk","tableFrom": "task_documents","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -34895,8 +37960,12 @@"name": "task_documents_workspace_id_workspaces_id_fk","tableFrom": "task_documents","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -35168,8 +38237,12 @@"name": "task_topics_task_id_tasks_id_fk","tableFrom": "task_topics","tableTo": "tasks",- "columnsFrom": ["task_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "task_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -35177,8 +38250,12 @@"name": "task_topics_topic_id_topics_id_fk","tableFrom": "task_topics","tableTo": "topics",- "columnsFrom": ["topic_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "topic_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -35186,8 +38263,12 @@"name": "task_topics_user_id_users_id_fk","tableFrom": "task_topics","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -35195,8 +38276,12 @@"name": "task_topics_workspace_id_workspaces_id_fk","tableFrom": "task_topics","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -35706,8 +38791,12 @@"name": "tasks_created_by_user_id_users_id_fk","tableFrom": "tasks","tableTo": "users",- "columnsFrom": ["created_by_user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "created_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -35715,8 +38804,12 @@"name": "tasks_workspace_id_workspaces_id_fk","tableFrom": "tasks","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -35724,8 +38817,12 @@"name": "tasks_project_id_projects_id_fk","tableFrom": "tasks","tableTo": "projects",- "columnsFrom": ["project_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -35733,8 +38830,12 @@"name": "tasks_created_by_agent_id_agents_id_fk","tableFrom": "tasks","tableTo": "agents",- "columnsFrom": ["created_by_agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "created_by_agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -35742,8 +38843,12 @@"name": "tasks_assignee_user_id_users_id_fk","tableFrom": "tasks","tableTo": "users",- "columnsFrom": ["assignee_user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "assignee_user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -35751,8 +38856,12 @@"name": "tasks_assignee_agent_id_agents_id_fk","tableFrom": "tasks","tableTo": "agents",- "columnsFrom": ["assignee_agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "assignee_agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -35760,8 +38869,12 @@"name": "tasks_current_topic_id_topics_id_fk","tableFrom": "tasks","tableTo": "topics",- "columnsFrom": ["current_topic_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "current_topic_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -35769,8 +38882,12 @@"name": "tasks_parent_task_id_tasks_id_fk","tableFrom": "tasks","tableTo": "tasks",- "columnsFrom": ["parent_task_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "parent_task_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -36002,8 +39119,12 @@"name": "task_external_links_task_id_tasks_id_fk","tableFrom": "task_external_links","tableTo": "tasks",- "columnsFrom": ["task_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "task_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -36011,8 +39132,12 @@"name": "task_external_links_user_id_users_id_fk","tableFrom": "task_external_links","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -36020,8 +39145,12 @@"name": "task_external_links_workspace_id_workspaces_id_fk","tableFrom": "task_external_links","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -36032,118 +39161,510 @@"checkConstraints": {},"isRLSEnabled": false},- "public.threads": {- "name": "threads",+ "public.task_label_links": {+ "name": "task_label_links","schema": "","columns": {"id": {"name": "id",- "type": "text",+ "type": "uuid","primaryKey": true,- "notNull": true- },- "title": {- "name": "title",- "type": "text",- "primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "gen_random_uuid()"},- "content": {- "name": "content",+ "task_id": {+ "name": "task_id","type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "editor_data": {- "name": "editor_data",- "type": "jsonb",+ "label_id": {+ "name": "label_id",+ "type": "uuid","primaryKey": false,- "notNull": false+ "notNull": true},- "type": {- "name": "type",+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,"notNull": true},- "status": {- "name": "status",+ "workspace_id": {+ "name": "workspace_id","type": "text","primaryKey": false,"notNull": false},- "topic_id": {- "name": "topic_id",- "type": "text",+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": true+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "task_label_links_task_id_label_id_unique": {+ "name": "task_label_links_task_id_label_id_unique",+ "columns": [+ {+ "expression": "task_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "label_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}},- "source_message_id": {- "name": "source_message_id",- "type": "text",- "primaryKey": false,- "notNull": false+ "task_label_links_label_id_idx": {+ "name": "task_label_links_label_id_idx",+ "columns": [+ {+ "expression": "label_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}},- "parent_thread_id": {- "name": "parent_thread_id",- "type": "text",- "primaryKey": false,- "notNull": false+ "task_label_links_user_id_idx": {+ "name": "task_label_links_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}},- "client_id": {- "name": "client_id",+ "task_label_links_workspace_id_idx": {+ "name": "task_label_links_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "task_label_links_task_id_tasks_id_fk": {+ "name": "task_label_links_task_id_tasks_id_fk",+ "tableFrom": "task_label_links",+ "tableTo": "tasks",+ "columnsFrom": [+ "task_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "task_label_links_label_id_task_labels_id_fk": {+ "name": "task_label_links_label_id_task_labels_id_fk",+ "tableFrom": "task_label_links",+ "tableTo": "task_labels",+ "columnsFrom": [+ "label_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "task_label_links_user_id_users_id_fk": {+ "name": "task_label_links_user_id_users_id_fk",+ "tableFrom": "task_label_links",+ "tableTo": "users",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "task_label_links_workspace_id_workspaces_id_fk": {+ "name": "task_label_links_workspace_id_workspaces_id_fk",+ "tableFrom": "task_label_links",+ "tableTo": "workspaces",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.task_labels": {+ "name": "task_labels",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,"notNull": false},- "agent_id": {- "name": "agent_id",+ "workspace_id": {+ "name": "workspace_id","type": "text","primaryKey": false,"notNull": false},- "group_id": {- "name": "group_id",- "type": "text",+ "parent_id": {+ "name": "parent_id",+ "type": "uuid","primaryKey": false,"notNull": false},- "metadata": {- "name": "metadata",- "type": "jsonb",+ "is_group": {+ "name": "is_group",+ "type": "boolean","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": false},- "user_id": {- "name": "user_id",+ "name": {+ "name": "name","type": "text","primaryKey": false,"notNull": true},- "last_active_at": {- "name": "last_active_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": false,- "default": "now()"- },- "workspace_id": {- "name": "workspace_id",+ "description": {+ "name": "description","type": "text","primaryKey": false,"notNull": false},- "deleted_at": {- "name": "deleted_at",- "type": "timestamp with time zone",+ "color": {+ "name": "color",+ "type": "text","primaryKey": false,"notNull": false},- "is_deleted": {- "name": "is_deleted",- "type": "boolean",+ "sort_order": {+ "name": "sort_order",+ "type": "integer","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": 0+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "task_labels_user_id_idx": {+ "name": "task_labels_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_labels_workspace_id_idx": {+ "name": "task_labels_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_labels_parent_id_idx": {+ "name": "task_labels_parent_id_idx",+ "columns": [+ {+ "expression": "parent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_labels_user_id_name_unique": {+ "name": "task_labels_user_id_name_unique",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "lower(\"name\")",+ "asc": true,+ "isExpression": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"task_labels\".\"workspace_id\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "task_labels_workspace_id_name_unique": {+ "name": "task_labels_workspace_id_name_unique",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "lower(\"name\")",+ "asc": true,+ "isExpression": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"task_labels\".\"workspace_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "task_labels_user_id_users_id_fk": {+ "name": "task_labels_user_id_users_id_fk",+ "tableFrom": "task_labels",+ "tableTo": "users",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "task_labels_workspace_id_workspaces_id_fk": {+ "name": "task_labels_workspace_id_workspaces_id_fk",+ "tableFrom": "task_labels",+ "tableTo": "workspaces",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "task_labels_parent_id_task_labels_id_fk": {+ "name": "task_labels_parent_id_task_labels_id_fk",+ "tableFrom": "task_labels",+ "tableTo": "task_labels",+ "columnsFrom": [+ "parent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.threads": {+ "name": "threads",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "editor_data": {+ "name": "editor_data",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "topic_id": {+ "name": "topic_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source_message_id": {+ "name": "source_message_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "parent_thread_id": {+ "name": "parent_thread_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "group_id": {+ "name": "group_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "last_active_at": {+ "name": "last_active_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "deleted_at": {+ "name": "deleted_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "is_deleted": {+ "name": "is_deleted",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false},"accessed_at": {"name": "accessed_at",@@ -36300,8 +39821,12 @@"name": "threads_topic_id_topics_id_fk","tableFrom": "threads","tableTo": "topics",- "columnsFrom": ["topic_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "topic_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -36309,8 +39834,12 @@"name": "threads_parent_thread_id_threads_id_fk","tableFrom": "threads","tableTo": "threads",- "columnsFrom": ["parent_thread_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "parent_thread_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -36318,8 +39847,12 @@"name": "threads_agent_id_agents_id_fk","tableFrom": "threads","tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -36327,8 +39860,12 @@"name": "threads_group_id_chat_groups_id_fk","tableFrom": "threads","tableTo": "chat_groups",- "columnsFrom": ["group_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "group_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -36336,8 +39873,12 @@"name": "threads_user_id_users_id_fk","tableFrom": "threads","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -36345,8 +39886,12 @@"name": "threads_workspace_id_workspaces_id_fk","tableFrom": "threads","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -36460,8 +40005,12 @@"name": "topic_documents_document_id_documents_id_fk","tableFrom": "topic_documents","tableTo": "documents",- "columnsFrom": ["document_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -36469,8 +40018,12 @@"name": "topic_documents_topic_id_topics_id_fk","tableFrom": "topic_documents","tableTo": "topics",- "columnsFrom": ["topic_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "topic_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -36478,8 +40031,12 @@"name": "topic_documents_user_id_users_id_fk","tableFrom": "topic_documents","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -36487,8 +40044,12 @@"name": "topic_documents_workspace_id_workspaces_id_fk","tableFrom": "topic_documents","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -36496,7 +40057,10 @@"compositePrimaryKeys": {"topic_documents_document_id_topic_id_pk": {"name": "topic_documents_document_id_topic_id_pk",- "columns": ["document_id", "topic_id"]+ "columns": [+ "document_id",+ "topic_id"+ ]}},"uniqueConstraints": {},@@ -36620,8 +40184,12 @@"name": "topic_shares_topic_id_topics_id_fk","tableFrom": "topic_shares","tableTo": "topics",- "columnsFrom": ["topic_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "topic_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -36629,8 +40197,12 @@"name": "topic_shares_user_id_users_id_fk","tableFrom": "topic_shares","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -36638,8 +40210,12 @@"name": "topic_shares_workspace_id_workspaces_id_fk","tableFrom": "topic_shares","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -37145,8 +40721,12 @@"name": "topics_session_id_sessions_id_fk","tableFrom": "topics","tableTo": "sessions",- "columnsFrom": ["session_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "session_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -37154,8 +40734,12 @@"name": "topics_agent_id_agents_id_fk","tableFrom": "topics","tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -37163,8 +40747,12 @@"name": "topics_group_id_chat_groups_id_fk","tableFrom": "topics","tableTo": "chat_groups",- "columnsFrom": ["group_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "group_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -37172,8 +40760,12 @@"name": "topics_project_id_projects_id_fk","tableFrom": "topics","tableTo": "projects",- "columnsFrom": ["project_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -37181,8 +40773,12 @@"name": "topics_project_working_directory_id_project_working_directories_id_fk","tableFrom": "topics","tableTo": "project_working_directories",- "columnsFrom": ["project_working_directory_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "project_working_directory_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -37190,8 +40786,12 @@"name": "topics_user_id_users_id_fk","tableFrom": "topics","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -37199,8 +40799,323 @@"name": "topics_workspace_id_workspaces_id_fk","tableFrom": "topics","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.topic_analyses": {+ "name": "topic_analyses",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "topic_id": {+ "name": "topic_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "taxonomy_version": {+ "name": "taxonomy_version",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "category": {+ "name": "category",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "secondary_category": {+ "name": "secondary_category",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "intent": {+ "name": "intent",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "outcome": {+ "name": "outcome",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "labels": {+ "name": "labels",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "model": {+ "name": "model",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "topic_model": {+ "name": "topic_model",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "topic_provider": {+ "name": "topic_provider",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "total_tokens": {+ "name": "total_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "total_input_tokens": {+ "name": "total_input_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "total_output_tokens": {+ "name": "total_output_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "total_cost": {+ "name": "total_cost",+ "type": "numeric(20, 6)",+ "primaryKey": false,+ "notNull": false+ },+ "llm_calls": {+ "name": "llm_calls",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "tool_calls": {+ "name": "tool_calls",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "user_messages": {+ "name": "user_messages",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "assistant_messages": {+ "name": "assistant_messages",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "last_message_id": {+ "name": "last_message_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "last_message_updated_at": {+ "name": "last_message_updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "topic_analyses_topic_version_unique": {+ "name": "topic_analyses_topic_version_unique",+ "columns": [+ {+ "expression": "topic_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "taxonomy_version",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "topic_analyses_user_id_created_at_idx": {+ "name": "topic_analyses_user_id_created_at_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "topic_analyses_workspace_id_created_at_idx": {+ "name": "topic_analyses_workspace_id_created_at_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"topic_analyses\".\"workspace_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "topic_analyses_version_category_idx": {+ "name": "topic_analyses_version_category_idx",+ "columns": [+ {+ "expression": "taxonomy_version",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "category",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "topic_analyses_topic_id_topics_id_fk": {+ "name": "topic_analyses_topic_id_topics_id_fk",+ "tableFrom": "topic_analyses",+ "tableTo": "topics",+ "columnsFrom": [+ "topic_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "topic_analyses_user_id_users_id_fk": {+ "name": "topic_analyses_user_id_users_id_fk",+ "tableFrom": "topic_analyses",+ "tableTo": "users",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "topic_analyses_workspace_id_workspaces_id_fk": {+ "name": "topic_analyses_workspace_id_workspaces_id_fk",+ "tableFrom": "topic_analyses",+ "tableTo": "workspaces",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -37312,8 +41227,12 @@"name": "topic_comment_mentions_comment_id_topic_comments_id_fk","tableFrom": "topic_comment_mentions","tableTo": "topic_comments",- "columnsFrom": ["comment_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "comment_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -37321,8 +41240,12 @@"name": "topic_comment_mentions_mentioned_user_id_users_id_fk","tableFrom": "topic_comment_mentions","tableTo": "users",- "columnsFrom": ["mentioned_user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "mentioned_user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -37330,8 +41253,12 @@"name": "topic_comment_mentions_workspace_id_workspaces_id_fk","tableFrom": "topic_comment_mentions","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -37629,8 +41556,12 @@"name": "topic_comments_topic_id_topics_id_fk","tableFrom": "topic_comments","tableTo": "topics",- "columnsFrom": ["topic_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "topic_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -37638,8 +41569,12 @@"name": "topic_comments_message_id_messages_id_fk","tableFrom": "topic_comments","tableTo": "messages",- "columnsFrom": ["message_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "message_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -37647,8 +41582,12 @@"name": "topic_comments_parent_comment_id_topic_comments_id_fk","tableFrom": "topic_comments","tableTo": "topic_comments",- "columnsFrom": ["parent_comment_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "parent_comment_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "no action","onUpdate": "no action"},@@ -37656,8 +41595,12 @@"name": "topic_comments_author_user_id_users_id_fk","tableFrom": "topic_comments","tableTo": "users",- "columnsFrom": ["author_user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "author_user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -37665,8 +41608,12 @@"name": "topic_comments_workspace_id_workspaces_id_fk","tableFrom": "topic_comments","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -37674,8 +41621,12 @@"name": "topic_comments_moderated_by_user_id_users_id_fk","tableFrom": "topic_comments","tableTo": "users",- "columnsFrom": ["moderated_by_user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "moderated_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -37922,8 +41873,12 @@"name": "trash_items_root_id_trash_items_id_fk","tableFrom": "trash_items","tableTo": "trash_items",- "columnsFrom": ["root_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "root_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -37931,8 +41886,12 @@"name": "trash_items_user_id_users_id_fk","tableFrom": "trash_items","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -37940,8 +41899,12 @@"name": "trash_items_workspace_id_workspaces_id_fk","tableFrom": "trash_items","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -37949,8 +41912,12 @@"name": "trash_items_deleted_by_user_id_users_id_fk","tableFrom": "trash_items","tableTo": "users",- "columnsFrom": ["deleted_by_user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "deleted_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -38050,8 +42017,12 @@"name": "user_settings_id_users_id_fk","tableFrom": "user_settings","tableTo": "users",- "columnsFrom": ["id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -38306,226 +42277,32 @@"users_username_unique": {"name": "users_username_unique","nullsNotDistinct": false,- "columns": ["username"]+ "columns": [+ "username"+ ]},"users_email_unique": {"name": "users_email_unique","nullsNotDistinct": false,- "columns": ["email"]+ "columns": [+ "email"+ ]},"users_normalized_email_unique": {"name": "users_normalized_email_unique","nullsNotDistinct": false,- "columns": ["normalized_email"]+ "columns": [+ "normalized_email"+ ]},"users_phone_unique": {"name": "users_phone_unique","nullsNotDistinct": false,- "columns": ["phone"]- }- },- "policies": {},- "checkConstraints": {},- "isRLSEnabled": false- },- "public.user_memories": {- "name": "user_memories",- "schema": "",- "columns": {- "id": {- "name": "id",- "type": "varchar(255)",- "primaryKey": true,- "notNull": true- },- "user_id": {- "name": "user_id",- "type": "text",- "primaryKey": false,- "notNull": false- },- "memory_category": {- "name": "memory_category",- "type": "varchar(255)",- "primaryKey": false,- "notNull": false- },- "memory_layer": {- "name": "memory_layer",- "type": "varchar(255)",- "primaryKey": false,- "notNull": false- },- "memory_type": {- "name": "memory_type",- "type": "varchar(255)",- "primaryKey": false,- "notNull": false- },- "metadata": {- "name": "metadata",- "type": "jsonb",- "primaryKey": false,- "notNull": false- },- "tags": {- "name": "tags",- "type": "text[]",- "primaryKey": false,- "notNull": false- },- "title": {- "name": "title",- "type": "varchar(255)",- "primaryKey": false,- "notNull": false- },- "summary": {- "name": "summary",- "type": "text",- "primaryKey": false,- "notNull": false- },- "summary_vector_1024": {- "name": "summary_vector_1024",- "type": "vector(1024)",- "primaryKey": false,- "notNull": false- },- "details": {- "name": "details",- "type": "text",- "primaryKey": false,- "notNull": false- },- "details_vector_1024": {- "name": "details_vector_1024",- "type": "vector(1024)",- "primaryKey": false,- "notNull": false- },- "status": {- "name": "status",- "type": "varchar(255)",- "primaryKey": false,- "notNull": false- },- "accessed_count": {- "name": "accessed_count",- "type": "bigint",- "primaryKey": false,- "notNull": false,- "default": 0- },- "last_accessed_at": {- "name": "last_accessed_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": true- },- "captured_at": {- "name": "captured_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": true,- "default": "now()"- },- "deleted_at": {- "name": "deleted_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": false- },- "is_deleted": {- "name": "is_deleted",- "type": "boolean",- "primaryKey": false,- "notNull": false- },- "accessed_at": {- "name": "accessed_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": true,- "default": "now()"- },- "created_at": {- "name": "created_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": true,- "default": "now()"- },- "updated_at": {- "name": "updated_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": true,- "default": "now()"- }- },- "indexes": {- "user_memories_summary_vector_1024_index": {- "name": "user_memories_summary_vector_1024_index","columns": [- {- "expression": "summary_vector_1024",- "isExpression": false,- "asc": true,- "nulls": "last",- "opclass": "vector_cosine_ops"- }- ],- "isUnique": false,- "concurrently": false,- "method": "hnsw",- "with": {}- },- "user_memories_details_vector_1024_index": {- "name": "user_memories_details_vector_1024_index",- "columns": [- {- "expression": "details_vector_1024",- "isExpression": false,- "asc": true,- "nulls": "last",- "opclass": "vector_cosine_ops"- }- ],- "isUnique": false,- "concurrently": false,- "method": "hnsw",- "with": {}- },- "user_memories_user_id_index": {- "name": "user_memories_user_id_index",- "columns": [- {- "expression": "user_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- }- },- "foreignKeys": {- "user_memories_user_id_users_id_fk": {- "name": "user_memories_user_id_users_id_fk",- "tableFrom": "user_memories",- "tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"+ "phone"+ ]}},- "compositePrimaryKeys": {},- "uniqueConstraints": {},"policies": {},"checkConstraints": {},"isRLSEnabled": false@@ -38643,6 +42420,19 @@"primaryKey": false,"notNull": false},+ "dossier_id": {+ "name": "dossier_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "injectable": {+ "name": "injectable",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },"captured_at": {"name": "captured_at","type": "timestamp with time zone",@@ -38764,6 +42554,22 @@"concurrently": false,"method": "btree","with": {}+ },+ "user_memories_activities_dossier_id_index": {+ "name": "user_memories_activities_dossier_id_index",+ "columns": [+ {+ "expression": "dossier_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"user_memories_activities\".\"dossier_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}}},"foreignKeys": {@@ -38771,8 +42577,12 @@"name": "user_memories_activities_user_id_users_id_fk","tableFrom": "user_memories_activities","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -38780,10 +42590,27 @@"name": "user_memories_activities_user_memory_id_user_memories_id_fk","tableFrom": "user_memories_activities","tableTo": "user_memories",- "columnsFrom": ["user_memory_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_memory_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"+ },+ "user_memories_activities_dossier_id_user_memories_dossiers_id_fk": {+ "name": "user_memories_activities_dossier_id_user_memories_dossiers_id_fk",+ "tableFrom": "user_memories_activities",+ "tableTo": "user_memories_dossiers",+ "columnsFrom": [+ "dossier_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"}},"compositePrimaryKeys": {},@@ -38792,8 +42619,8 @@"checkConstraints": {},"isRLSEnabled": false},- "public.user_memories_contexts": {- "name": "user_memories_contexts",+ "public.user_memories": {+ "name": "user_memories","schema": "","columns": {"id": {@@ -38808,9 +42635,21 @@"primaryKey": false,"notNull": false},- "user_memory_ids": {- "name": "user_memory_ids",- "type": "jsonb",+ "memory_category": {+ "name": "memory_category",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "memory_layer": {+ "name": "memory_layer",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "memory_type": {+ "name": "memory_type",+ "type": "varchar(255)","primaryKey": false,"notNull": false},@@ -38826,62 +42665,488 @@"primaryKey": false,"notNull": false},- "associated_objects": {- "name": "associated_objects",- "type": "jsonb",+ "title": {+ "name": "title",+ "type": "varchar(255)","primaryKey": false,"notNull": false},- "associated_subjects": {- "name": "associated_subjects",- "type": "jsonb",+ "summary": {+ "name": "summary",+ "type": "text","primaryKey": false,"notNull": false},- "title": {- "name": "title",- "type": "text",+ "summary_vector_1024": {+ "name": "summary_vector_1024",+ "type": "vector(1024)","primaryKey": false,"notNull": false},- "description": {- "name": "description",+ "details": {+ "name": "details","type": "text","primaryKey": false,"notNull": false},- "description_vector": {- "name": "description_vector",+ "details_vector_1024": {+ "name": "details_vector_1024","type": "vector(1024)","primaryKey": false,"notNull": false},- "type": {- "name": "type",+ "status": {+ "name": "status","type": "varchar(255)","primaryKey": false,"notNull": false},- "current_status": {- "name": "current_status",+ "state": {+ "name": "state","type": "text","primaryKey": false,"notNull": false},- "score_impact": {- "name": "score_impact",- "type": "numeric",+ "user_locked": {+ "name": "user_locked",+ "type": "boolean","primaryKey": false,"notNull": false,- "default": 0+ "default": false},- "score_urgency": {- "name": "score_urgency",- "type": "numeric",+ "accessed_count": {+ "name": "accessed_count",+ "type": "bigint","primaryKey": false,"notNull": false,"default": 0},+ "last_accessed_at": {+ "name": "last_accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true+ },+ "captured_at": {+ "name": "captured_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "deleted_at": {+ "name": "deleted_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "is_deleted": {+ "name": "is_deleted",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "user_memories_summary_vector_1024_index": {+ "name": "user_memories_summary_vector_1024_index",+ "columns": [+ {+ "expression": "summary_vector_1024",+ "isExpression": false,+ "asc": true,+ "nulls": "last",+ "opclass": "vector_cosine_ops"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "hnsw",+ "with": {}+ },+ "user_memories_details_vector_1024_index": {+ "name": "user_memories_details_vector_1024_index",+ "columns": [+ {+ "expression": "details_vector_1024",+ "isExpression": false,+ "asc": true,+ "nulls": "last",+ "opclass": "vector_cosine_ops"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "hnsw",+ "with": {}+ },+ "user_memories_user_id_index": {+ "name": "user_memories_user_id_index",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "user_memories_user_id_users_id_fk": {+ "name": "user_memories_user_id_users_id_fk",+ "tableFrom": "user_memories",+ "tableTo": "users",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_memories_context_projects": {+ "name": "user_memories_context_projects",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "context_id": {+ "name": "context_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "source": {+ "name": "source",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "evidence_count": {+ "name": "evidence_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "is_primary": {+ "name": "is_primary",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "user_memories_context_projects_context_id_project_id_unique": {+ "name": "user_memories_context_projects_context_id_project_id_unique",+ "columns": [+ {+ "expression": "context_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_memories_context_projects_project_id_index": {+ "name": "user_memories_context_projects_project_id_index",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_memories_context_projects_user_id_index": {+ "name": "user_memories_context_projects_user_id_index",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "user_memories_context_projects_context_id_user_memories_contexts_id_fk": {+ "name": "user_memories_context_projects_context_id_user_memories_contexts_id_fk",+ "tableFrom": "user_memories_context_projects",+ "tableTo": "user_memories_contexts",+ "columnsFrom": [+ "context_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_memories_context_projects_project_id_projects_id_fk": {+ "name": "user_memories_context_projects_project_id_projects_id_fk",+ "tableFrom": "user_memories_context_projects",+ "tableTo": "projects",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_memories_context_projects_user_id_users_id_fk": {+ "name": "user_memories_context_projects_user_id_users_id_fk",+ "tableFrom": "user_memories_context_projects",+ "tableTo": "users",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_memories_contexts": {+ "name": "user_memories_contexts",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(255)",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_memory_id": {+ "name": "user_memory_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "user_memory_ids": {+ "name": "user_memory_ids",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "tags": {+ "name": "tags",+ "type": "text[]",+ "primaryKey": false,+ "notNull": false+ },+ "associated_objects": {+ "name": "associated_objects",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "associated_subjects": {+ "name": "associated_subjects",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "description_vector": {+ "name": "description_vector",+ "type": "vector(1024)",+ "primaryKey": false,+ "notNull": false+ },+ "type": {+ "name": "type",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "current_status": {+ "name": "current_status",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "score_impact": {+ "name": "score_impact",+ "type": "numeric",+ "primaryKey": false,+ "notNull": false,+ "default": 0+ },+ "score_urgency": {+ "name": "score_urgency",+ "type": "numeric",+ "primaryKey": false,+ "notNull": false,+ "default": 0+ },+ "now": {+ "name": "now",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "next_steps": {+ "name": "next_steps",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "open_questions": {+ "name": "open_questions",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "first_seen_at": {+ "name": "first_seen_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_evidence_at": {+ "name": "last_evidence_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "synthesized_at": {+ "name": "synthesized_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },"captured_at": {"name": "captured_at","type": "timestamp with time zone",@@ -38972,6 +43237,42 @@"concurrently": false,"method": "gin","with": {}+ },+ "user_memories_contexts_user_memory_id_index": {+ "name": "user_memories_contexts_user_memory_id_index",+ "columns": [+ {+ "expression": "user_memory_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_memories_contexts_user_id_last_evidence_at_index": {+ "name": "user_memories_contexts_user_id_last_evidence_at_index",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "last_evidence_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}}},"foreignKeys": {@@ -38979,10 +43280,1158 @@"name": "user_memories_contexts_user_id_users_id_fk","tableFrom": "user_memories_contexts","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"+ },+ "user_memories_contexts_user_memory_id_user_memories_id_fk": {+ "name": "user_memories_contexts_user_memory_id_user_memories_id_fk",+ "tableFrom": "user_memories_contexts",+ "tableTo": "user_memories",+ "columnsFrom": [+ "user_memory_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_memories_dossiers": {+ "name": "user_memories_dossiers",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(255)",+ "primaryKey": true,+ "notNull": true+ },+ "context_id": {+ "name": "context_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "project_id": {+ "name": "project_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_memory_id": {+ "name": "user_memory_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "summary": {+ "name": "summary",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "summary_vector": {+ "name": "summary_vector",+ "type": "vector(1024)",+ "primaryKey": false,+ "notNull": false+ },+ "now": {+ "name": "now",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "decisions": {+ "name": "decisions",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "first_seen_at": {+ "name": "first_seen_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "last_evidence_at": {+ "name": "last_evidence_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "activity_count": {+ "name": "activity_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'private'"+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "user_memories_dossiers_summary_vector_index": {+ "name": "user_memories_dossiers_summary_vector_index",+ "columns": [+ {+ "expression": "summary_vector",+ "isExpression": false,+ "asc": true,+ "nulls": "last",+ "opclass": "vector_cosine_ops"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "hnsw",+ "with": {}+ },+ "user_memories_dossiers_context_id_index": {+ "name": "user_memories_dossiers_context_id_index",+ "columns": [+ {+ "expression": "context_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_memories_dossiers_user_id_last_evidence_at_index": {+ "name": "user_memories_dossiers_user_id_last_evidence_at_index",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "last_evidence_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_memories_dossiers_user_memory_id_index": {+ "name": "user_memories_dossiers_user_memory_id_index",+ "columns": [+ {+ "expression": "user_memory_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_memories_dossiers_workspace_visibility_idx": {+ "name": "user_memories_dossiers_workspace_visibility_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "visibility",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_memories_dossiers_agent_id_index": {+ "name": "user_memories_dossiers_agent_id_index",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_memories_dossiers_project_id_index": {+ "name": "user_memories_dossiers_project_id_index",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "user_memories_dossiers_context_id_user_memories_contexts_id_fk": {+ "name": "user_memories_dossiers_context_id_user_memories_contexts_id_fk",+ "tableFrom": "user_memories_dossiers",+ "tableTo": "user_memories_contexts",+ "columnsFrom": [+ "context_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "user_memories_dossiers_user_id_users_id_fk": {+ "name": "user_memories_dossiers_user_id_users_id_fk",+ "tableFrom": "user_memories_dossiers",+ "tableTo": "users",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_memories_dossiers_workspace_id_workspaces_id_fk": {+ "name": "user_memories_dossiers_workspace_id_workspaces_id_fk",+ "tableFrom": "user_memories_dossiers",+ "tableTo": "workspaces",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_memories_dossiers_agent_id_agents_id_fk": {+ "name": "user_memories_dossiers_agent_id_agents_id_fk",+ "tableFrom": "user_memories_dossiers",+ "tableTo": "agents",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_memories_dossiers_project_id_projects_id_fk": {+ "name": "user_memories_dossiers_project_id_projects_id_fk",+ "tableFrom": "user_memories_dossiers",+ "tableTo": "projects",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_memories_dossiers_user_memory_id_user_memories_id_fk": {+ "name": "user_memories_dossiers_user_memory_id_user_memories_id_fk",+ "tableFrom": "user_memories_dossiers",+ "tableTo": "user_memories",+ "columnsFrom": [+ "user_memory_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_memories_edges": {+ "name": "user_memories_edges",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "source_memory_id": {+ "name": "source_memory_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "target_memory_id": {+ "name": "target_memory_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "relation": {+ "name": "relation",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "evidence_count": {+ "name": "evidence_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 1+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "user_memories_edges_source_target_relation_unique": {+ "name": "user_memories_edges_source_target_relation_unique",+ "columns": [+ {+ "expression": "source_memory_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "target_memory_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "relation",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_memories_edges_target_memory_id_relation_index": {+ "name": "user_memories_edges_target_memory_id_relation_index",+ "columns": [+ {+ "expression": "target_memory_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "relation",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_memories_edges_user_id_relation_index": {+ "name": "user_memories_edges_user_id_relation_index",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "relation",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_memories_edges_workspace_id_relation_index": {+ "name": "user_memories_edges_workspace_id_relation_index",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "relation",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "user_memories_edges_source_memory_id_user_memories_id_fk": {+ "name": "user_memories_edges_source_memory_id_user_memories_id_fk",+ "tableFrom": "user_memories_edges",+ "tableTo": "user_memories",+ "columnsFrom": [+ "source_memory_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_memories_edges_target_memory_id_user_memories_id_fk": {+ "name": "user_memories_edges_target_memory_id_user_memories_id_fk",+ "tableFrom": "user_memories_edges",+ "tableTo": "user_memories",+ "columnsFrom": [+ "target_memory_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_memories_edges_user_id_users_id_fk": {+ "name": "user_memories_edges_user_id_users_id_fk",+ "tableFrom": "user_memories_edges",+ "tableTo": "users",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_memories_edges_workspace_id_workspaces_id_fk": {+ "name": "user_memories_edges_workspace_id_workspaces_id_fk",+ "tableFrom": "user_memories_edges",+ "tableTo": "workspaces",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_memories_entities": {+ "name": "user_memories_entities",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(255)",+ "primaryKey": true,+ "notNull": true+ },+ "parent_entity_id": {+ "name": "parent_entity_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "project_id": {+ "name": "project_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_memory_id": {+ "name": "user_memory_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'other'"+ },+ "relationship": {+ "name": "relationship",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "description_vector": {+ "name": "description_vector",+ "type": "vector(1024)",+ "primaryKey": false,+ "notNull": false+ },+ "is_self": {+ "name": "is_self",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'private'"+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "user_memories_entities_description_vector_index": {+ "name": "user_memories_entities_description_vector_index",+ "columns": [+ {+ "expression": "description_vector",+ "isExpression": false,+ "asc": true,+ "nulls": "last",+ "opclass": "vector_cosine_ops"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "hnsw",+ "with": {}+ },+ "user_memories_entities_user_id_index": {+ "name": "user_memories_entities_user_id_index",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_memories_entities_parent_entity_id_index": {+ "name": "user_memories_entities_parent_entity_id_index",+ "columns": [+ {+ "expression": "parent_entity_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_memories_entities_user_memory_id_index": {+ "name": "user_memories_entities_user_memory_id_index",+ "columns": [+ {+ "expression": "user_memory_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_memories_entities_user_id_self_unique": {+ "name": "user_memories_entities_user_id_self_unique",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"user_memories_entities\".\"is_self\"",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_memories_entities_workspace_visibility_idx": {+ "name": "user_memories_entities_workspace_visibility_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "visibility",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_memories_entities_agent_id_index": {+ "name": "user_memories_entities_agent_id_index",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_memories_entities_project_id_index": {+ "name": "user_memories_entities_project_id_index",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "user_memories_entities_parent_entity_id_user_memories_entities_id_fk": {+ "name": "user_memories_entities_parent_entity_id_user_memories_entities_id_fk",+ "tableFrom": "user_memories_entities",+ "tableTo": "user_memories_entities",+ "columnsFrom": [+ "parent_entity_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "user_memories_entities_user_id_users_id_fk": {+ "name": "user_memories_entities_user_id_users_id_fk",+ "tableFrom": "user_memories_entities",+ "tableTo": "users",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_memories_entities_workspace_id_workspaces_id_fk": {+ "name": "user_memories_entities_workspace_id_workspaces_id_fk",+ "tableFrom": "user_memories_entities",+ "tableTo": "workspaces",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_memories_entities_agent_id_agents_id_fk": {+ "name": "user_memories_entities_agent_id_agents_id_fk",+ "tableFrom": "user_memories_entities",+ "tableTo": "agents",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_memories_entities_project_id_projects_id_fk": {+ "name": "user_memories_entities_project_id_projects_id_fk",+ "tableFrom": "user_memories_entities",+ "tableTo": "projects",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_memories_entities_user_memory_id_user_memories_id_fk": {+ "name": "user_memories_entities_user_memory_id_user_memories_id_fk",+ "tableFrom": "user_memories_entities",+ "tableTo": "user_memories",+ "columnsFrom": [+ "user_memory_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_memories_entity_names": {+ "name": "user_memories_entity_names",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "entity_id": {+ "name": "entity_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "normalized": {+ "name": "normalized",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'alias'"+ },+ "source_memory_id": {+ "name": "source_memory_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "user_memories_entity_names_entity_id_normalized_unique": {+ "name": "user_memories_entity_names_entity_id_normalized_unique",+ "columns": [+ {+ "expression": "entity_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "normalized",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_memories_entity_names_user_id_normalized_index": {+ "name": "user_memories_entity_names_user_id_normalized_index",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "normalized",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_memories_entity_names_workspace_id_normalized_index": {+ "name": "user_memories_entity_names_workspace_id_normalized_index",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "normalized",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "user_memories_entity_names_entity_id_user_memories_entities_id_fk": {+ "name": "user_memories_entity_names_entity_id_user_memories_entities_id_fk",+ "tableFrom": "user_memories_entity_names",+ "tableTo": "user_memories_entities",+ "columnsFrom": [+ "entity_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_memories_entity_names_user_id_users_id_fk": {+ "name": "user_memories_entity_names_user_id_users_id_fk",+ "tableFrom": "user_memories_entity_names",+ "tableTo": "users",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_memories_entity_names_workspace_id_workspaces_id_fk": {+ "name": "user_memories_entity_names_workspace_id_workspaces_id_fk",+ "tableFrom": "user_memories_entity_names",+ "tableTo": "workspaces",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_memories_entity_names_source_memory_id_user_memories_id_fk": {+ "name": "user_memories_entity_names_source_memory_id_user_memories_id_fk",+ "tableFrom": "user_memories_entity_names",+ "tableTo": "user_memories",+ "columnsFrom": [+ "source_memory_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"}},"compositePrimaryKeys": {},@@ -39215,8 +44664,12 @@"name": "user_memories_experiences_user_id_users_id_fk","tableFrom": "user_memories_experiences","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -39224,8 +44677,12 @@"name": "user_memories_experiences_user_memory_id_user_memories_id_fk","tableFrom": "user_memories_experiences","tableTo": "user_memories",- "columnsFrom": ["user_memory_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_memory_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -39306,6 +44763,12 @@"primaryKey": false,"notNull": false},+ "entity_id": {+ "name": "entity_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },"captured_at": {"name": "captured_at","type": "timestamp with time zone",@@ -39396,6 +44859,21 @@"concurrently": false,"method": "btree","with": {}+ },+ "user_memories_identities_entity_id_index": {+ "name": "user_memories_identities_entity_id_index",+ "columns": [+ {+ "expression": "entity_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}}},"foreignKeys": {@@ -39403,8 +44881,12 @@"name": "user_memories_identities_user_id_users_id_fk","tableFrom": "user_memories_identities","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -39412,10 +44894,27 @@"name": "user_memories_identities_user_memory_id_user_memories_id_fk","tableFrom": "user_memories_identities","tableTo": "user_memories",- "columnsFrom": ["user_memory_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_memory_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"+ },+ "user_memories_identities_entity_id_user_memories_entities_id_fk": {+ "name": "user_memories_identities_entity_id_user_memories_entities_id_fk",+ "tableFrom": "user_memories_identities",+ "tableTo": "user_memories_entities",+ "columnsFrom": [+ "entity_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"}},"compositePrimaryKeys": {},@@ -39424,8 +44923,8 @@"checkConstraints": {},"isRLSEnabled": false},- "public.user_memories_preferences": {- "name": "user_memories_preferences",+ "public.user_memories_operations": {+ "name": "user_memories_operations","schema": "","columns": {"id": {@@ -39440,9 +44939,9 @@"primaryKey": false,"notNull": false},- "user_memory_id": {- "name": "user_memory_id",- "type": "varchar(255)",+ "workspace_id": {+ "name": "workspace_id",+ "type": "text","primaryKey": false,"notNull": false},@@ -39452,49 +44951,65 @@"primaryKey": false,"notNull": false},- "tags": {- "name": "tags",- "type": "text[]",+ "op": {+ "name": "op",+ "type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "conclusion_directives": {- "name": "conclusion_directives",+ "actor": {+ "name": "actor","type": "text","primaryKey": false,+ "notNull": true+ },+ "targets": {+ "name": "targets",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "before": {+ "name": "before",+ "type": "jsonb",+ "primaryKey": false,"notNull": false},- "conclusion_directives_vector": {- "name": "conclusion_directives_vector",- "type": "vector(1024)",+ "after": {+ "name": "after",+ "type": "jsonb","primaryKey": false,"notNull": false},- "type": {- "name": "type",- "type": "varchar(255)",+ "confidence": {+ "name": "confidence",+ "type": "real","primaryKey": false,"notNull": false},- "suggestions": {- "name": "suggestions",+ "reason": {+ "name": "reason","type": "text","primaryKey": false,"notNull": false},- "score_priority": {- "name": "score_priority",- "type": "numeric",+ "gate": {+ "name": "gate",+ "type": "text","primaryKey": false,- "notNull": false,- "default": 0+ "notNull": true},- "captured_at": {- "name": "captured_at",+ "state": {+ "name": "state",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "resolved_at": {+ "name": "resolved_at","type": "timestamp with time zone","primaryKey": false,- "notNull": true,- "default": "now()"+ "notNull": false},"accessed_at": {"name": "accessed_at",@@ -39519,27 +45034,23 @@}},"indexes": {- "user_memories_preferences_conclusion_directives_vector_index": {- "name": "user_memories_preferences_conclusion_directives_vector_index",+ "user_memories_operations_user_id_state_created_at_index": {+ "name": "user_memories_operations_user_id_state_created_at_index","columns": [{- "expression": "conclusion_directives_vector",+ "expression": "user_id","isExpression": false,"asc": true,- "nulls": "last",- "opclass": "vector_cosine_ops"- }- ],- "isUnique": false,- "concurrently": false,- "method": "hnsw",- "with": {}- },- "user_memories_preferences_user_id_index": {- "name": "user_memories_preferences_user_id_index",- "columns": [+ "nulls": "last"+ },{- "expression": "user_id",+ "expression": "state",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at","isExpression": false,"asc": true,"nulls": "last"@@ -39550,11 +45061,23 @@"method": "btree","with": {}},- "user_memories_preferences_user_memory_id_index": {- "name": "user_memories_preferences_user_memory_id_index",+ "user_memories_operations_workspace_id_state_created_at_index": {+ "name": "user_memories_operations_workspace_id_state_created_at_index","columns": [{- "expression": "user_memory_id",+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "state",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at","isExpression": false,"asc": true,"nulls": "last"@@ -39567,21 +45090,29 @@}},"foreignKeys": {- "user_memories_preferences_user_id_users_id_fk": {- "name": "user_memories_preferences_user_id_users_id_fk",- "tableFrom": "user_memories_preferences",+ "user_memories_operations_user_id_users_id_fk": {+ "name": "user_memories_operations_user_id_users_id_fk",+ "tableFrom": "user_memories_operations","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},- "user_memories_preferences_user_memory_id_user_memories_id_fk": {- "name": "user_memories_preferences_user_memory_id_user_memories_id_fk",- "tableFrom": "user_memories_preferences",- "tableTo": "user_memories",- "columnsFrom": ["user_memory_id"],- "columnsTo": ["id"],+ "user_memories_operations_workspace_id_workspaces_id_fk": {+ "name": "user_memories_operations_workspace_id_workspaces_id_fk",+ "tableFrom": "user_memories_operations",+ "tableTo": "workspaces",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -39781,8 +45312,12 @@"name": "user_memory_persona_document_histories_user_id_users_id_fk","tableFrom": "user_memory_persona_document_histories","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -39790,8 +45325,12 @@"name": "user_memory_persona_document_histories_persona_id_user_memory_persona_documents_id_fk","tableFrom": "user_memory_persona_document_histories","tableTo": "user_memory_persona_documents",- "columnsFrom": ["persona_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "persona_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -39892,32 +45431,262 @@}},"indexes": {- "user_persona_documents_user_id_profile_unique": {- "name": "user_persona_documents_user_id_profile_unique",+ "user_persona_documents_user_id_profile_unique": {+ "name": "user_persona_documents_user_id_profile_unique",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "profile",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_persona_documents_user_id_index": {+ "name": "user_persona_documents_user_id_index",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "user_memory_persona_documents_user_id_users_id_fk": {+ "name": "user_memory_persona_documents_user_id_users_id_fk",+ "tableFrom": "user_memory_persona_documents",+ "tableTo": "users",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_memories_preferences": {+ "name": "user_memories_preferences",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "varchar(255)",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_memory_id": {+ "name": "user_memory_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "tags": {+ "name": "tags",+ "type": "text[]",+ "primaryKey": false,+ "notNull": false+ },+ "conclusion_directives": {+ "name": "conclusion_directives",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "conclusion_directives_vector": {+ "name": "conclusion_directives_vector",+ "type": "vector(1024)",+ "primaryKey": false,+ "notNull": false+ },+ "type": {+ "name": "type",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "suggestions": {+ "name": "suggestions",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "score_priority": {+ "name": "score_priority",+ "type": "numeric",+ "primaryKey": false,+ "notNull": false,+ "default": 0+ },+ "holder_entity_id": {+ "name": "holder_entity_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "applies_to_entity_id": {+ "name": "applies_to_entity_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "scope": {+ "name": "scope",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "evidence_source": {+ "name": "evidence_source",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "evidence_count": {+ "name": "evidence_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 1+ },+ "last_evidence_at": {+ "name": "last_evidence_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "captured_at": {+ "name": "captured_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "user_memories_preferences_conclusion_directives_vector_index": {+ "name": "user_memories_preferences_conclusion_directives_vector_index",+ "columns": [+ {+ "expression": "conclusion_directives_vector",+ "isExpression": false,+ "asc": true,+ "nulls": "last",+ "opclass": "vector_cosine_ops"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "hnsw",+ "with": {}+ },+ "user_memories_preferences_user_id_index": {+ "name": "user_memories_preferences_user_id_index","columns": [{"expression": "user_id","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_memories_preferences_user_memory_id_index": {+ "name": "user_memories_preferences_user_memory_id_index",+ "columns": [{- "expression": "profile",+ "expression": "user_memory_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "user_persona_documents_user_id_index": {- "name": "user_persona_documents_user_id_index",+ "user_memories_preferences_holder_entity_id_index": {+ "name": "user_memories_preferences_holder_entity_id_index","columns": [{- "expression": "user_id",+ "expression": "holder_entity_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_memories_preferences_applies_to_entity_id_index": {+ "name": "user_memories_preferences_applies_to_entity_id_index",+ "columns": [+ {+ "expression": "applies_to_entity_id","isExpression": false,"asc": true,"nulls": "last"@@ -39930,14 +45699,57 @@}},"foreignKeys": {- "user_memory_persona_documents_user_id_users_id_fk": {- "name": "user_memory_persona_documents_user_id_users_id_fk",- "tableFrom": "user_memory_persona_documents",+ "user_memories_preferences_user_id_users_id_fk": {+ "name": "user_memories_preferences_user_id_users_id_fk",+ "tableFrom": "user_memories_preferences","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"+ },+ "user_memories_preferences_user_memory_id_user_memories_id_fk": {+ "name": "user_memories_preferences_user_memory_id_user_memories_id_fk",+ "tableFrom": "user_memories_preferences",+ "tableTo": "user_memories",+ "columnsFrom": [+ "user_memory_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_memories_preferences_holder_entity_id_user_memories_entities_id_fk": {+ "name": "user_memories_preferences_holder_entity_id_user_memories_entities_id_fk",+ "tableFrom": "user_memories_preferences",+ "tableTo": "user_memories_entities",+ "columnsFrom": [+ "holder_entity_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "user_memories_preferences_applies_to_entity_id_user_memories_entities_id_fk": {+ "name": "user_memories_preferences_applies_to_entity_id_user_memories_entities_id_fk",+ "tableFrom": "user_memories_preferences",+ "tableTo": "user_memories_entities",+ "columnsFrom": [+ "applies_to_entity_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"}},"compositePrimaryKeys": {},@@ -40225,8 +46037,12 @@"name": "acceptances_user_id_users_id_fk","tableFrom": "acceptances","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -40234,8 +46050,12 @@"name": "acceptances_workspace_id_workspaces_id_fk","tableFrom": "acceptances","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -40243,8 +46063,12 @@"name": "acceptances_project_id_projects_id_fk","tableFrom": "acceptances","tableTo": "projects",- "columnsFrom": ["project_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -40631,8 +46455,12 @@"name": "verify_check_results_verify_run_id_verify_runs_id_fk","tableFrom": "verify_check_results","tableTo": "verify_runs",- "columnsFrom": ["verify_run_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "verify_run_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -40640,8 +46468,12 @@"name": "verify_check_results_operation_id_agent_operations_id_fk","tableFrom": "verify_check_results","tableTo": "agent_operations",- "columnsFrom": ["operation_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "operation_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -40649,8 +46481,12 @@"name": "verify_check_results_user_id_users_id_fk","tableFrom": "verify_check_results","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -40658,8 +46494,12 @@"name": "verify_check_results_workspace_id_workspaces_id_fk","tableFrom": "verify_check_results","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -40667,8 +46507,12 @@"name": "verify_check_results_source_criterion_id_verify_criteria_id_fk","tableFrom": "verify_check_results","tableTo": "verify_criteria",- "columnsFrom": ["source_criterion_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "source_criterion_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -40676,8 +46520,12 @@"name": "verify_check_results_verifier_operation_id_agent_operations_id_fk","tableFrom": "verify_check_results","tableTo": "agent_operations",- "columnsFrom": ["verifier_operation_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "verifier_operation_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -40685,8 +46533,12 @@"name": "verify_check_results_verifier_tracing_id_llm_generation_tracing_id_fk","tableFrom": "verify_check_results","tableTo": "llm_generation_tracing",- "columnsFrom": ["verifier_tracing_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "verifier_tracing_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -40694,8 +46546,12 @@"name": "verify_check_results_repair_operation_id_agent_operations_id_fk","tableFrom": "verify_check_results","tableTo": "agent_operations",- "columnsFrom": ["repair_operation_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "repair_operation_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -40882,8 +46738,12 @@"name": "verify_criteria_user_id_users_id_fk","tableFrom": "verify_criteria","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -40891,8 +46751,12 @@"name": "verify_criteria_document_id_documents_id_fk","tableFrom": "verify_criteria","tableTo": "documents",- "columnsFrom": ["document_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -40900,8 +46764,12 @@"name": "verify_criteria_workspace_id_workspaces_id_fk","tableFrom": "verify_criteria","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -41079,8 +46947,12 @@"name": "verify_evidence_check_result_id_verify_check_results_id_fk","tableFrom": "verify_evidence","tableTo": "verify_check_results",- "columnsFrom": ["check_result_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "check_result_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -41088,8 +46960,12 @@"name": "verify_evidence_document_id_documents_id_fk","tableFrom": "verify_evidence","tableTo": "documents",- "columnsFrom": ["document_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -41097,8 +46973,12 @@"name": "verify_evidence_file_id_files_id_fk","tableFrom": "verify_evidence","tableTo": "files",- "columnsFrom": ["file_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "file_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -41106,8 +46986,12 @@"name": "verify_evidence_user_id_users_id_fk","tableFrom": "verify_evidence","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -41115,8 +46999,12 @@"name": "verify_evidence_workspace_id_workspaces_id_fk","tableFrom": "verify_evidence","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -41306,8 +47194,12 @@"name": "verify_reports_verify_run_id_verify_runs_id_fk","tableFrom": "verify_reports","tableTo": "verify_runs",- "columnsFrom": ["verify_run_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "verify_run_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -41315,8 +47207,12 @@"name": "verify_reports_operation_id_agent_operations_id_fk","tableFrom": "verify_reports","tableTo": "agent_operations",- "columnsFrom": ["operation_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "operation_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -41324,8 +47220,12 @@"name": "verify_reports_user_id_users_id_fk","tableFrom": "verify_reports","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -41333,8 +47233,12 @@"name": "verify_reports_workspace_id_workspaces_id_fk","tableFrom": "verify_reports","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -41584,8 +47488,12 @@"name": "verify_review_predictions_check_result_id_verify_check_results_id_fk","tableFrom": "verify_review_predictions","tableTo": "verify_check_results",- "columnsFrom": ["check_result_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "check_result_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -41593,8 +47501,12 @@"name": "verify_review_predictions_user_id_users_id_fk","tableFrom": "verify_review_predictions","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -41602,8 +47514,12 @@"name": "verify_review_predictions_workspace_id_workspaces_id_fk","tableFrom": "verify_review_predictions","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -41713,8 +47629,12 @@"name": "verify_rubric_criteria_rubric_id_verify_rubrics_id_fk","tableFrom": "verify_rubric_criteria","tableTo": "verify_rubrics",- "columnsFrom": ["rubric_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "rubric_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -41722,8 +47642,12 @@"name": "verify_rubric_criteria_criterion_id_verify_criteria_id_fk","tableFrom": "verify_rubric_criteria","tableTo": "verify_criteria",- "columnsFrom": ["criterion_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "criterion_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -41731,8 +47655,12 @@"name": "verify_rubric_criteria_user_id_users_id_fk","tableFrom": "verify_rubric_criteria","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -41740,8 +47668,12 @@"name": "verify_rubric_criteria_workspace_id_workspaces_id_fk","tableFrom": "verify_rubric_criteria","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -41749,7 +47681,10 @@"compositePrimaryKeys": {"verify_rubric_criteria_rubric_id_criterion_id_pk": {"name": "verify_rubric_criteria_rubric_id_criterion_id_pk",- "columns": ["rubric_id", "criterion_id"]+ "columns": [+ "rubric_id",+ "criterion_id"+ ]}},"uniqueConstraints": {},@@ -41858,8 +47793,12 @@"name": "verify_rubrics_user_id_users_id_fk","tableFrom": "verify_rubrics","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -41867,8 +47806,12 @@"name": "verify_rubrics_workspace_id_workspaces_id_fk","tableFrom": "verify_rubrics","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -42140,8 +48083,12 @@"name": "verify_runs_user_id_users_id_fk","tableFrom": "verify_runs","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -42149,8 +48096,12 @@"name": "verify_runs_workspace_id_workspaces_id_fk","tableFrom": "verify_runs","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -42158,8 +48109,12 @@"name": "verify_runs_acceptance_id_acceptances_id_fk","tableFrom": "verify_runs","tableTo": "acceptances",- "columnsFrom": ["acceptance_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "acceptance_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -42167,8 +48122,12 @@"name": "verify_runs_operation_id_agent_operations_id_fk","tableFrom": "verify_runs","tableTo": "agent_operations",- "columnsFrom": ["operation_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "operation_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -42374,8 +48333,12 @@"name": "widget_runs_widget_id_widgets_id_fk","tableFrom": "widget_runs","tableTo": "widgets",- "columnsFrom": ["widget_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "widget_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -42383,8 +48346,12 @@"name": "widget_runs_version_id_widget_versions_id_fk","tableFrom": "widget_runs","tableTo": "widget_versions",- "columnsFrom": ["version_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "version_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -42392,8 +48359,12 @@"name": "widget_runs_user_id_users_id_fk","tableFrom": "widget_runs","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -42401,8 +48372,12 @@"name": "widget_runs_workspace_id_workspaces_id_fk","tableFrom": "widget_runs","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -42663,8 +48638,12 @@"name": "widget_versions_widget_id_widgets_id_fk","tableFrom": "widget_versions","tableTo": "widgets",- "columnsFrom": ["widget_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "widget_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -42672,8 +48651,12 @@"name": "widget_versions_user_id_users_id_fk","tableFrom": "widget_versions","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -42681,8 +48664,12 @@"name": "widget_versions_workspace_id_workspaces_id_fk","tableFrom": "widget_versions","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -42690,8 +48677,12 @@"name": "widget_versions_published_by_user_id_users_id_fk","tableFrom": "widget_versions","tableTo": "users",- "columnsFrom": ["published_by_user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "published_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -42699,8 +48690,12 @@"name": "widget_versions_source_agent_id_agents_id_fk","tableFrom": "widget_versions","tableTo": "agents",- "columnsFrom": ["source_agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "source_agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -42708,8 +48703,12 @@"name": "widget_versions_source_topic_id_topics_id_fk","tableFrom": "widget_versions","tableTo": "topics",- "columnsFrom": ["source_topic_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "source_topic_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -42717,8 +48716,12 @@"name": "widget_versions_parent_version_id_widget_versions_id_fk","tableFrom": "widget_versions","tableTo": "widget_versions",- "columnsFrom": ["parent_version_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "parent_version_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -43088,8 +49091,12 @@"name": "widgets_user_id_users_id_fk","tableFrom": "widgets","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -43097,8 +49104,12 @@"name": "widgets_workspace_id_workspaces_id_fk","tableFrom": "widgets","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -43106,8 +49117,12 @@"name": "widgets_project_id_projects_id_fk","tableFrom": "widgets","tableTo": "projects",- "columnsFrom": ["project_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -43115,8 +49130,12 @@"name": "widgets_agent_id_agents_id_fk","tableFrom": "widgets","tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -43124,8 +49143,12 @@"name": "widgets_published_version_id_widget_versions_id_fk","tableFrom": "widgets","tableTo": "widget_versions",- "columnsFrom": ["published_version_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "published_version_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -43133,8 +49156,12 @@"name": "widgets_draft_version_id_widget_versions_id_fk","tableFrom": "widgets","tableTo": "widget_versions",- "columnsFrom": ["draft_version_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "draft_version_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -43142,8 +49169,12 @@"name": "widgets_metric_id_metrics_id_fk","tableFrom": "widgets","tableTo": "metrics",- "columnsFrom": ["metric_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "metric_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -43457,8 +49488,12 @@"name": "work_versions_work_id_works_id_fk","tableFrom": "work_versions","tableTo": "works",- "columnsFrom": ["work_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "work_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -43466,8 +49501,12 @@"name": "work_versions_topic_id_topics_id_fk","tableFrom": "work_versions","tableTo": "topics",- "columnsFrom": ["topic_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "topic_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -43475,8 +49514,12 @@"name": "work_versions_thread_id_threads_id_fk","tableFrom": "work_versions","tableTo": "threads",- "columnsFrom": ["thread_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "thread_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -43484,8 +49527,12 @@"name": "work_versions_message_id_messages_id_fk","tableFrom": "work_versions","tableTo": "messages",- "columnsFrom": ["message_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "message_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -43493,8 +49540,12 @@"name": "work_versions_agent_id_agents_id_fk","tableFrom": "work_versions","tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -43883,8 +49934,12 @@"name": "works_origin_topic_id_topics_id_fk","tableFrom": "works","tableTo": "topics",- "columnsFrom": ["origin_topic_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "origin_topic_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -43892,8 +49947,12 @@"name": "works_origin_thread_id_threads_id_fk","tableFrom": "works","tableTo": "threads",- "columnsFrom": ["origin_thread_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "origin_thread_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -43901,8 +49960,12 @@"name": "works_origin_agent_id_agents_id_fk","tableFrom": "works","tableTo": "agents",- "columnsFrom": ["origin_agent_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "origin_agent_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"},@@ -43910,8 +49973,12 @@"name": "works_user_id_users_id_fk","tableFrom": "works","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -43919,8 +49986,12 @@"name": "works_workspace_id_workspaces_id_fk","tableFrom": "works","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -44044,8 +50115,12 @@"name": "workspace_audit_logs_workspace_id_workspaces_id_fk","tableFrom": "workspace_audit_logs","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -44192,8 +50267,12 @@"name": "workspace_invitations_workspace_id_workspaces_id_fk","tableFrom": "workspace_invitations","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -44201,8 +50280,12 @@"name": "workspace_invitations_inviter_id_users_id_fk","tableFrom": "workspace_invitations","tableTo": "users",- "columnsFrom": ["inviter_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "inviter_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -44212,7 +50295,9 @@"workspace_invitations_token_unique": {"name": "workspace_invitations_token_unique","nullsNotDistinct": false,- "columns": ["token"]+ "columns": [+ "token"+ ]}},"policies": {},@@ -44313,8 +50398,12 @@"name": "workspace_members_workspace_id_workspaces_id_fk","tableFrom": "workspace_members","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -44322,8 +50411,12 @@"name": "workspace_members_user_id_users_id_fk","tableFrom": "workspace_members","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -44331,7 +50424,10 @@"compositePrimaryKeys": {"workspace_members_workspace_id_user_id_pk": {"name": "workspace_members_workspace_id_user_id_pk",- "columns": ["workspace_id", "user_id"]+ "columns": [+ "workspace_id",+ "user_id"+ ]}},"uniqueConstraints": {},@@ -44447,8 +50543,12 @@"name": "workspace_team_members_workspace_id_workspaces_id_fk","tableFrom": "workspace_team_members","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -44456,8 +50556,12 @@"name": "workspace_team_members_user_id_users_id_fk","tableFrom": "workspace_team_members","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -44465,8 +50569,14 @@"name": "workspace_team_members_team_workspace_fk","tableFrom": "workspace_team_members","tableTo": "workspace_teams",- "columnsFrom": ["team_id", "workspace_id"],- "columnsTo": ["id", "workspace_id"],+ "columnsFrom": [+ "team_id",+ "workspace_id"+ ],+ "columnsTo": [+ "id",+ "workspace_id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -44596,8 +50706,12 @@"name": "workspace_teams_workspace_id_workspaces_id_fk","tableFrom": "workspace_teams","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -44605,8 +50719,12 @@"name": "workspace_teams_created_by_users_id_fk","tableFrom": "workspace_teams","tableTo": "users",- "columnsFrom": ["created_by"],- "columnsTo": ["id"],+ "columnsFrom": [+ "created_by"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "set null","onUpdate": "no action"}@@ -44616,7 +50734,10 @@"workspace_teams_id_workspace_unique": {"name": "workspace_teams_id_workspace_unique","nullsNotDistinct": false,- "columns": ["id", "workspace_id"]+ "columns": [+ "id",+ "workspace_id"+ ]}},"policies": {},@@ -44711,8 +50832,12 @@"name": "workspace_user_settings_workspace_id_workspaces_id_fk","tableFrom": "workspace_user_settings","tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"},@@ -44720,8 +50845,12 @@"name": "workspace_user_settings_user_id_users_id_fk","tableFrom": "workspace_user_settings","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -44850,8 +50979,12 @@"name": "workspaces_primary_owner_id_users_id_fk","tableFrom": "workspaces","tableTo": "users",- "columnsFrom": ["primary_owner_id"],- "columnsTo": ["id"],+ "columnsFrom": [+ "primary_owner_id"+ ],+ "columnsTo": [+ "id"+ ],"onDelete": "cascade","onUpdate": "no action"}@@ -44863,6 +50996,26 @@"isRLSEnabled": false}},- "version": "7",- "views": {}-}+ "enums": {},+ "schemas": {},+ "sequences": {+ "public.fts_search_sync_revision_seq": {+ "name": "fts_search_sync_revision_seq",+ "schema": "public",+ "increment": "1",+ "startWith": "1",+ "minValue": "1",+ "maxValue": "9223372036854775807",+ "cache": "1",+ "cycle": false+ }+ },+ "roles": {},+ "policies": {},+ "views": {},+ "_meta": {+ "columns": {},+ "schemas": {},+ "tables": {}+ }+}\ No newline at end of filediff --git a/packages/database/migrations/meta/_journal.json b/packages/database/migrations/meta/_journal.jsonindex 7d0da124e21..e4ebea86aef 100644--- a/packages/database/migrations/meta/_journal.json+++ b/packages/database/migrations/meta/_journal.json@@ -1414,7 +1414,14 @@"when": 1793718950376,"tag": "0201_goal_archived_at","breakpoints": true+ },+ {+ "idx": 202,+ "version": "7",+ "when": 1793792795990,+ "tag": "0202_task_labels",+ "breakpoints": true}],"version": "6"-}+}\ No newline at end of filediff --git a/packages/database/src/models/__tests__/taskLabel.test.ts b/packages/database/src/models/__tests__/taskLabel.test.tsnew file mode 100644index 00000000000..3d994101fbd--- /dev/null+++ b/packages/database/src/models/__tests__/taskLabel.test.ts@@ -0,0 +1,376 @@+// @vitest-environment node+import { and, eq, isNull, like, or } from 'drizzle-orm';+import { afterEach, beforeEach, describe, expect, it } from 'vitest';++import { getTestDB } from '../../core/getTestDB';+import { taskLabelLinks, taskLabels, users, workspaces } from '../../schemas';+import type { LobeChatDatabase } from '../../type';+import { TaskModel } from '../task';+import { TaskLabelError, TaskLabelModel } from '../taskLabel';+import { UserModel } from '../user';++const serverDB: LobeChatDatabase = await getTestDB();++const userId = 'task-label-test-user';+const otherUserId = 'task-label-test-user-2';+const workspaceId = 'task-label-test-ws';+const otherWorkspaceId = 'task-label-test-ws-2';++const personal = new TaskLabelModel(serverDB, userId);+const workspace = new TaskLabelModel(serverDB, userId, workspaceId);+const member = new TaskLabelModel(serverDB, otherUserId, workspaceId);++beforeEach(async () => {+ await serverDB.delete(users);+ await serverDB.delete(workspaces);+ await serverDB.insert(users).values([{ id: userId }, { id: otherUserId }]);+ await serverDB.insert(workspaces).values([+ { id: workspaceId, name: 'WS', primaryOwnerId: userId, slug: workspaceId },+ { id: otherWorkspaceId, name: 'WS 2', primaryOwnerId: userId, slug: otherWorkspaceId },+ ]);+});++afterEach(async () => {+ await serverDB.delete(users);+ await serverDB.delete(workspaces);+});++const expectCode = async (promise: Promise<unknown>, code: TaskLabelError['code']) => {+ await expect(promise).rejects.toBeInstanceOf(TaskLabelError);+ await expect(promise).rejects.toMatchObject({ code });+};++describe('TaskLabelModel registry', () => {+ it('scopes labels per workspace and per personal owner', async () => {+ await personal.create({ name: 'Mine' });+ await workspace.create({ color: '#EB5757', name: 'Shared' });++ expect((await personal.query()).map((l) => l.name)).toEqual(['Mine']);+ expect((await workspace.query()).map((l) => l.name)).toEqual(['Shared']);+ // every workspace member shares the registry+ expect((await member.query()).map((l) => l.name)).toEqual(['Shared']);+ // personal labels never leak to another user+ expect(await new TaskLabelModel(serverDB, otherUserId).query()).toHaveLength(0);+ });++ it('rejects a duplicate name in the same scope case-insensitively', async () => {+ await workspace.create({ name: 'Bug' });+ await expect(member.create({ name: 'bug' })).rejects.toThrow();+ // the same name is fine in another scope+ await expect(personal.create({ name: 'Bug' })).resolves.toBeDefined();+ });++ it('nests labels one level under a group only', async () => {+ const group = await workspace.create({ isGroup: true, name: 'Type' });+ const bug = await workspace.create({ name: 'Bug', parentId: group.id });+ expect(bug.parentId).toBe(group.id);++ await expectCode(+ workspace.create({ isGroup: true, name: 'Nested', parentId: group.id }),+ 'INVALID_PARENT',+ );+ await expectCode(workspace.create({ name: 'Child', parentId: bug.id }), 'INVALID_PARENT');+ // a group from another scope is not a valid parent+ const foreign = await personal.create({ isGroup: true, name: 'Foreign' });+ await expectCode(workspace.create({ name: 'X', parentId: foreign.id }), 'INVALID_PARENT');+ });++ it('deleting a group deletes its labels and their task links', async () => {+ const tasks = new TaskModel(serverDB, userId, workspaceId);+ const task = await tasks.create({ instruction: 'a' });+ const group = await workspace.create({ isGroup: true, name: 'Type' });+ const bug = await workspace.create({ name: 'Bug', parentId: group.id });+ await workspace.addTaskLabels(task.id, [bug.id]);++ await workspace.delete(group.id);++ expect(await workspace.query()).toHaveLength(0);+ expect(await workspace.getTaskLabels(task.id)).toEqual([]);+ });++ it('counts only tasks visible to the caller', async () => {+ const label = await workspace.create({ name: 'Shared' });+ const own = await new TaskModel(serverDB, userId, workspaceId).create({ instruction: 'mine' });+ const othersPrivate = await new TaskModel(serverDB, otherUserId, workspaceId).create({+ instruction: 'secret',+ visibility: 'private',+ });+ await workspace.addTaskLabels(own.id, [label.id]);+ await member.addTaskLabels(othersPrivate.id, [label.id]);++ expect((await workspace.query())[0].usageCount).toBe(1);+ expect((await member.query())[0].usageCount).toBe(2);+ });++ it('checks a regroup against the parent under the lock, not a stale read', async () => {+ const task = await new TaskModel(serverDB, userId, workspaceId).create({ instruction: 'a' });+ const groupA = await workspace.create({ isGroup: true, name: 'A' });+ const groupB = await workspace.create({ isGroup: true, name: 'B' });+ const label = await workspace.create({ name: 'L', parentId: groupA.id });+ const sibling = await workspace.create({ name: 'S', parentId: groupA.id });+ const staleRead = await workspace.findById(label.id);++ // Meanwhile: L moves to B and the task gains L plus A's sibling.+ await workspace.update(label.id, { parentId: groupB.id });+ await workspace.addTaskLabels(task.id, [label.id, sibling.id]);++ // A writer that read L while it was still in A submits "parent A".+ const stale = new TaskLabelModel(serverDB, userId, workspaceId);+ stale.findById = async () => staleRead;+ await expectCode(stale.update(label.id, { parentId: groupA.id }), 'GROUP_CONFLICT');+ expect((await workspace.findById(label.id))?.parentId).toBe(groupB.id);+ });++ it('refuses to move a label into a group when a task would end up with two', async () => {+ const task = await new TaskModel(serverDB, userId, workspaceId).create({ instruction: 'a' });+ const group = await workspace.create({ isGroup: true, name: 'Type' });+ const bug = await workspace.create({ name: 'Bug', parentId: group.id });+ const loose = await workspace.create({ name: 'Feature' });+ await workspace.addTaskLabels(task.id, [bug.id, loose.id]);++ await expectCode(workspace.update(loose.id, { parentId: group.id }), 'GROUP_CONFLICT');++ const other = await workspace.create({ name: 'Chore' });+ await expect(workspace.update(other.id, { parentId: group.id })).resolves.toMatchObject({+ parentId: group.id,+ });+ });+});++describe('TaskLabelModel account deletion', () => {+ it("keeps a workspace label and its links when the label's creator is deleted", async () => {+ const task = await new TaskModel(serverDB, userId, workspaceId).create({ instruction: 'a' });+ const label = await member.create({ name: 'Frontend' });+ await workspace.addTaskLabels(task.id, [label.id]);++ await UserModel.deleteUser(serverDB, otherUserId);++ expect(await workspace.findById(label.id)).toMatchObject({ name: 'Frontend', userId: null });+ expect((await workspace.getTaskLabels(task.id)).map((l) => l.name)).toEqual(['Frontend']);+ });++ it('never orphans a personal label created while its owner is being deleted', async () => {+ const personalOther = new TaskLabelModel(serverDB, otherUserId);+ await Promise.allSettled([+ ...Array.from({ length: 5 }, (_, i) => personalOther.create({ name: `Racing ${i}` })),+ UserModel.deleteUser(serverDB, otherUserId),+ ...Array.from({ length: 5 }, (_, i) => personalOther.create({ name: `Late ${i}` })),+ ]);++ const orphans = await serverDB+ .select()+ .from(taskLabels)+ .where(+ and(+ isNull(taskLabels.userId),+ isNull(taskLabels.workspaceId),+ or(like(taskLabels.name, 'Racing %'), like(taskLabels.name, 'Late %')),+ ),+ );+ expect(orphans).toEqual([]);+ });++ it('deletes personal labels with their owner', async () => {+ const own = await new TaskLabelModel(serverDB, otherUserId).create({ name: 'Mine' });++ await UserModel.deleteUser(serverDB, otherUserId);++ const rows = await serverDB.select().from(taskLabels).where(eq(taskLabels.id, own.id));+ expect(rows).toEqual([]);+ });+});++describe('TaskLabelModel task assignments', () => {+ it('adds, lists and removes labels on a task', async () => {+ const task = await new TaskModel(serverDB, userId, workspaceId).create({ instruction: 'a' });+ const a = await workspace.create({ color: '#4CB782', name: 'Alpha' });+ const b = await workspace.create({ name: 'Beta' });++ const added = await workspace.addTaskLabels(task.id, [a.id, b.id, a.id]);+ expect(added.map((l) => l.name)).toEqual(['Alpha', 'Beta']);+ expect(added[0]).toMatchObject({ color: '#4CB782', id: a.id });++ const removed = await workspace.removeTaskLabels(task.id, [a.id]);+ expect(removed.map((l) => l.name)).toEqual(['Beta']);+ });++ it('replaces the sibling when attaching another label of the same group', async () => {+ const task = await new TaskModel(serverDB, userId, workspaceId).create({ instruction: 'a' });+ const group = await workspace.create({ isGroup: true, name: 'Type' });+ const bug = await workspace.create({ name: 'Bug', parentId: group.id });+ const feature = await workspace.create({ name: 'Feature', parentId: group.id });+ const loose = await workspace.create({ name: 'Frontend' });++ await workspace.addTaskLabels(task.id, [bug.id, loose.id]);+ const next = await workspace.addTaskLabels(task.id, [feature.id]);++ expect(next.map((l) => l.name).sort()).toEqual(['Feature', 'Frontend']);+ });++ it("keeps a teammate's label on a shared task after the teammate's account is deleted", async () => {+ const task = await new TaskModel(serverDB, userId, workspaceId).create({ instruction: 'a' });+ const label = await workspace.create({ name: 'Frontend' });++ await member.addTaskLabels(task.id, [label.id]);+ const [link] = await serverDB.select().from(taskLabelLinks);+ expect(link.userId).toBe(userId);++ await serverDB.delete(users).where(eq(users.id, otherUserId));+ expect((await workspace.getTaskLabels(task.id)).map((l) => l.name)).toEqual(['Frontend']);+ });++ it('keeps one label per group when siblings are attached concurrently', async () => {+ const task = await new TaskModel(serverDB, userId, workspaceId).create({ instruction: 'a' });+ const group = await workspace.create({ isGroup: true, name: 'Type' });+ const bug = await workspace.create({ name: 'Bug', parentId: group.id });+ const feature = await workspace.create({ name: 'Feature', parentId: group.id });+ const chore = await workspace.create({ name: 'Chore', parentId: group.id });++ await Promise.all([+ workspace.addTaskLabels(task.id, [bug.id]),+ member.addTaskLabels(task.id, [feature.id]),+ workspace.setTaskLabels(task.id, [chore.id]),+ ]);++ const labels = await workspace.getTaskLabels(task.id);+ expect(labels).toHaveLength(1);+ expect(labels[0].parentId).toBe(group.id);+ });++ it('keeps one label per group when a label is regrouped during an assignment', async () => {+ const taskModel = new TaskModel(serverDB, userId, workspaceId);+ const group = await workspace.create({ isGroup: true, name: 'Type' });+ const sibling = await workspace.create({ name: 'Bug', parentId: group.id });++ for (let round = 0; round < 4; round++) {+ // T carries the loose label and gains the sibling; T2 carries the+ // sibling and gains the loose label β both while the label joins Type.+ const loose = await workspace.create({ name: `Loose ${round}` });+ const task = await taskModel.create({ instruction: `a${round}` });+ const task2 = await taskModel.create({ instruction: `b${round}` });+ await workspace.addTaskLabels(task.id, [loose.id]);+ await workspace.addTaskLabels(task2.id, [sibling.id]);++ const results = await Promise.allSettled([+ workspace.update(loose.id, { parentId: group.id }),+ member.addTaskLabels(task.id, [sibling.id]),+ member.addTaskLabels(task2.id, [loose.id]),+ ]);+ // Losing the race is a clean rule error, never a deadlock or a DB error.+ for (const result of results) {+ if (result.status === 'rejected') {+ expect(result.reason).toMatchObject({ code: 'GROUP_CONFLICT' });+ }+ }++ const parentOf = new Map(+ (await workspace.query()).map((label) => [label.id, label.parentId]),+ );+ for (const id of [task.id, task2.id]) {+ const inGroup = (await workspace.getTaskLabels(id)).filter(+ (label) => parentOf.get(label.id) === group.id,+ );+ expect(inGroup.length).toBeLessThanOrEqual(1);+ }+ }+ });++ it('rejects groups, two labels of one group, and labels from another scope', async () => {+ const task = await new TaskModel(serverDB, userId, workspaceId).create({ instruction: 'a' });+ const group = await workspace.create({ isGroup: true, name: 'Type' });+ const bug = await workspace.create({ name: 'Bug', parentId: group.id });+ const feature = await workspace.create({ name: 'Feature', parentId: group.id });+ const foreign = await personal.create({ name: 'Personal' });++ await expectCode(workspace.addTaskLabels(task.id, [group.id]), 'GROUP_NOT_ASSIGNABLE');+ await expectCode(workspace.setTaskLabels(task.id, [bug.id, feature.id]), 'GROUP_CONFLICT');+ await expectCode(workspace.addTaskLabels(task.id, [foreign.id]), 'LABEL_NOT_FOUND');+ });++ it('changeTaskLabels applies removals and additions together, or not at all', async () => {+ const task = await new TaskModel(serverDB, userId, workspaceId).create({ instruction: 'a' });+ const frontend = await workspace.create({ name: 'Frontend' });+ const backend = await workspace.create({ name: 'Backend' });+ const foreign = await personal.create({ name: 'Personal' });+ await workspace.addTaskLabels(task.id, [frontend.id]);++ await expectCode(+ workspace.changeTaskLabels(task.id, { add: [foreign.id], remove: [frontend.id] }),+ 'LABEL_NOT_FOUND',+ );+ expect((await workspace.getTaskLabels(task.id)).map((l) => l.name)).toEqual(['Frontend']);++ const next = await workspace.changeTaskLabels(task.id, {+ add: [backend.id],+ remove: [frontend.id],+ });+ expect(next.map((l) => l.name)).toEqual(['Backend']);+ });++ it('setTaskLabels replaces the full set', async () => {+ const task = await new TaskModel(serverDB, userId, workspaceId).create({ instruction: 'a' });+ const a = await workspace.create({ name: 'A' });+ const b = await workspace.create({ name: 'B' });+ const c = await workspace.create({ name: 'C' });+ await workspace.addTaskLabels(task.id, [a.id, b.id]);++ expect((await workspace.setTaskLabels(task.id, [b.id, c.id])).map((l) => l.name)).toEqual([+ 'B',+ 'C',+ ]);+ expect(await workspace.setTaskLabels(task.id, [])).toEqual([]);+ });++ it('cannot label a task the caller cannot see', async () => {+ const hidden = await new TaskModel(serverDB, otherUserId, workspaceId).create({+ instruction: 'secret',+ visibility: 'private',+ });+ const label = await workspace.create({ name: 'A' });++ await expectCode(workspace.addTaskLabels(hidden.id, [label.id]), 'TASK_NOT_FOUND');+ expect(await workspace.getLabelsForTasks([hidden.id])).toEqual({});+ });++ it('groups labels by task for a batch of tasks', async () => {+ const model = new TaskModel(serverDB, userId, workspaceId);+ const t1 = await model.create({ instruction: '1' });+ const t2 = await model.create({ instruction: '2' });+ const t3 = await model.create({ instruction: '3' });+ const a = await workspace.create({ name: 'A' });+ const b = await workspace.create({ name: 'B' });+ await workspace.addTaskLabels(t1.id, [a.id, b.id]);+ await workspace.addTaskLabels(t2.id, [b.id]);++ const map = await workspace.getLabelsForTasks([t1.id, t2.id, t3.id]);+ expect(map[t1.id].map((l) => l.name)).toEqual(['A', 'B']);+ expect(map[t2.id].map((l) => l.name)).toEqual(['B']);+ expect(map[t3.id]).toBeUndefined();+ });++ it('finds labels by name case-insensitively within scope', async () => {+ await workspace.create({ name: 'Bug' });+ await personal.create({ name: 'Bug' });++ const found = await workspace.findByNames(['bug', ' BUG ', 'missing']);+ expect(found).toHaveLength(1);+ expect(found[0].workspaceId).toBe(workspaceId);+ });++ it('drops label links when a task moves to another workspace, keeps them otherwise', async () => {+ const model = new TaskModel(serverDB, userId, workspaceId);+ const moved = await model.create({ instruction: 'moved' });+ const kept = await model.create({ instruction: 'kept' });+ const label = await workspace.create({ name: 'A' });+ await workspace.addTaskLabels(moved.id, [label.id]);+ await workspace.addTaskLabels(kept.id, [label.id]);++ await model.transferTo(moved.id, otherWorkspaceId, userId, 'public');+ await model.transferTo(kept.id, workspaceId, otherUserId, 'public');++ const links = await serverDB.select().from(taskLabelLinks);+ expect(links.map((l) => l.taskId)).toEqual([kept.id]);+ // The kept link follows the new owner, so removing the old one keeps it.+ expect(links[0].userId).toBe(otherUserId);+ });+});diff --git a/packages/database/src/models/task/transfer.ts b/packages/database/src/models/task/transfer.tsindex f7d7410c91c..0abe4d91293 100644--- a/packages/database/src/models/task/transfer.ts+++ b/packages/database/src/models/task/transfer.ts@@ -9,6 +9,7 @@ import {taskDocuments,tasks,} from '../../schemas/task';+import { taskLabelLinks } from '../../schemas/taskLabel';import type { LobeChatDatabase } from '../../type';import { type CheckpointTaskRelocation, remapCheckpointConfig } from './checkpoint';import type { TaskModelContext } from './context';@@ -116,6 +117,24 @@ export const transferTo = async (.set({ ...ownershipUpdate, ...visibilityUpdate }).where(inArray(taskActivities.taskId, ids));+ // Labels belong to the source scope's registry, which the destination+ // cannot see. Keep the links on a same-scope handover only.+ const sameLabelScope = targetWorkspaceId+ ? targetWorkspaceId === ctx.workspaceId+ : !ctx.workspaceId && targetUserId === ctx.userId;+ if (sameLabelScope) {+ // Re-own the kept links like the other child rows, so deleting the+ // previous owner (user_id cascades) does not drop live assignments.+ await (trx as LobeChatDatabase)+ .update(taskLabelLinks)+ .set(ownershipUpdate)+ .where(inArray(taskLabelLinks.taskId, ids));+ } else {+ await (trx as LobeChatDatabase)+ .delete(taskLabelLinks)+ .where(inArray(taskLabelLinks.taskId, ids));+ }+return { taskIds: ids };});};diff --git a/packages/database/src/models/taskLabel.ts b/packages/database/src/models/taskLabel.tsnew file mode 100644index 00000000000..523787e2802--- /dev/null+++ b/packages/database/src/models/taskLabel.ts@@ -0,0 +1,481 @@+import type { TaskLabelRef, TaskLabelWithUsage } from '@lobechat/types';+import { and, asc, count, eq, inArray, isNull, ne, notInArray, sql } from 'drizzle-orm';++import type { TaskLabelItem } from '../schemas';+import { taskLabelLinks, taskLabels, tasks } from '../schemas';+import type { LobeChatDatabase, Transaction } from '../type';+import { buildWorkspacePayload, buildWorkspaceWhere } from '../utils/workspace';+import { type TaskModelContext, taskOwnership } from './task/context';++/** Thrown for caller mistakes the router maps to BAD_REQUEST / CONFLICT. */+export class TaskLabelError extends Error {+ constructor(+ public readonly code:+ | 'GROUP_CONFLICT'+ | 'GROUP_NOT_ASSIGNABLE'+ | 'INVALID_PARENT'+ | 'LABEL_NOT_FOUND'+ | 'TASK_NOT_FOUND',+ message: string,+ ) {+ super(message);+ this.name = 'TaskLabelError';+ }+}++export interface CreateTaskLabelParams {+ color?: string | null;+ description?: string | null;+ isGroup?: boolean;+ name: string;+ parentId?: string | null;+ sortOrder?: number;+}++export type UpdateTaskLabelParams = Partial<+ Pick<TaskLabelItem, 'color' | 'description' | 'name' | 'parentId' | 'sortOrder'>+>;++const UUID_PATTERN = /^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/i;+const isUuid = (value: string) => UUID_PATTERN.test(value);++const toRef = (row: Pick<TaskLabelItem, 'color' | 'id' | 'name' | 'parentId'>): TaskLabelRef => ({+ color: row.color,+ id: row.id,+ name: row.name,+ parentId: row.parentId,+});++export class TaskLabelModel {+ private readonly userId: string;+ private readonly db: LobeChatDatabase;+ private readonly workspaceId?: string;+ private readonly ctx: TaskModelContext;++ constructor(db: LobeChatDatabase, userId: string, workspaceId?: string) {+ this.db = db;+ this.userId = userId;+ this.workspaceId = workspaceId;+ this.ctx = { db, userId, workspaceId };+ }++ // Labels are a workspace-level registry: every member sees and shares the+ // same label set (no per-member visibility). Personal mode falls back to+ // `user_id = ? AND workspace_id IS NULL`.+ private ownership = () =>+ buildWorkspaceWhere(+ { userId: this.userId, workspaceId: this.workspaceId },+ { userId: taskLabels.userId, workspaceId: taskLabels.workspaceId },+ );++ private payload = <T extends object>(value: T) =>+ buildWorkspacePayload({ userId: this.userId, workspaceId: this.workspaceId }, value);++ // ========== Registry ==========++ /**+ * Every label in scope, groups included, with the number of tasks carrying+ * it. The count only covers tasks the caller can see (task ownership,+ * trash and archive excluded) so it matches what the task list shows rather+ * than revealing how many of a teammate's private tasks use a shared label.+ */+ query = async (): Promise<TaskLabelWithUsage[]> => {+ const rows = await this.db+ .select({+ color: taskLabels.color,+ description: taskLabels.description,+ id: taskLabels.id,+ isGroup: taskLabels.isGroup,+ name: taskLabels.name,+ parentId: taskLabels.parentId,+ sortOrder: taskLabels.sortOrder,+ usageCount: count(tasks.id),+ })+ .from(taskLabels)+ .leftJoin(taskLabelLinks, eq(taskLabelLinks.labelId, taskLabels.id))+ .leftJoin(+ tasks,+ and(eq(tasks.id, taskLabelLinks.taskId), isNull(tasks.archivedAt), taskOwnership(this.ctx)),+ )+ .where(this.ownership())+ .groupBy(taskLabels.id)+ .orderBy(asc(taskLabels.sortOrder), asc(sql`lower(${taskLabels.name})`));++ return rows;+ };++ findById = async (id: string): Promise<TaskLabelItem | undefined> => {+ if (!isUuid(id)) return undefined;+ const [row] = await this.db+ .select()+ .from(taskLabels)+ .where(and(eq(taskLabels.id, id), this.ownership()))+ .limit(1);+ return row;+ };++ findByIds = async (ids: string[]): Promise<TaskLabelItem[]> => {+ // A malformed id simply resolves to nothing instead of an invalid-uuid cast error.+ ids = ids.filter(isUuid);+ if (ids.length === 0) return [];+ return this.db+ .select()+ .from(taskLabels)+ .where(and(inArray(taskLabels.id, ids), this.ownership()));+ };++ /** Case-insensitive name lookup; names are unique per scope. */+ findByNames = async (names: string[]): Promise<TaskLabelItem[]> => {+ const lowered = [...new Set(names.map((name) => name.trim().toLowerCase()))].filter(Boolean);+ if (lowered.length === 0) return [];+ return this.db+ .select()+ .from(taskLabels)+ .where(and(inArray(sql`lower(${taskLabels.name})`, lowered), this.ownership()));+ };++ /** Groups nest one level only, and only a group can be a parent. */+ private assertValidParent = async (+ parentId: string | null | undefined,+ isGroup: boolean,+ db: LobeChatDatabase | Transaction = this.db,+ ) => {+ if (!parentId) return;+ if (isGroup) throw new TaskLabelError('INVALID_PARENT', 'A label group cannot be nested');++ const [parent] = isUuid(parentId)+ ? await db+ .select({ isGroup: taskLabels.isGroup })+ .from(taskLabels)+ .where(and(eq(taskLabels.id, parentId), this.ownership()))+ .limit(1)+ : [];+ if (!parent || !parent.isGroup) {+ throw new TaskLabelError('INVALID_PARENT', `Label group not found: ${parentId}`);+ }+ };++ create = async (params: CreateTaskLabelParams): Promise<TaskLabelItem> => {+ const isGroup = params.isGroup ?? false;+ await this.assertValidParent(params.parentId, isGroup);++ const [row] = await this.db+ .insert(taskLabels)+ .values(+ this.payload({+ color: params.color ?? null,+ description: params.description ?? null,+ isGroup,+ name: params.name.trim(),+ parentId: params.parentId ?? null,+ sortOrder: params.sortOrder ?? 0,+ }),+ )+ .returning();++ return row;+ };++ update = async (id: string, value: UpdateTaskLabelParams): Promise<TaskLabelItem | undefined> => {+ const current = await this.findById(id);+ if (!current) throw new TaskLabelError('LABEL_NOT_FOUND', `Label not found: ${id}`);++ const write = async (db: LobeChatDatabase | Transaction) => {+ const [row] = await db+ .update(taskLabels)+ .set({+ ...value,+ ...(value.name !== undefined ? { name: value.name.trim() } : {}),+ updatedAt: new Date(),+ })+ .where(and(eq(taskLabels.id, id), this.ownership()))+ .returning();+ return row;+ };++ // No parent in the patch, or moving out of a group: nothing to check.+ if (!value.parentId) return write(this.db);++ // Moving into a group would break "one label per group" on tasks that+ // already carry a sibling, so refuse rather than silently dropping one.+ // The check and the move must not interleave with assignments or another+ // regroup: lock this label (assignments hold FOR SHARE on the labels they+ // attach), decide from its parent *under the lock* (a pre-lock read may be+ // stale), then lock every task carrying it (assignments hold the task row)+ // in the same label β task order assignments use, check, and write.+ const groupId = value.parentId;+ return this.db.transaction(async (tx) => {+ const [locked] = await tx+ .select({ parentId: taskLabels.parentId })+ .from(taskLabels)+ .where(and(eq(taskLabels.id, id), this.ownership()))+ .for('update');+ if (!locked) throw new TaskLabelError('LABEL_NOT_FOUND', `Label not found: ${id}`);++ if (locked.parentId !== groupId) {+ await this.assertValidParent(groupId, current.isGroup, tx);+ await tx+ .select({ id: tasks.id })+ .from(tasks)+ .where(+ inArray(+ tasks.id,+ tx+ .select({ taskId: taskLabelLinks.taskId })+ .from(taskLabelLinks)+ .where(eq(taskLabelLinks.labelId, id)),+ ),+ )+ .orderBy(asc(tasks.id))+ .for('update');+ await this.assertNoGroupConflict(id, groupId, tx);+ }+ return write(tx);+ });+ };++ private assertNoGroupConflict = async (+ labelId: string,+ groupId: string,+ db: LobeChatDatabase | Transaction,+ ) => {+ const sibling = db+ .select({ taskId: taskLabelLinks.taskId })+ .from(taskLabelLinks)+ .innerJoin(taskLabels, eq(taskLabels.id, taskLabelLinks.labelId))+ .where(and(eq(taskLabels.parentId, groupId), ne(taskLabels.id, labelId)));++ const [conflict] = await db+ .select({ taskId: taskLabelLinks.taskId })+ .from(taskLabelLinks)+ .where(and(eq(taskLabelLinks.labelId, labelId), inArray(taskLabelLinks.taskId, sibling)))+ .limit(1);++ if (conflict) {+ throw new TaskLabelError(+ 'GROUP_CONFLICT',+ 'Some tasks already carry another label from this group',+ );+ }+ };++ /** Hard delete; links (and, for a group, its labels) go with it via FK cascade. */+ delete = async (id: string) => {+ if (!isUuid(id)) return;+ return this.db.delete(taskLabels).where(and(eq(taskLabels.id, id), this.ownership()));+ };++ // ========== Task assignments ==========++ /** Labels on each of the given tasks, keyed by task id; tasks the caller cannot see are skipped. */+ getLabelsForTasks = async (taskIds: string[]): Promise<Record<string, TaskLabelRef[]>> => {+ if (taskIds.length === 0) return {};++ const rows = await this.db+ .select({+ color: taskLabels.color,+ id: taskLabels.id,+ name: taskLabels.name,+ parentId: taskLabels.parentId,+ sortOrder: taskLabels.sortOrder,+ taskId: taskLabelLinks.taskId,+ })+ .from(taskLabelLinks)+ .innerJoin(taskLabels, eq(taskLabels.id, taskLabelLinks.labelId))+ .innerJoin(tasks, eq(tasks.id, taskLabelLinks.taskId))+ .where(+ and(inArray(taskLabelLinks.taskId, taskIds), this.ownership(), taskOwnership(this.ctx)),+ )+ .orderBy(asc(taskLabels.sortOrder), asc(sql`lower(${taskLabels.name})`));++ const result: Record<string, TaskLabelRef[]> = {};+ for (const row of rows) {+ (result[row.taskId] ??= []).push(toRef(row));+ }+ return result;+ };++ getTaskLabels = async (taskId: string): Promise<TaskLabelRef[]> =>+ (await this.getLabelsForTasks([taskId]))[taskId] ?? [];++ /**+ * Check the task is in the caller's scope and take a row lock on it for the+ * rest of the transaction. The unique index only covers `(task_id, label_id)`, so "one+ * label per group" is a read-then-write invariant: without serializing+ * writers per task, two concurrent attaches of different siblings could+ * each delete the old one and both insert. Holding the task row lock makes+ * the second writer wait, and its sibling DELETE (a fresh READ COMMITTED+ * snapshot) then sees and replaces the first writer's label.+ */+ private lockTaskInScope = async (taskId: string, tx: Transaction) => {+ const [row] = await tx+ .select({ id: tasks.id, userId: tasks.createdByUserId, workspaceId: tasks.workspaceId })+ .from(tasks)+ .where(and(eq(tasks.id, taskId), taskOwnership(this.ctx)))+ .limit(1)+ .for('update', { of: tasks });+ if (!row) throw new TaskLabelError('TASK_NOT_FOUND', `Task not found: ${taskId}`);+ return row;+ };++ /**+ * A link is owned by its task's owner, not by whoever attached it: the+ * `user_id` FK cascades, and a teammate who labelled a shared task leaving+ * must not strip the label. The owner leaving takes the task (and links)+ * with it anyway.+ */+ private linkRow = (+ task: { userId: string; workspaceId: string | null },+ taskId: string,+ labelId: string,+ ) => ({ labelId, taskId, userId: task.userId, workspaceId: task.workspaceId });++ /**+ * Resolve ids to assignable labels: every id must exist in scope, none may+ * be a group, and the set may hold at most one label per group.+ *+ * Inside an assignment transaction pass `tx`: the rows are then read under+ * FOR SHARE, so a concurrent regroup (which locks the label FOR UPDATE)+ * either finishes first and is seen here, or waits for this write and then+ * sees its links. Always taken before the task row lock (label β task).+ */+ private resolveAssignable = async (+ labelIds: string[],+ tx?: Transaction,+ ): Promise<TaskLabelItem[]> => {+ const ids = [...new Set(labelIds)];+ const valid = ids.filter(isUuid);+ const labels =+ tx && valid.length > 0+ ? await tx+ .select()+ .from(taskLabels)+ .where(and(inArray(taskLabels.id, valid), this.ownership()))+ .orderBy(asc(taskLabels.id))+ .for('share')+ : await this.findByIds(ids);++ const found = new Set(labels.map((label) => label.id));+ const missing = ids.filter((id) => !found.has(id));+ if (missing.length > 0) {+ throw new TaskLabelError('LABEL_NOT_FOUND', `Labels not found: ${missing.join(', ')}`);+ }++ const group = labels.find((label) => label.isGroup);+ if (group) {+ throw new TaskLabelError(+ 'GROUP_NOT_ASSIGNABLE',+ `"${group.name}" is a label group; pick one of its labels`,+ );+ }++ const seenGroups = new Set<string>();+ for (const label of labels) {+ if (!label.parentId) continue;+ if (seenGroups.has(label.parentId)) {+ throw new TaskLabelError(+ 'GROUP_CONFLICT',+ 'A task can carry only one label from each group',+ );+ }+ seenGroups.add(label.parentId);+ }++ return labels;+ };++ /** Validate a label set for assignment without writing anything. */+ assertAssignable = async (labelIds: string[]): Promise<void> => {+ await this.resolveAssignable(labelIds);+ };++ /**+ * Attach and detach labels on a task in one transaction, so an edit that+ * swaps labels never commits half-way. Attaching a grouped label replaces+ * whatever sibling from the same group the task already carried (Linear+ * behavior). Removals apply before additions.+ */+ changeTaskLabels = async (+ taskId: string,+ { add = [], remove = [] }: { add?: string[]; remove?: string[] },+ ): Promise<TaskLabelRef[]> => {+ const removeIds = remove.filter(isUuid);++ await this.db.transaction(async (tx) => {+ const labels = add.length > 0 ? await this.resolveAssignable(add, tx) : [];+ const task = await this.lockTaskInScope(taskId, tx);++ if (removeIds.length > 0) {+ await tx+ .delete(taskLabelLinks)+ .where(+ and(eq(taskLabelLinks.taskId, taskId), inArray(taskLabelLinks.labelId, removeIds)),+ );+ }++ if (labels.length === 0) return;++ const groupIds = [+ ...new Set(labels.map((l) => l.parentId).filter((id): id is string => !!id)),+ ];+ if (groupIds.length > 0) {+ const siblings = tx+ .select({ id: taskLabels.id })+ .from(taskLabels)+ .where(inArray(taskLabels.parentId, groupIds));+ await tx.delete(taskLabelLinks).where(+ and(+ eq(taskLabelLinks.taskId, taskId),+ inArray(taskLabelLinks.labelId, siblings),+ notInArray(+ taskLabelLinks.labelId,+ labels.map((l) => l.id),+ ),+ ),+ );+ }++ await tx+ .insert(taskLabelLinks)+ .values(labels.map((label) => this.linkRow(task, taskId, label.id)))+ .onConflictDoNothing();+ });++ return this.getTaskLabels(taskId);+ };++ /** Attach labels to a task; see {@link changeTaskLabels} for group handling. */+ addTaskLabels = async (taskId: string, labelIds: string[]): Promise<TaskLabelRef[]> => {+ if (labelIds.length === 0) return this.getTaskLabels(taskId);+ return this.changeTaskLabels(taskId, { add: labelIds });+ };++ removeTaskLabels = async (taskId: string, labelIds: string[]): Promise<TaskLabelRef[]> =>+ this.changeTaskLabels(taskId, { remove: labelIds });++ /** Replace the task's full label set. */+ setTaskLabels = async (taskId: string, labelIds: string[]): Promise<TaskLabelRef[]> => {+ await this.db.transaction(async (tx) => {+ const labels = await this.resolveAssignable(labelIds, tx);+ const nextIds = labels.map((label) => label.id);+ const task = await this.lockTaskInScope(taskId, tx);++ await tx+ .delete(taskLabelLinks)+ .where(+ nextIds.length > 0+ ? and(eq(taskLabelLinks.taskId, taskId), notInArray(taskLabelLinks.labelId, nextIds))+ : eq(taskLabelLinks.taskId, taskId),+ );++ if (nextIds.length > 0) {+ await tx+ .insert(taskLabelLinks)+ .values(nextIds.map((labelId) => this.linkRow(task, taskId, labelId)))+ .onConflictDoNothing();+ }+ });++ return this.getTaskLabels(taskId);+ };+}diff --git a/packages/database/src/models/user.ts b/packages/database/src/models/user.tsindex 7a34618fa75..e896bdbbd75 100644--- a/packages/database/src/models/user.ts+++ b/packages/database/src/models/user.ts@@ -27,6 +27,7 @@ import {messages,nextauthAccounts,sessions,+ taskLabels,topics,users,userSettings,@@ -618,6 +619,13 @@ export class UserModel {}};await applyRemainingTimeout();+ // Lock the account first. A concurrent insert referencing it takes a+ // KEY SHARE lock on this row, so one already in flight commits before we+ // proceed (and the cleanups below see it), and any later one waits and+ // then fails its FK β none can slip in between a cleanup and the final+ // delete, where a SET NULL FK would orphan it.+ await tx.select({ id: users.id }).from(users).where(eq(users.id, id)).for('update');+ await applyRemainingTimeout();// A goal decision can reference the same user that owns its parent goal.// Delete the graph first so its CASCADE completes before the user delete// runs the decision's SET NULL action on an already-deleted node.@@ -637,6 +645,12 @@ export class UserModel {),);await applyRemainingTimeout();+ // Personal task labels go with their owner; workspace labels stay and the+ // user cascade only clears their `user_id`.+ await tx+ .delete(taskLabels)+ .where(and(eq(taskLabels.userId, id), isNull(taskLabels.workspaceId)));+ await applyRemainingTimeout();const result = await tx.delete(users).where(eq(users.id, id));if (deadline !== undefined && Date.now() >= deadline)throw new Error('Account deletion transaction deadline exceeded');diff --git a/packages/database/src/schemas/index.ts b/packages/database/src/schemas/index.tsindex c1698868ddb..bf5fb2b6b20 100644--- a/packages/database/src/schemas/index.ts+++ b/packages/database/src/schemas/index.ts@@ -68,6 +68,7 @@ export * from './signalDecision';export * from './systemBotProvider';export * from './task';export * from './taskExternalLink';+export * from './taskLabel';export * from './topic';export * from './topicAnalysis';export * from './topicComment';diff --git a/packages/database/src/schemas/taskLabel.ts b/packages/database/src/schemas/taskLabel.tsnew file mode 100644index 00000000000..c4b5f90d85a--- /dev/null+++ b/packages/database/src/schemas/taskLabel.ts@@ -0,0 +1,109 @@+import { sql } from 'drizzle-orm';+import {+ boolean,+ foreignKey,+ index,+ integer,+ pgTable,+ text,+ uniqueIndex,+ uuid,+} from 'drizzle-orm/pg-core';++import { createdAt, timestamps } from './_helpers';+import { tasks } from './task';+import { users } from './user';+import { workspaces } from './workspace';++/**+ * Task labels β a workspace-level (or, in personal mode, per-user) label+ * registry modelled on Linear's issue labels. Every workspace member shares+ * the same label set; `workspace_id IS NULL` rows belong to a single user.+ *+ * Labels can be grouped one level deep: a row with `is_group = true` is a+ * group (it can never be attached to a task), and its children point at it+ * through `parent_id`. A task carries at most one label from each group β+ * the model enforces that when attaching (picking a sibling replaces the+ * previous one), the same way Linear treats "Type: Bug / Feature".+ */+export const taskLabels = pgTable(+ 'task_labels',+ {+ id: uuid('id').defaultRandom().notNull().primaryKey(),+ /**+ * Creator. Workspace labels outlive their creator (the user delete only+ * clears this, like workspace channels); personal labels are deleted+ * explicitly in `UserModel.deleteUser`.+ */+ userId: text('user_id').references(() => users.id, { onDelete: 'set null' }),+ workspaceId: text('workspace_id').references(() => workspaces.id, { onDelete: 'cascade' }),++ /** Group this label belongs to; deleting the group deletes its labels. */+ parentId: uuid('parent_id'),+ isGroup: boolean('is_group').default(false).notNull(),+ name: text('name').notNull(),+ description: text('description'),+ /** Display color as a CSS hex value, e.g. `#F5A623` (validated at the router). */+ color: text('color'),+ sortOrder: integer('sort_order').default(0).notNull(),++ ...timestamps,+ },+ (t) => [+ foreignKey({+ columns: [t.parentId],+ foreignColumns: [t.id],+ name: 'task_labels_parent_id_task_labels_id_fk',+ }).onDelete('cascade'),+ index('task_labels_user_id_idx').on(t.userId),+ index('task_labels_workspace_id_idx').on(t.workspaceId),+ index('task_labels_parent_id_idx').on(t.parentId),+ // Names are what the CLI and agent tools address labels by, so they are+ // unique per scope (case-insensitively), groups included β `--label Bug`+ // must resolve to exactly one row. Split in two because the scope key+ // differs: personal rows key on the owner, workspace rows on the workspace.+ uniqueIndex('task_labels_user_id_name_unique')+ .on(t.userId, sql`lower(${t.name})`)+ .where(sql`${t.workspaceId} IS NULL`),+ uniqueIndex('task_labels_workspace_id_name_unique')+ .on(t.workspaceId, sql`lower(${t.name})`)+ .where(sql`${t.workspaceId} IS NOT NULL`),+ ],+);++export type NewTaskLabel = typeof taskLabels.$inferInsert;+export type TaskLabelItem = typeof taskLabels.$inferSelect;++/**+ * Task β label assignments. Rows are only read in bulk for a task (or a+ * label), always joined back through `tasks` under the task ownership+ * predicate, so they carry no visibility mirror of their own: a link to a+ * task the caller cannot see is unreachable by construction.+ */+export const taskLabelLinks = pgTable(+ 'task_label_links',+ {+ id: uuid('id').defaultRandom().primaryKey().notNull(),+ taskId: text('task_id')+ .references(() => tasks.id, { onDelete: 'cascade' })+ .notNull(),+ labelId: uuid('label_id')+ .references(() => taskLabels.id, { onDelete: 'cascade' })+ .notNull(),+ userId: text('user_id')+ .references(() => users.id, { onDelete: 'cascade' })+ .notNull(),+ workspaceId: text('workspace_id').references(() => workspaces.id, { onDelete: 'cascade' }),++ createdAt: createdAt(),+ },+ (t) => [+ uniqueIndex('task_label_links_task_id_label_id_unique').on(t.taskId, t.labelId),+ index('task_label_links_label_id_idx').on(t.labelId),+ index('task_label_links_user_id_idx').on(t.userId),+ index('task_label_links_workspace_id_idx').on(t.workspaceId),+ ],+);++export type NewTaskLabelLink = typeof taskLabelLinks.$inferInsert;+export type TaskLabelLinkItem = typeof taskLabelLinks.$inferSelect;diff --git a/packages/types/src/task/index.ts b/packages/types/src/task/index.tsindex 6844ef9a907..99e8a370d76 100644--- a/packages/types/src/task/index.ts+++ b/packages/types/src/task/index.ts@@ -3,6 +3,7 @@ import type { ChatFileItem } from '../message/ui/chat';export * from './archive';export * from './execution';+export * from './label';export * from './listFilter';// ββ Task type aliases ββdiff --git a/packages/types/src/task/label.ts b/packages/types/src/task/label.tsnew file mode 100644index 00000000000..a87ace420b3--- /dev/null+++ b/packages/types/src/task/label.ts@@ -0,0 +1,52 @@+/**+ * Task labels (Linear-style). A workspace-level registry of colored labels,+ * optionally grouped one level deep. A group (`isGroup`) is never attached to+ * a task; a task carries at most one label from each group.+ */+export interface TaskLabel {+ color?: string | null;+ description?: string | null;+ id: string;+ isGroup: boolean;+ name: string;+ /** The group this label belongs to, or null for a top-level label / a group. */+ parentId?: string | null;+ sortOrder: number;+}++/** A registry entry with the number of visible tasks carrying it. */+export interface TaskLabelWithUsage extends TaskLabel {+ usageCount: number;+}++/** The label fields a task row carries for display (list rows, kanban cards, detail). */+export interface TaskLabelRef {+ color?: string | null;+ id: string;+ name: string;+ parentId?: string | null;+}++/** Longest label name accepted by the router, CLI and agent tools. */+export const TASK_LABEL_NAME_MAX_LENGTH = 64;++/**+ * Separator for addressing a grouped label by path (`Type/Bug`). Names are+ * unique per scope, so the bare name also resolves; the path form only reads+ * better and is checked against the group.+ */+export const TASK_LABEL_PATH_SEPARATOR = '/';++/** Default palette offered by the label picker; values are CSS hex literals. */+export const TASK_LABEL_COLORS = [+ '#95A2B3',+ '#5E6AD2',+ '#26B5CE',+ '#4CB782',+ '#F2C94C',+ '#F2994A',+ '#EB5757',+ '#BB87FC',+] as const;++export const DEFAULT_TASK_LABEL_COLOR = TASK_LABEL_COLORS[0];