🤯 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 relational artboard tables (#22772)
Innei4cdc006d0695
diff --git a/docs/development/database-schema.dbml b/docs/development/database-schema.dbmlindex 436c692a4a6..fedf87cab7b 100644--- a/docs/development/database-schema.dbml+++ b/docs/development/database-schema.dbml@@ -1250,6 +1250,205 @@ table api_keys {}}+table artboard_boards {+ id uuid [pk, not null, default: `gen_random_uuid()`]+ artboard_id text [not null]+ page_id text [not null]+ group_id text+ round_id uuid+ user_id text [not null]+ workspace_id text+ project_id text+ acceptance_flow_node_id uuid+ type text [not null]+ title text [not null]+ description text+ expected text+ rect jsonb [not null]+ source_work_version_id uuid+ source_path text+ source_file_id text+ metadata jsonb+ 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 {+++ artboard_id [name: 'artboard_boards_artboard_id_idx']+ page_id [name: 'artboard_boards_page_id_idx']+ group_id [name: 'artboard_boards_group_id_idx']+ round_id [name: 'artboard_boards_round_id_idx']+ project_id [name: 'artboard_boards_project_id_idx']+ acceptance_flow_node_id [name: 'artboard_boards_acceptance_flow_node_id_unique', unique]+ source_work_version_id [name: 'artboard_boards_source_work_version_id_idx']+ user_id [name: 'artboard_boards_user_id_idx']+ workspace_id [name: 'artboard_boards_workspace_id_idx']+ }+}++table artboard_comments {+ id uuid [pk, not null, default: `gen_random_uuid()`]+ artboard_id text [not null]+ parent_comment_id uuid+ author_user_id text+ author_agent_id text+ user_id text [not null]+ workspace_id text+ page_id text+ group_id text+ board_id uuid+ content text [not null]+ client_id text [not null]+ anchor jsonb+ delivered_at "timestamp with time zone"+ resolved_at "timestamp with time zone"+ resolved_by_user_id text+ metadata jsonb+ 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 {+ (artboard_id, author_user_id, client_id) [name: 'artboard_comments_artboard_id_author_user_id_client_id_unique', unique]+ (artboard_id, created_at) [name: 'artboard_comments_artboard_id_created_at_idx']+ parent_comment_id [name: 'artboard_comments_parent_comment_id_idx']+ board_id [name: 'artboard_comments_board_id_idx']+ user_id [name: 'artboard_comments_user_id_idx']+ workspace_id [name: 'artboard_comments_workspace_id_idx']+ page_id [name: 'artboard_comments_page_id_idx']+ group_id [name: 'artboard_comments_group_id_idx']+ }+}++table artboard_edges {+ id uuid [pk, not null, default: `gen_random_uuid()`]+ artboard_id text [not null]+ source_board_id uuid [not null]+ target_board_id uuid [not null]+ user_id text [not null]+ workspace_id text+ acceptance_flow_edge_id uuid+ label text [not null, default: '']+ condition text+ is_default boolean [not null, default: false]+ sort_order integer [not null, default: 0]+ metadata jsonb+ 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 {+ artboard_id [name: 'artboard_edges_artboard_id_idx']+ source_board_id [name: 'artboard_edges_source_board_id_idx']+ source_board_id [name: 'artboard_edges_source_board_id_default_unique', unique]+ target_board_id [name: 'artboard_edges_target_board_id_idx']+ acceptance_flow_edge_id [name: 'artboard_edges_acceptance_flow_edge_id_unique', unique]+ user_id [name: 'artboard_edges_user_id_idx']+ workspace_id [name: 'artboard_edges_workspace_id_idx']+ }+}++table artboard_groups {+ id text [pk, not null]+ artboard_id text [not null]+ page_id text [not null]+ user_id text [not null]+ workspace_id text+ kind text [not null]+ title text [not null]+ description text+ rect jsonb [not null]+ metadata jsonb+ 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 {+ artboard_id [name: 'artboard_groups_artboard_id_idx']+ page_id [name: 'artboard_groups_page_id_idx']+ user_id [name: 'artboard_groups_user_id_idx']+ workspace_id [name: 'artboard_groups_workspace_id_idx']+ }+}++table artboard_pages {+ id text [pk, not null]+ artboard_id text [not null]+ user_id text [not null]+ workspace_id text+ name text [not null]+ sort_order integer [not null, default: 0]+ metadata jsonb+ 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 {+ artboard_id [name: 'artboard_pages_artboard_id_idx']+ user_id [name: 'artboard_pages_user_id_idx']+ workspace_id [name: 'artboard_pages_workspace_id_idx']+ }+}++table artboard_rounds {+ id uuid [pk, not null, default: `gen_random_uuid()`]+ artboard_id text [not null]+ page_id text [not null]+ user_id text [not null]+ workspace_id text+ title text [not null]+ status text [not null, default: 'open']+ recommended_board_id uuid+ chosen_board_id uuid+ selected_by text+ selected_at "timestamp with time zone"+ metadata jsonb+ 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 {+ artboard_id [name: 'artboard_rounds_artboard_id_idx']+ page_id [name: 'artboard_rounds_page_id_idx']+ user_id [name: 'artboard_rounds_user_id_idx']+ workspace_id [name: 'artboard_rounds_workspace_id_idx']+ recommended_board_id [name: 'artboard_rounds_recommended_board_id_idx']+ chosen_board_id [name: 'artboard_rounds_chosen_board_id_idx']+ }+}++table artboards {+ id text [pk, not null]+ user_id text [not null]+ workspace_id text+ topic_id text+ task_id text+ project_id text+ acceptance_id uuid+ title text [not null]+ description text+ content text+ phase text [not null, default: 'discuss']+ revision integer [not null, default: 1]+ metadata jsonb+ 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: 'artboards_user_id_idx']+ workspace_id [name: 'artboards_workspace_id_idx']+ topic_id [name: 'artboards_topic_id_idx']+ task_id [name: 'artboards_task_id_idx']+ project_id [name: 'artboards_project_id_idx']+ phase [name: 'artboards_phase_idx']+ created_at [name: 'artboards_created_at_idx']+ updated_at [name: 'artboards_updated_at_idx']+ }+}+table async_tasks {id uuid [pk, not null, default: `gen_random_uuid()`]type textdiff --git a/packages/database/migrations/0217_artboards.sql b/packages/database/migrations/0217_artboards.sqlnew file mode 100644index 00000000000..41ddae61b72--- /dev/null+++ b/packages/database/migrations/0217_artboards.sql@@ -0,0 +1,266 @@+CREATE TABLE IF NOT EXISTS "artboard_boards" (+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,+ "artboard_id" text NOT NULL,+ "page_id" text NOT NULL,+ "group_id" text,+ "round_id" uuid,+ "user_id" text NOT NULL,+ "workspace_id" text,+ "project_id" text,+ "acceptance_flow_node_id" uuid,+ "type" text NOT NULL,+ "title" text NOT NULL,+ "description" text,+ "expected" text,+ "rect" jsonb NOT NULL,+ "source_work_version_id" uuid,+ "source_path" text,+ "source_file_id" text,+ "metadata" jsonb,+ "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,+ CONSTRAINT "artboard_boards_single_source_check" CHECK (num_nonnulls("artboard_boards"."source_work_version_id", "artboard_boards"."source_file_id") <= 1),+ CONSTRAINT "artboard_boards_decision_no_source_check" CHECK ("artboard_boards"."type" <> 'decision' OR num_nonnulls("artboard_boards"."source_work_version_id", "artboard_boards"."source_file_id", "artboard_boards"."source_path") = 0)+);+--> statement-breakpoint+CREATE TABLE IF NOT EXISTS "artboard_comments" (+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,+ "artboard_id" text NOT NULL,+ "parent_comment_id" uuid,+ "author_user_id" text,+ "author_agent_id" text,+ "user_id" text NOT NULL,+ "workspace_id" text,+ "page_id" text,+ "group_id" text,+ "board_id" uuid,+ "content" text NOT NULL,+ "client_id" text NOT NULL,+ "anchor" jsonb,+ "delivered_at" timestamp with time zone,+ "resolved_at" timestamp with time zone,+ "resolved_by_user_id" text,+ "metadata" jsonb,+ "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+CREATE TABLE IF NOT EXISTS "artboard_edges" (+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,+ "artboard_id" text NOT NULL,+ "source_board_id" uuid NOT NULL,+ "target_board_id" uuid NOT NULL,+ "user_id" text NOT NULL,+ "workspace_id" text,+ "acceptance_flow_edge_id" uuid,+ "label" text DEFAULT '' NOT NULL,+ "condition" text,+ "is_default" boolean DEFAULT false NOT NULL,+ "sort_order" integer DEFAULT 0 NOT NULL,+ "metadata" jsonb,+ "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+CREATE TABLE IF NOT EXISTS "artboard_groups" (+ "id" text PRIMARY KEY NOT NULL,+ "artboard_id" text NOT NULL,+ "page_id" text NOT NULL,+ "user_id" text NOT NULL,+ "workspace_id" text,+ "kind" text NOT NULL,+ "title" text NOT NULL,+ "description" text,+ "rect" jsonb NOT NULL,+ "metadata" jsonb,+ "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+CREATE TABLE IF NOT EXISTS "artboard_pages" (+ "id" text PRIMARY KEY NOT NULL,+ "artboard_id" text NOT NULL,+ "user_id" text NOT NULL,+ "workspace_id" text,+ "name" text NOT NULL,+ "sort_order" integer DEFAULT 0 NOT NULL,+ "metadata" jsonb,+ "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+CREATE TABLE IF NOT EXISTS "artboard_rounds" (+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,+ "artboard_id" text NOT NULL,+ "page_id" text NOT NULL,+ "user_id" text NOT NULL,+ "workspace_id" text,+ "title" text NOT NULL,+ "status" text DEFAULT 'open' NOT NULL,+ "recommended_board_id" uuid,+ "chosen_board_id" uuid,+ "selected_by" text,+ "selected_at" timestamp with time zone,+ "metadata" jsonb,+ "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+CREATE TABLE IF NOT EXISTS "artboards" (+ "id" text PRIMARY KEY NOT NULL,+ "user_id" text NOT NULL,+ "workspace_id" text,+ "topic_id" text,+ "task_id" text,+ "project_id" text,+ "acceptance_id" uuid,+ "title" text NOT NULL,+ "description" text,+ "content" text,+ "phase" text DEFAULT 'discuss' NOT NULL,+ "revision" integer DEFAULT 1 NOT NULL,+ "metadata" jsonb,+ "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 "artboard_boards" DROP CONSTRAINT IF EXISTS "artboard_boards_artboard_id_artboards_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_boards" ADD CONSTRAINT "artboard_boards_artboard_id_artboards_id_fk" FOREIGN KEY ("artboard_id") REFERENCES "public"."artboards"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_boards" DROP CONSTRAINT IF EXISTS "artboard_boards_page_id_artboard_pages_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_boards" ADD CONSTRAINT "artboard_boards_page_id_artboard_pages_id_fk" FOREIGN KEY ("page_id") REFERENCES "public"."artboard_pages"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_boards" DROP CONSTRAINT IF EXISTS "artboard_boards_group_id_artboard_groups_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_boards" ADD CONSTRAINT "artboard_boards_group_id_artboard_groups_id_fk" FOREIGN KEY ("group_id") REFERENCES "public"."artboard_groups"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_boards" DROP CONSTRAINT IF EXISTS "artboard_boards_round_id_artboard_rounds_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_boards" ADD CONSTRAINT "artboard_boards_round_id_artboard_rounds_id_fk" FOREIGN KEY ("round_id") REFERENCES "public"."artboard_rounds"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_boards" DROP CONSTRAINT IF EXISTS "artboard_boards_user_id_users_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_boards" ADD CONSTRAINT "artboard_boards_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_boards" DROP CONSTRAINT IF EXISTS "artboard_boards_workspace_id_workspaces_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_boards" ADD CONSTRAINT "artboard_boards_workspace_id_workspaces_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspaces"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_boards" DROP CONSTRAINT IF EXISTS "artboard_boards_project_id_projects_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_boards" ADD CONSTRAINT "artboard_boards_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_boards" DROP CONSTRAINT IF EXISTS "artboard_boards_source_work_version_id_work_versions_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_boards" ADD CONSTRAINT "artboard_boards_source_work_version_id_work_versions_id_fk" FOREIGN KEY ("source_work_version_id") REFERENCES "public"."work_versions"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_boards" DROP CONSTRAINT IF EXISTS "artboard_boards_source_file_id_files_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_boards" ADD CONSTRAINT "artboard_boards_source_file_id_files_id_fk" FOREIGN KEY ("source_file_id") REFERENCES "public"."files"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_comments" DROP CONSTRAINT IF EXISTS "artboard_comments_artboard_id_artboards_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_comments" ADD CONSTRAINT "artboard_comments_artboard_id_artboards_id_fk" FOREIGN KEY ("artboard_id") REFERENCES "public"."artboards"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_comments" DROP CONSTRAINT IF EXISTS "artboard_comments_parent_comment_id_artboard_comments_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_comments" ADD CONSTRAINT "artboard_comments_parent_comment_id_artboard_comments_id_fk" FOREIGN KEY ("parent_comment_id") REFERENCES "public"."artboard_comments"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_comments" DROP CONSTRAINT IF EXISTS "artboard_comments_author_user_id_users_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_comments" ADD CONSTRAINT "artboard_comments_author_user_id_users_id_fk" FOREIGN KEY ("author_user_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_comments" DROP CONSTRAINT IF EXISTS "artboard_comments_author_agent_id_agents_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_comments" ADD CONSTRAINT "artboard_comments_author_agent_id_agents_id_fk" FOREIGN KEY ("author_agent_id") REFERENCES "public"."agents"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_comments" DROP CONSTRAINT IF EXISTS "artboard_comments_user_id_users_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_comments" ADD CONSTRAINT "artboard_comments_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_comments" DROP CONSTRAINT IF EXISTS "artboard_comments_workspace_id_workspaces_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_comments" ADD CONSTRAINT "artboard_comments_workspace_id_workspaces_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspaces"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_comments" DROP CONSTRAINT IF EXISTS "artboard_comments_page_id_artboard_pages_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_comments" ADD CONSTRAINT "artboard_comments_page_id_artboard_pages_id_fk" FOREIGN KEY ("page_id") REFERENCES "public"."artboard_pages"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_comments" DROP CONSTRAINT IF EXISTS "artboard_comments_group_id_artboard_groups_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_comments" ADD CONSTRAINT "artboard_comments_group_id_artboard_groups_id_fk" FOREIGN KEY ("group_id") REFERENCES "public"."artboard_groups"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_comments" DROP CONSTRAINT IF EXISTS "artboard_comments_board_id_artboard_boards_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_comments" ADD CONSTRAINT "artboard_comments_board_id_artboard_boards_id_fk" FOREIGN KEY ("board_id") REFERENCES "public"."artboard_boards"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_comments" DROP CONSTRAINT IF EXISTS "artboard_comments_resolved_by_user_id_users_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_comments" ADD CONSTRAINT "artboard_comments_resolved_by_user_id_users_id_fk" FOREIGN KEY ("resolved_by_user_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_edges" DROP CONSTRAINT IF EXISTS "artboard_edges_artboard_id_artboards_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_edges" ADD CONSTRAINT "artboard_edges_artboard_id_artboards_id_fk" FOREIGN KEY ("artboard_id") REFERENCES "public"."artboards"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_edges" DROP CONSTRAINT IF EXISTS "artboard_edges_source_board_id_artboard_boards_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_edges" ADD CONSTRAINT "artboard_edges_source_board_id_artboard_boards_id_fk" FOREIGN KEY ("source_board_id") REFERENCES "public"."artboard_boards"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_edges" DROP CONSTRAINT IF EXISTS "artboard_edges_target_board_id_artboard_boards_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_edges" ADD CONSTRAINT "artboard_edges_target_board_id_artboard_boards_id_fk" FOREIGN KEY ("target_board_id") REFERENCES "public"."artboard_boards"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_edges" DROP CONSTRAINT IF EXISTS "artboard_edges_user_id_users_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_edges" ADD CONSTRAINT "artboard_edges_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_edges" DROP CONSTRAINT IF EXISTS "artboard_edges_workspace_id_workspaces_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_edges" ADD CONSTRAINT "artboard_edges_workspace_id_workspaces_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspaces"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_groups" DROP CONSTRAINT IF EXISTS "artboard_groups_artboard_id_artboards_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_groups" ADD CONSTRAINT "artboard_groups_artboard_id_artboards_id_fk" FOREIGN KEY ("artboard_id") REFERENCES "public"."artboards"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_groups" DROP CONSTRAINT IF EXISTS "artboard_groups_page_id_artboard_pages_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_groups" ADD CONSTRAINT "artboard_groups_page_id_artboard_pages_id_fk" FOREIGN KEY ("page_id") REFERENCES "public"."artboard_pages"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_groups" DROP CONSTRAINT IF EXISTS "artboard_groups_user_id_users_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_groups" ADD CONSTRAINT "artboard_groups_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_groups" DROP CONSTRAINT IF EXISTS "artboard_groups_workspace_id_workspaces_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_groups" ADD CONSTRAINT "artboard_groups_workspace_id_workspaces_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspaces"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_pages" DROP CONSTRAINT IF EXISTS "artboard_pages_artboard_id_artboards_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_pages" ADD CONSTRAINT "artboard_pages_artboard_id_artboards_id_fk" FOREIGN KEY ("artboard_id") REFERENCES "public"."artboards"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_pages" DROP CONSTRAINT IF EXISTS "artboard_pages_user_id_users_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_pages" ADD CONSTRAINT "artboard_pages_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_pages" DROP CONSTRAINT IF EXISTS "artboard_pages_workspace_id_workspaces_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_pages" ADD CONSTRAINT "artboard_pages_workspace_id_workspaces_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspaces"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_rounds" DROP CONSTRAINT IF EXISTS "artboard_rounds_artboard_id_artboards_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_rounds" ADD CONSTRAINT "artboard_rounds_artboard_id_artboards_id_fk" FOREIGN KEY ("artboard_id") REFERENCES "public"."artboards"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_rounds" DROP CONSTRAINT IF EXISTS "artboard_rounds_page_id_artboard_pages_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_rounds" ADD CONSTRAINT "artboard_rounds_page_id_artboard_pages_id_fk" FOREIGN KEY ("page_id") REFERENCES "public"."artboard_pages"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_rounds" DROP CONSTRAINT IF EXISTS "artboard_rounds_user_id_users_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_rounds" ADD CONSTRAINT "artboard_rounds_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_rounds" DROP CONSTRAINT IF EXISTS "artboard_rounds_workspace_id_workspaces_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_rounds" ADD CONSTRAINT "artboard_rounds_workspace_id_workspaces_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspaces"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_rounds" DROP CONSTRAINT IF EXISTS "artboard_rounds_recommended_board_id_artboard_boards_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_rounds" ADD CONSTRAINT "artboard_rounds_recommended_board_id_artboard_boards_id_fk" FOREIGN KEY ("recommended_board_id") REFERENCES "public"."artboard_boards"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_rounds" DROP CONSTRAINT IF EXISTS "artboard_rounds_chosen_board_id_artboard_boards_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_rounds" ADD CONSTRAINT "artboard_rounds_chosen_board_id_artboard_boards_id_fk" FOREIGN KEY ("chosen_board_id") REFERENCES "public"."artboard_boards"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboard_rounds" DROP CONSTRAINT IF EXISTS "artboard_rounds_selected_by_users_id_fk";--> statement-breakpoint+ALTER TABLE "artboard_rounds" ADD CONSTRAINT "artboard_rounds_selected_by_users_id_fk" FOREIGN KEY ("selected_by") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboards" DROP CONSTRAINT IF EXISTS "artboards_user_id_users_id_fk";--> statement-breakpoint+ALTER TABLE "artboards" ADD CONSTRAINT "artboards_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboards" DROP CONSTRAINT IF EXISTS "artboards_workspace_id_workspaces_id_fk";--> statement-breakpoint+ALTER TABLE "artboards" ADD CONSTRAINT "artboards_workspace_id_workspaces_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspaces"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboards" DROP CONSTRAINT IF EXISTS "artboards_topic_id_topics_id_fk";--> statement-breakpoint+ALTER TABLE "artboards" ADD CONSTRAINT "artboards_topic_id_topics_id_fk" FOREIGN KEY ("topic_id") REFERENCES "public"."topics"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboards" DROP CONSTRAINT IF EXISTS "artboards_task_id_tasks_id_fk";--> statement-breakpoint+ALTER TABLE "artboards" ADD CONSTRAINT "artboards_task_id_tasks_id_fk" FOREIGN KEY ("task_id") REFERENCES "public"."tasks"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboards" DROP CONSTRAINT IF EXISTS "artboards_project_id_projects_id_fk";--> statement-breakpoint+ALTER TABLE "artboards" ADD CONSTRAINT "artboards_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "artboards" DROP CONSTRAINT IF EXISTS "artboards_acceptance_id_acceptances_id_fk";--> statement-breakpoint+ALTER TABLE "artboards" ADD CONSTRAINT "artboards_acceptance_id_acceptances_id_fk" FOREIGN KEY ("acceptance_id") REFERENCES "public"."acceptances"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_boards_artboard_id_idx" ON "artboard_boards" USING btree ("artboard_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_boards_page_id_idx" ON "artboard_boards" USING btree ("page_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_boards_group_id_idx" ON "artboard_boards" USING btree ("group_id") WHERE "artboard_boards"."group_id" IS NOT NULL;--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_boards_round_id_idx" ON "artboard_boards" USING btree ("round_id") WHERE "artboard_boards"."round_id" IS NOT NULL;--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_boards_project_id_idx" ON "artboard_boards" USING btree ("project_id") WHERE "artboard_boards"."project_id" IS NOT NULL;--> statement-breakpoint+CREATE UNIQUE INDEX IF NOT EXISTS "artboard_boards_acceptance_flow_node_id_unique" ON "artboard_boards" USING btree ("acceptance_flow_node_id") WHERE "artboard_boards"."acceptance_flow_node_id" IS NOT NULL;--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_boards_source_work_version_id_idx" ON "artboard_boards" USING btree ("source_work_version_id") WHERE "artboard_boards"."source_work_version_id" IS NOT NULL;--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_boards_user_id_idx" ON "artboard_boards" USING btree ("user_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_boards_workspace_id_idx" ON "artboard_boards" USING btree ("workspace_id") WHERE "artboard_boards"."workspace_id" IS NOT NULL;--> statement-breakpoint+CREATE UNIQUE INDEX IF NOT EXISTS "artboard_comments_artboard_id_author_user_id_client_id_unique" ON "artboard_comments" USING btree ("artboard_id","author_user_id","client_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_comments_artboard_id_created_at_idx" ON "artboard_comments" USING btree ("artboard_id","created_at");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_comments_parent_comment_id_idx" ON "artboard_comments" USING btree ("parent_comment_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_comments_board_id_idx" ON "artboard_comments" USING btree ("board_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_comments_user_id_idx" ON "artboard_comments" USING btree ("user_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_comments_workspace_id_idx" ON "artboard_comments" USING btree ("workspace_id") WHERE "artboard_comments"."workspace_id" IS NOT NULL;--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_comments_page_id_idx" ON "artboard_comments" USING btree ("page_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_comments_group_id_idx" ON "artboard_comments" USING btree ("group_id") WHERE "artboard_comments"."group_id" IS NOT NULL;--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_edges_artboard_id_idx" ON "artboard_edges" USING btree ("artboard_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_edges_source_board_id_idx" ON "artboard_edges" USING btree ("source_board_id");--> statement-breakpoint+CREATE UNIQUE INDEX IF NOT EXISTS "artboard_edges_source_board_id_default_unique" ON "artboard_edges" USING btree ("source_board_id") WHERE "artboard_edges"."is_default" = true;--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_edges_target_board_id_idx" ON "artboard_edges" USING btree ("target_board_id");--> statement-breakpoint+CREATE UNIQUE INDEX IF NOT EXISTS "artboard_edges_acceptance_flow_edge_id_unique" ON "artboard_edges" USING btree ("acceptance_flow_edge_id") WHERE "artboard_edges"."acceptance_flow_edge_id" IS NOT NULL;--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_edges_user_id_idx" ON "artboard_edges" USING btree ("user_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_edges_workspace_id_idx" ON "artboard_edges" USING btree ("workspace_id") WHERE "artboard_edges"."workspace_id" IS NOT NULL;--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_groups_artboard_id_idx" ON "artboard_groups" USING btree ("artboard_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_groups_page_id_idx" ON "artboard_groups" USING btree ("page_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_groups_user_id_idx" ON "artboard_groups" USING btree ("user_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_groups_workspace_id_idx" ON "artboard_groups" USING btree ("workspace_id") WHERE "artboard_groups"."workspace_id" IS NOT NULL;--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_pages_artboard_id_idx" ON "artboard_pages" USING btree ("artboard_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_pages_user_id_idx" ON "artboard_pages" USING btree ("user_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_pages_workspace_id_idx" ON "artboard_pages" USING btree ("workspace_id") WHERE "artboard_pages"."workspace_id" IS NOT NULL;--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_rounds_artboard_id_idx" ON "artboard_rounds" USING btree ("artboard_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_rounds_page_id_idx" ON "artboard_rounds" USING btree ("page_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_rounds_user_id_idx" ON "artboard_rounds" USING btree ("user_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_rounds_workspace_id_idx" ON "artboard_rounds" USING btree ("workspace_id") WHERE "artboard_rounds"."workspace_id" IS NOT NULL;--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_rounds_recommended_board_id_idx" ON "artboard_rounds" USING btree ("recommended_board_id") WHERE "artboard_rounds"."recommended_board_id" IS NOT NULL;--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboard_rounds_chosen_board_id_idx" ON "artboard_rounds" USING btree ("chosen_board_id") WHERE "artboard_rounds"."chosen_board_id" IS NOT NULL;--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboards_user_id_idx" ON "artboards" USING btree ("user_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboards_workspace_id_idx" ON "artboards" USING btree ("workspace_id") WHERE "artboards"."workspace_id" IS NOT NULL;--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboards_topic_id_idx" ON "artboards" USING btree ("topic_id") WHERE "artboards"."topic_id" IS NOT NULL;--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboards_task_id_idx" ON "artboards" USING btree ("task_id") WHERE "artboards"."task_id" IS NOT NULL;--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboards_project_id_idx" ON "artboards" USING btree ("project_id");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboards_phase_idx" ON "artboards" USING btree ("phase");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboards_created_at_idx" ON "artboards" USING btree ("created_at");--> statement-breakpoint+CREATE INDEX IF NOT EXISTS "artboards_updated_at_idx" ON "artboards" USING btree ("updated_at");\ No newline at end of filediff --git a/packages/database/migrations/meta/0207_snapshot.json b/packages/database/migrations/meta/0217_snapshot.jsonsimilarity index 92%rename from packages/database/migrations/meta/0207_snapshot.jsonrename to packages/database/migrations/meta/0217_snapshot.jsonindex 2ea12603038..50a404bd5c7 100644--- a/packages/database/migrations/meta/0207_snapshot.json+++ b/packages/database/migrations/meta/0217_snapshot.json@@ -6,9 +6,9 @@},"dialect": "postgresql","enums": {},- "id": "67cd6047-5e05-4943-b7ab-6e9b44f6bff3",+ "id": "44fde6f5-404e-4745-a43d-3fa16db429c8","policies": {},- "prevId": "63465691-3d9e-4f5e-b5fe-543adf2bd840",+ "prevId": "7c29d9b7-1cda-4670-a1a0-27ecc5cf0017","roles": {},"schemas": {},"sequences": {@@ -132,6 +132,12 @@"primaryKey": false,"notNull": false},+ "review_mark_id": {+ "name": "review_mark_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },"client_id": {"name": "client_id","type": "text",@@ -300,6 +306,21 @@"concurrently": false,"method": "btree","with": {}+ },+ "acceptance_comments_review_mark_id_idx": {+ "name": "acceptance_comments_review_mark_id_idx",+ "columns": [+ {+ "expression": "review_mark_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}}},"foreignKeys": {@@ -366,6 +387,15 @@"onDelete": "set null","onUpdate": "no action"},+ "acceptance_comments_review_mark_id_acceptance_review_marks_id_fk": {+ "name": "acceptance_comments_review_mark_id_acceptance_review_marks_id_fk",+ "tableFrom": "acceptance_comments",+ "tableTo": "acceptance_review_marks",+ "columnsFrom": ["review_mark_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },"acceptance_comments_resolved_by_user_id_users_id_fk": {"name": "acceptance_comments_resolved_by_user_id_users_id_fk","tableFrom": "acceptance_comments",@@ -741,6 +771,450 @@"checkConstraints": {},"isRLSEnabled": false},+ "public.acceptance_review_marks": {+ "name": "acceptance_review_marks",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "review_id": {+ "name": "review_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "seq": {+ "name": "seq",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "url": {+ "name": "url",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "route_key": {+ "name": "route_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "page_meta": {+ "name": "page_meta",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "rect_document": {+ "name": "rect_document",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "rect_viewport": {+ "name": "rect_viewport",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "scroll": {+ "name": "scroll",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "viewport": {+ "name": "viewport",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "regions": {+ "name": "regions",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "region_refs": {+ "name": "region_refs",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "targets": {+ "name": "targets",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "sketch": {+ "name": "sketch",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "context": {+ "name": "context",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "screenshot_file_id": {+ "name": "screenshot_file_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "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": {+ "acceptance_review_marks_review_id_client_id_unique": {+ "name": "acceptance_review_marks_review_id_client_id_unique",+ "columns": [+ {+ "expression": "review_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "acceptance_review_marks_review_id_seq_unique": {+ "name": "acceptance_review_marks_review_id_seq_unique",+ "columns": [+ {+ "expression": "review_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "seq",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "acceptance_review_marks_route_key_review_id_idx": {+ "name": "acceptance_review_marks_route_key_review_id_idx",+ "columns": [+ {+ "expression": "route_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "review_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "acceptance_review_marks_review_id_acceptance_reviews_id_fk": {+ "name": "acceptance_review_marks_review_id_acceptance_reviews_id_fk",+ "tableFrom": "acceptance_review_marks",+ "tableTo": "acceptance_reviews",+ "columnsFrom": ["review_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "acceptance_review_marks_screenshot_file_id_files_id_fk": {+ "name": "acceptance_review_marks_screenshot_file_id_files_id_fk",+ "tableFrom": "acceptance_review_marks",+ "tableTo": "files",+ "columnsFrom": ["screenshot_file_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.acceptance_reviews": {+ "name": "acceptance_reviews",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "site_id": {+ "name": "site_id",+ "type": "text",+ "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+ },+ "project_id": {+ "name": "project_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'draft'"+ },+ "task_id": {+ "name": "task_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "last_mark_seq": {+ "name": "last_mark_seq",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "submitted_at": {+ "name": "submitted_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "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": {+ "acceptance_reviews_site_id_created_at_idx": {+ "name": "acceptance_reviews_site_id_created_at_idx",+ "columns": [+ {+ "expression": "site_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "acceptance_reviews_task_id_idx": {+ "name": "acceptance_reviews_task_id_idx",+ "columns": [+ {+ "expression": "task_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "acceptance_reviews_user_id_idx": {+ "name": "acceptance_reviews_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "acceptance_reviews_workspace_id_idx": {+ "name": "acceptance_reviews_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "acceptance_reviews_one_draft_per_user_unique": {+ "name": "acceptance_reviews_one_draft_per_user_unique",+ "columns": [+ {+ "expression": "site_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"acceptance_reviews\".\"status\" = 'draft'",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "acceptance_reviews_site_id_project_sites_id_fk": {+ "name": "acceptance_reviews_site_id_project_sites_id_fk",+ "tableFrom": "acceptance_reviews",+ "tableTo": "project_sites",+ "columnsFrom": ["site_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "acceptance_reviews_user_id_users_id_fk": {+ "name": "acceptance_reviews_user_id_users_id_fk",+ "tableFrom": "acceptance_reviews",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "acceptance_reviews_workspace_id_workspaces_id_fk": {+ "name": "acceptance_reviews_workspace_id_workspaces_id_fk",+ "tableFrom": "acceptance_reviews",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "acceptance_reviews_project_id_projects_id_fk": {+ "name": "acceptance_reviews_project_id_projects_id_fk",+ "tableFrom": "acceptance_reviews",+ "tableTo": "projects",+ "columnsFrom": ["project_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "acceptance_reviews_task_id_tasks_id_fk": {+ "name": "acceptance_reviews_task_id_tasks_id_fk",+ "tableFrom": "acceptance_reviews",+ "tableTo": "tasks",+ "columnsFrom": ["task_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },"public.agents": {"name": "agents","schema": "",@@ -7383,6 +7857,27 @@"method": "btree","with": {}},+ "agent_operations_workspace_id_created_at_idx": {+ "name": "agent_operations_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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },"agent_operations_metadata_idx": {"name": "agent_operations_metadata_idx","columns": [@@ -10432,8 +10927,8 @@"checkConstraints": {},"isRLSEnabled": false},- "public.async_tasks": {- "name": "async_tasks",+ "public.artboard_boards": {+ "name": "artboard_boards","schema": "","columns": {"id": {@@ -10443,26 +10938,402 @@"notNull": true,"default": "gen_random_uuid()"},+ "artboard_id": {+ "name": "artboard_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "page_id": {+ "name": "page_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "group_id": {+ "name": "group_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "round_id": {+ "name": "round_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "project_id": {+ "name": "project_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "acceptance_flow_node_id": {+ "name": "acceptance_flow_node_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },"type": {"name": "type","type": "text","primaryKey": false,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,"notNull": false},- "status": {- "name": "status",+ "expected": {+ "name": "expected","type": "text","primaryKey": false,"notNull": false},- "error": {- "name": "error",+ "rect": {+ "name": "rect","type": "jsonb","primaryKey": false,+ "notNull": true+ },+ "source_work_version_id": {+ "name": "source_work_version_id",+ "type": "uuid",+ "primaryKey": false,"notNull": false},- "inference_id": {- "name": "inference_id",+ "source_path": {+ "name": "source_path",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "source_file_id": {+ "name": "source_file_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "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": {+ "artboard_boards_artboard_id_idx": {+ "name": "artboard_boards_artboard_id_idx",+ "columns": [+ {+ "expression": "artboard_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_boards_page_id_idx": {+ "name": "artboard_boards_page_id_idx",+ "columns": [+ {+ "expression": "page_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_boards_group_id_idx": {+ "name": "artboard_boards_group_id_idx",+ "columns": [+ {+ "expression": "group_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"artboard_boards\".\"group_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_boards_round_id_idx": {+ "name": "artboard_boards_round_id_idx",+ "columns": [+ {+ "expression": "round_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"artboard_boards\".\"round_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_boards_project_id_idx": {+ "name": "artboard_boards_project_id_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"artboard_boards\".\"project_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_boards_acceptance_flow_node_id_unique": {+ "name": "artboard_boards_acceptance_flow_node_id_unique",+ "columns": [+ {+ "expression": "acceptance_flow_node_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"artboard_boards\".\"acceptance_flow_node_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_boards_source_work_version_id_idx": {+ "name": "artboard_boards_source_work_version_id_idx",+ "columns": [+ {+ "expression": "source_work_version_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"artboard_boards\".\"source_work_version_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_boards_user_id_idx": {+ "name": "artboard_boards_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_boards_workspace_id_idx": {+ "name": "artboard_boards_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"artboard_boards\".\"workspace_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "artboard_boards_artboard_id_artboards_id_fk": {+ "name": "artboard_boards_artboard_id_artboards_id_fk",+ "tableFrom": "artboard_boards",+ "tableTo": "artboards",+ "columnsFrom": ["artboard_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "artboard_boards_page_id_artboard_pages_id_fk": {+ "name": "artboard_boards_page_id_artboard_pages_id_fk",+ "tableFrom": "artboard_boards",+ "tableTo": "artboard_pages",+ "columnsFrom": ["page_id"],+ "columnsTo": ["id"],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "artboard_boards_group_id_artboard_groups_id_fk": {+ "name": "artboard_boards_group_id_artboard_groups_id_fk",+ "tableFrom": "artboard_boards",+ "tableTo": "artboard_groups",+ "columnsFrom": ["group_id"],+ "columnsTo": ["id"],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "artboard_boards_round_id_artboard_rounds_id_fk": {+ "name": "artboard_boards_round_id_artboard_rounds_id_fk",+ "tableFrom": "artboard_boards",+ "tableTo": "artboard_rounds",+ "columnsFrom": ["round_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "artboard_boards_user_id_users_id_fk": {+ "name": "artboard_boards_user_id_users_id_fk",+ "tableFrom": "artboard_boards",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "artboard_boards_workspace_id_workspaces_id_fk": {+ "name": "artboard_boards_workspace_id_workspaces_id_fk",+ "tableFrom": "artboard_boards",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "artboard_boards_project_id_projects_id_fk": {+ "name": "artboard_boards_project_id_projects_id_fk",+ "tableFrom": "artboard_boards",+ "tableTo": "projects",+ "columnsFrom": ["project_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "artboard_boards_source_work_version_id_work_versions_id_fk": {+ "name": "artboard_boards_source_work_version_id_work_versions_id_fk",+ "tableFrom": "artboard_boards",+ "tableTo": "work_versions",+ "columnsFrom": ["source_work_version_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "artboard_boards_source_file_id_files_id_fk": {+ "name": "artboard_boards_source_file_id_files_id_fk",+ "tableFrom": "artboard_boards",+ "tableTo": "files",+ "columnsFrom": ["source_file_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "artboard_boards_single_source_check": {+ "name": "artboard_boards_single_source_check",+ "value": "num_nonnulls(\"artboard_boards\".\"source_work_version_id\", \"artboard_boards\".\"source_file_id\") <= 1"+ },+ "artboard_boards_decision_no_source_check": {+ "name": "artboard_boards_decision_no_source_check",+ "value": "\"artboard_boards\".\"type\" <> 'decision' OR num_nonnulls(\"artboard_boards\".\"source_work_version_id\", \"artboard_boards\".\"source_file_id\", \"artboard_boards\".\"source_path\") = 0"+ }+ },+ "isRLSEnabled": false+ },+ "public.artboard_comments": {+ "name": "artboard_comments",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "artboard_id": {+ "name": "artboard_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "parent_comment_id": {+ "name": "parent_comment_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "author_user_id": {+ "name": "author_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "author_agent_id": {+ "name": "author_agent_id","type": "text","primaryKey": false,"notNull": false@@ -10479,24 +11350,65 @@"primaryKey": false,"notNull": false},- "duration": {- "name": "duration",- "type": "integer",+ "page_id": {+ "name": "page_id",+ "type": "text","primaryKey": false,"notNull": false},- "parent_id": {- "name": "parent_id",+ "group_id": {+ "name": "group_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "board_id": {+ "name": "board_id","type": "uuid","primaryKey": false,"notNull": false},+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "anchor": {+ "name": "anchor",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "delivered_at": {+ "name": "delivered_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "resolved_at": {+ "name": "resolved_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "resolved_by_user_id": {+ "name": "resolved_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },"metadata": {"name": "metadata","type": "jsonb","primaryKey": false,- "notNull": true,- "default": "'{}'"+ "notNull": false},"accessed_at": {"name": "accessed_at",@@ -10521,11 +11433,44 @@}},"indexes": {- "async_tasks_user_id_idx": {- "name": "async_tasks_user_id_idx",+ "artboard_comments_artboard_id_author_user_id_client_id_unique": {+ "name": "artboard_comments_artboard_id_author_user_id_client_id_unique","columns": [{- "expression": "user_id",+ "expression": "artboard_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "author_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_comments_artboard_id_created_at_idx": {+ "name": "artboard_comments_artboard_id_created_at_idx",+ "columns": [+ {+ "expression": "artboard_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at","isExpression": false,"asc": true,"nulls": "last"@@ -10536,11 +11481,11 @@"method": "btree","with": {}},- "async_tasks_parent_id_idx": {- "name": "async_tasks_parent_id_idx",+ "artboard_comments_parent_comment_id_idx": {+ "name": "artboard_comments_parent_comment_id_idx","columns": [{- "expression": "parent_id",+ "expression": "parent_comment_id","isExpression": false,"asc": true,"nulls": "last"@@ -10551,17 +11496,26 @@"method": "btree","with": {}},- "async_tasks_type_status_idx": {- "name": "async_tasks_type_status_idx",+ "artboard_comments_board_id_idx": {+ "name": "artboard_comments_board_id_idx","columns": [{- "expression": "type",+ "expression": "board_id","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_comments_user_id_idx": {+ "name": "artboard_comments_user_id_idx",+ "columns": [{- "expression": "status",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"@@ -10572,26 +11526,27 @@"method": "btree","with": {}},- "async_tasks_inference_id_idx": {- "name": "async_tasks_inference_id_idx",+ "artboard_comments_workspace_id_idx": {+ "name": "artboard_comments_workspace_id_idx","columns": [{- "expression": "inference_id",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,+ "where": "\"artboard_comments\".\"workspace_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}},- "async_tasks_metadata_idx": {- "name": "async_tasks_metadata_idx",+ "artboard_comments_page_id_idx": {+ "name": "artboard_comments_page_id_idx","columns": [{- "expression": "metadata",+ "expression": "page_id","isExpression": false,"asc": true,"nulls": "last"@@ -10599,43 +11554,116 @@],"isUnique": false,"concurrently": false,- "method": "gin",+ "method": "btree","with": {}},- "async_tasks_workspace_id_idx": {- "name": "async_tasks_workspace_id_idx",+ "artboard_comments_group_id_idx": {+ "name": "artboard_comments_group_id_idx","columns": [{- "expression": "workspace_id",+ "expression": "group_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,+ "where": "\"artboard_comments\".\"group_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "async_tasks_user_id_users_id_fk": {- "name": "async_tasks_user_id_users_id_fk",- "tableFrom": "async_tasks",+ "artboard_comments_artboard_id_artboards_id_fk": {+ "name": "artboard_comments_artboard_id_artboards_id_fk",+ "tableFrom": "artboard_comments",+ "tableTo": "artboards",+ "columnsFrom": ["artboard_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "artboard_comments_parent_comment_id_artboard_comments_id_fk": {+ "name": "artboard_comments_parent_comment_id_artboard_comments_id_fk",+ "tableFrom": "artboard_comments",+ "tableTo": "artboard_comments",+ "columnsFrom": ["parent_comment_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "artboard_comments_author_user_id_users_id_fk": {+ "name": "artboard_comments_author_user_id_users_id_fk",+ "tableFrom": "artboard_comments",+ "tableTo": "users",+ "columnsFrom": ["author_user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "artboard_comments_author_agent_id_agents_id_fk": {+ "name": "artboard_comments_author_agent_id_agents_id_fk",+ "tableFrom": "artboard_comments",+ "tableTo": "agents",+ "columnsFrom": ["author_agent_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "artboard_comments_user_id_users_id_fk": {+ "name": "artboard_comments_user_id_users_id_fk",+ "tableFrom": "artboard_comments","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "async_tasks_workspace_id_workspaces_id_fk": {- "name": "async_tasks_workspace_id_workspaces_id_fk",- "tableFrom": "async_tasks",+ "artboard_comments_workspace_id_workspaces_id_fk": {+ "name": "artboard_comments_workspace_id_workspaces_id_fk",+ "tableFrom": "artboard_comments","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"+ },+ "artboard_comments_page_id_artboard_pages_id_fk": {+ "name": "artboard_comments_page_id_artboard_pages_id_fk",+ "tableFrom": "artboard_comments",+ "tableTo": "artboard_pages",+ "columnsFrom": ["page_id"],+ "columnsTo": ["id"],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "artboard_comments_group_id_artboard_groups_id_fk": {+ "name": "artboard_comments_group_id_artboard_groups_id_fk",+ "tableFrom": "artboard_comments",+ "tableTo": "artboard_groups",+ "columnsFrom": ["group_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "artboard_comments_board_id_artboard_boards_id_fk": {+ "name": "artboard_comments_board_id_artboard_boards_id_fk",+ "tableFrom": "artboard_comments",+ "tableTo": "artboard_boards",+ "columnsFrom": ["board_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "artboard_comments_resolved_by_user_id_users_id_fk": {+ "name": "artboard_comments_resolved_by_user_id_users_id_fk",+ "tableFrom": "artboard_comments",+ "tableTo": "users",+ "columnsFrom": ["resolved_by_user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"}},"compositePrimaryKeys": {},@@ -10644,93 +11672,188 @@"checkConstraints": {},"isRLSEnabled": false},- "public.accounts": {- "name": "accounts",+ "public.artboard_edges": {+ "name": "artboard_edges","schema": "","columns": {- "access_token": {- "name": "access_token",- "type": "text",- "primaryKey": false,- "notNull": false+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"},- "access_token_expires_at": {- "name": "access_token_expires_at",- "type": "timestamp",+ "artboard_id": {+ "name": "artboard_id",+ "type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "account_id": {- "name": "account_id",- "type": "text",+ "source_board_id": {+ "name": "source_board_id",+ "type": "uuid","primaryKey": false,"notNull": true},- "created_at": {- "name": "created_at",- "type": "timestamp",+ "target_board_id": {+ "name": "target_board_id",+ "type": "uuid","primaryKey": false,- "notNull": true,- "default": "now()"+ "notNull": true},- "id": {- "name": "id",+ "user_id": {+ "name": "user_id","type": "text",- "primaryKey": true,+ "primaryKey": false,"notNull": true},- "id_token": {- "name": "id_token",+ "workspace_id": {+ "name": "workspace_id","type": "text","primaryKey": false,"notNull": false},- "password": {- "name": "password",- "type": "text",+ "acceptance_flow_edge_id": {+ "name": "acceptance_flow_edge_id",+ "type": "uuid","primaryKey": false,"notNull": false},- "provider_id": {- "name": "provider_id",+ "label": {+ "name": "label","type": "text","primaryKey": false,- "notNull": true+ "notNull": true,+ "default": "''"},- "refresh_token": {- "name": "refresh_token",+ "condition": {+ "name": "condition","type": "text","primaryKey": false,"notNull": false},- "refresh_token_expires_at": {- "name": "refresh_token_expires_at",- "type": "timestamp",+ "is_default": {+ "name": "is_default",+ "type": "boolean","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": false},- "scope": {- "name": "scope",- "type": "text",+ "sort_order": {+ "name": "sort_order",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb","primaryKey": false,"notNull": false},- "updated_at": {- "name": "updated_at",- "type": "timestamp",+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": true+ "notNull": true,+ "default": "now()"},- "user_id": {- "name": "user_id",- "type": "text",+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": true+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"}},"indexes": {- "account_userId_idx": {- "name": "account_userId_idx",+ "artboard_edges_artboard_id_idx": {+ "name": "artboard_edges_artboard_id_idx",+ "columns": [+ {+ "expression": "artboard_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_edges_source_board_id_idx": {+ "name": "artboard_edges_source_board_id_idx",+ "columns": [+ {+ "expression": "source_board_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_edges_source_board_id_default_unique": {+ "name": "artboard_edges_source_board_id_default_unique",+ "columns": [+ {+ "expression": "source_board_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"artboard_edges\".\"is_default\" = true",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_edges_target_board_id_idx": {+ "name": "artboard_edges_target_board_id_idx",+ "columns": [+ {+ "expression": "target_board_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_edges_acceptance_flow_edge_id_unique": {+ "name": "artboard_edges_acceptance_flow_edge_id_unique",+ "columns": [+ {+ "expression": "acceptance_flow_edge_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"artboard_edges\".\"acceptance_flow_edge_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_edges_user_id_idx": {+ "name": "artboard_edges_user_id_idx","columns": [{"expression": "user_id",@@ -10743,17 +11866,69 @@"concurrently": false,"method": "btree","with": {}+ },+ "artboard_edges_workspace_id_idx": {+ "name": "artboard_edges_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"artboard_edges\".\"workspace_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}}},"foreignKeys": {- "accounts_user_id_users_id_fk": {- "name": "accounts_user_id_users_id_fk",- "tableFrom": "accounts",+ "artboard_edges_artboard_id_artboards_id_fk": {+ "name": "artboard_edges_artboard_id_artboards_id_fk",+ "tableFrom": "artboard_edges",+ "tableTo": "artboards",+ "columnsFrom": ["artboard_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "artboard_edges_source_board_id_artboard_boards_id_fk": {+ "name": "artboard_edges_source_board_id_artboard_boards_id_fk",+ "tableFrom": "artboard_edges",+ "tableTo": "artboard_boards",+ "columnsFrom": ["source_board_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "artboard_edges_target_board_id_artboard_boards_id_fk": {+ "name": "artboard_edges_target_board_id_artboard_boards_id_fk",+ "tableFrom": "artboard_edges",+ "tableTo": "artboard_boards",+ "columnsFrom": ["target_board_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "artboard_edges_user_id_users_id_fk": {+ "name": "artboard_edges_user_id_users_id_fk",+ "tableFrom": "artboard_edges","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"+ },+ "artboard_edges_workspace_id_workspaces_id_fk": {+ "name": "artboard_edges_workspace_id_workspaces_id_fk",+ "tableFrom": "artboard_edges",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"}},"compositePrimaryKeys": {},@@ -10762,116 +11937,188 @@"checkConstraints": {},"isRLSEnabled": false},- "public.passkey": {- "name": "passkey",+ "public.artboard_groups": {+ "name": "artboard_groups","schema": "","columns": {- "aaguid": {- "name": "aaguid",+ "id": {+ "name": "id","type": "text",- "primaryKey": false,- "notNull": false- },- "backedUp": {- "name": "backedUp",- "type": "boolean",- "primaryKey": false,- "notNull": false+ "primaryKey": true,+ "notNull": true},- "counter": {- "name": "counter",- "type": "integer",+ "artboard_id": {+ "name": "artboard_id",+ "type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "createdAt": {- "name": "createdAt",- "type": "timestamp",+ "page_id": {+ "name": "page_id",+ "type": "text","primaryKey": false,- "notNull": false,- "default": "now()"+ "notNull": true},- "credentialID": {- "name": "credentialID",+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,"notNull": true},- "deviceType": {- "name": "deviceType",+ "workspace_id": {+ "name": "workspace_id","type": "text","primaryKey": false,"notNull": false},- "id": {- "name": "id",+ "kind": {+ "name": "kind","type": "text",- "primaryKey": true,+ "primaryKey": false,"notNull": true},- "name": {- "name": "name",+ "title": {+ "name": "title","type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "publicKey": {- "name": "publicKey",+ "description": {+ "name": "description","type": "text","primaryKey": false,+ "notNull": false+ },+ "rect": {+ "name": "rect",+ "type": "jsonb",+ "primaryKey": false,"notNull": true},- "transports": {- "name": "transports",- "type": "text",+ "metadata": {+ "name": "metadata",+ "type": "jsonb","primaryKey": false,"notNull": false},- "userId": {- "name": "userId",- "type": "text",+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": true+ "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": {- "passkey_credential_id_unique": {- "name": "passkey_credential_id_unique",+ "artboard_groups_artboard_id_idx": {+ "name": "artboard_groups_artboard_id_idx","columns": [{- "expression": "credentialID",+ "expression": "artboard_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "passkey_user_id_idx": {- "name": "passkey_user_id_idx",+ "artboard_groups_page_id_idx": {+ "name": "artboard_groups_page_id_idx","columns": [{- "expression": "userId",+ "expression": "page_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_groups_user_id_idx": {+ "name": "artboard_groups_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_groups_workspace_id_idx": {+ "name": "artboard_groups_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,+ "where": "\"artboard_groups\".\"workspace_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "passkey_userId_users_id_fk": {- "name": "passkey_userId_users_id_fk",- "tableFrom": "passkey",+ "artboard_groups_artboard_id_artboards_id_fk": {+ "name": "artboard_groups_artboard_id_artboards_id_fk",+ "tableFrom": "artboard_groups",+ "tableTo": "artboards",+ "columnsFrom": ["artboard_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "artboard_groups_page_id_artboard_pages_id_fk": {+ "name": "artboard_groups_page_id_artboard_pages_id_fk",+ "tableFrom": "artboard_groups",+ "tableTo": "artboard_pages",+ "columnsFrom": ["page_id"],+ "columnsTo": ["id"],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "artboard_groups_user_id_users_id_fk": {+ "name": "artboard_groups_user_id_users_id_fk",+ "tableFrom": "artboard_groups","tableTo": "users",- "columnsFrom": ["userId"],+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "artboard_groups_workspace_id_workspaces_id_fk": {+ "name": "artboard_groups_workspace_id_workspaces_id_fk",+ "tableFrom": "artboard_groups",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"@@ -10883,141 +12130,81 @@"checkConstraints": {},"isRLSEnabled": false},- "public.auth_sessions": {- "name": "auth_sessions",+ "public.artboard_pages": {+ "name": "artboard_pages","schema": "","columns": {- "created_at": {- "name": "created_at",- "type": "timestamp",- "primaryKey": false,- "notNull": true,- "default": "now()"- },- "expires_at": {- "name": "expires_at",- "type": "timestamp",- "primaryKey": false,- "notNull": true- },"id": {"name": "id","type": "text","primaryKey": true,"notNull": true},- "impersonated_by": {- "name": "impersonated_by",+ "artboard_id": {+ "name": "artboard_id","type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "ip_address": {- "name": "ip_address",+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id","type": "text","primaryKey": false,"notNull": false},- "token": {- "name": "token",+ "name": {+ "name": "name","type": "text","primaryKey": false,"notNull": true},- "updated_at": {- "name": "updated_at",- "type": "timestamp",+ "sort_order": {+ "name": "sort_order",+ "type": "integer","primaryKey": false,- "notNull": true+ "notNull": true,+ "default": 0},- "user_agent": {- "name": "user_agent",- "type": "text",+ "metadata": {+ "name": "metadata",+ "type": "jsonb","primaryKey": false,"notNull": false},- "user_id": {- "name": "user_id",- "type": "text",+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": true- }- },- "indexes": {- "auth_session_userId_idx": {- "name": "auth_session_userId_idx",- "columns": [- {- "expression": "user_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- }- },- "foreignKeys": {- "auth_sessions_user_id_users_id_fk": {- "name": "auth_sessions_user_id_users_id_fk",- "tableFrom": "auth_sessions",- "tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- }- },- "compositePrimaryKeys": {},- "uniqueConstraints": {- "auth_sessions_token_unique": {- "name": "auth_sessions_token_unique",- "nullsNotDistinct": false,- "columns": ["token"]- }- },- "policies": {},- "checkConstraints": {},- "isRLSEnabled": false- },- "public.two_factor": {- "name": "two_factor",- "schema": "",- "columns": {- "backup_codes": {- "name": "backup_codes",- "type": "text",- "primaryKey": false,- "notNull": true- },- "id": {- "name": "id",- "type": "text",- "primaryKey": true,- "notNull": true+ "notNull": true,+ "default": "now()"},- "secret": {- "name": "secret",- "type": "text",+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": true+ "notNull": true,+ "default": "now()"},- "user_id": {- "name": "user_id",- "type": "text",+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": true+ "notNull": true,+ "default": "now()"}},"indexes": {- "two_factor_secret_idx": {- "name": "two_factor_secret_idx",+ "artboard_pages_artboard_id_idx": {+ "name": "artboard_pages_artboard_id_idx","columns": [{- "expression": "secret",+ "expression": "artboard_id","isExpression": false,"asc": true,"nulls": "last"@@ -11028,8 +12215,8 @@"method": "btree","with": {}},- "two_factor_user_id_idx": {- "name": "two_factor_user_id_idx",+ "artboard_pages_user_id_idx": {+ "name": "artboard_pages_user_id_idx","columns": [{"expression": "user_id",@@ -11042,17 +12229,51 @@"concurrently": false,"method": "btree","with": {}+ },+ "artboard_pages_workspace_id_idx": {+ "name": "artboard_pages_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"artboard_pages\".\"workspace_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}}},"foreignKeys": {- "two_factor_user_id_users_id_fk": {- "name": "two_factor_user_id_users_id_fk",- "tableFrom": "two_factor",+ "artboard_pages_artboard_id_artboards_id_fk": {+ "name": "artboard_pages_artboard_id_artboards_id_fk",+ "tableFrom": "artboard_pages",+ "tableTo": "artboards",+ "columnsFrom": ["artboard_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "artboard_pages_user_id_users_id_fk": {+ "name": "artboard_pages_user_id_users_id_fk",+ "tableFrom": "artboard_pages","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"+ },+ "artboard_pages_workspace_id_workspaces_id_fk": {+ "name": "artboard_pages_workspace_id_workspaces_id_fk",+ "tableFrom": "artboard_pages",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"}},"compositePrimaryKeys": {},@@ -11061,108 +12282,90 @@"checkConstraints": {},"isRLSEnabled": false},- "public.verifications": {- "name": "verifications",+ "public.artboard_rounds": {+ "name": "artboard_rounds","schema": "","columns": {- "created_at": {- "name": "created_at",- "type": "timestamp",- "primaryKey": false,+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,"notNull": true,- "default": "now()"+ "default": "gen_random_uuid()"},- "expires_at": {- "name": "expires_at",- "type": "timestamp",+ "artboard_id": {+ "name": "artboard_id",+ "type": "text","primaryKey": false,"notNull": true},- "id": {- "name": "id",+ "page_id": {+ "name": "page_id","type": "text",- "primaryKey": true,+ "primaryKey": false,"notNull": true},- "identifier": {- "name": "identifier",+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,"notNull": true},- "updated_at": {- "name": "updated_at",- "type": "timestamp",+ "workspace_id": {+ "name": "workspace_id",+ "type": "text","primaryKey": false,- "notNull": true,- "default": "now()"+ "notNull": false},- "value": {- "name": "value",+ "title": {+ "name": "title","type": "text","primaryKey": false,"notNull": true- }- },- "indexes": {- "verification_identifier_idx": {- "name": "verification_identifier_idx",- "columns": [- {- "expression": "identifier",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- }- },- "foreignKeys": {},- "compositePrimaryKeys": {},- "uniqueConstraints": {},- "policies": {},- "checkConstraints": {},- "isRLSEnabled": false- },- "public.channel_audit": {- "name": "channel_audit",- "schema": "",- "columns": {- "id": {- "name": "id",- "type": "uuid",- "primaryKey": true,- "notNull": true,- "default": "gen_random_uuid()"},- "channel_id": {- "name": "channel_id",+ "status": {+ "name": "status","type": "text","primaryKey": false,- "notNull": true+ "notNull": true,+ "default": "'open'"},- "event": {- "name": "event",- "type": "text",+ "recommended_board_id": {+ "name": "recommended_board_id",+ "type": "uuid","primaryKey": false,- "notNull": true+ "notNull": false},- "target_id": {- "name": "target_id",+ "chosen_board_id": {+ "name": "chosen_board_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "selected_by": {+ "name": "selected_by","type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "details": {- "name": "details",+ "selected_at": {+ "name": "selected_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata","type": "jsonb","primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,"notNull": true,- "default": "'{}'::jsonb"+ "default": "now()"},"created_at": {"name": "created_at",@@ -11170,26 +12373,51 @@"primaryKey": false,"notNull": true,"default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"}},"indexes": {- "channel_audit_channel_event_idx": {- "name": "channel_audit_channel_event_idx",+ "artboard_rounds_artboard_id_idx": {+ "name": "artboard_rounds_artboard_id_idx","columns": [{- "expression": "channel_id",+ "expression": "artboard_id","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_rounds_page_id_idx": {+ "name": "artboard_rounds_page_id_idx",+ "columns": [{- "expression": "event",+ "expression": "page_id","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_rounds_user_id_idx": {+ "name": "artboard_rounds_user_id_idx",+ "columns": [{- "expression": "created_at",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"@@ -11200,43 +12428,118 @@"method": "btree","with": {}},- "channel_audit_target_event_idx": {- "name": "channel_audit_target_event_idx",+ "artboard_rounds_workspace_id_idx": {+ "name": "artboard_rounds_workspace_id_idx","columns": [{- "expression": "target_id",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "where": "\"artboard_rounds\".\"workspace_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_rounds_recommended_board_id_idx": {+ "name": "artboard_rounds_recommended_board_id_idx",+ "columns": [{- "expression": "event",+ "expression": "recommended_board_id","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "where": "\"artboard_rounds\".\"recommended_board_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_rounds_chosen_board_id_idx": {+ "name": "artboard_rounds_chosen_board_id_idx",+ "columns": [{- "expression": "created_at",+ "expression": "chosen_board_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,+ "where": "\"artboard_rounds\".\"chosen_board_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "channel_audit_channel_id_channels_id_fk": {- "name": "channel_audit_channel_id_channels_id_fk",- "tableFrom": "channel_audit",- "tableTo": "channels",- "columnsFrom": ["channel_id"],+ "artboard_rounds_artboard_id_artboards_id_fk": {+ "name": "artboard_rounds_artboard_id_artboards_id_fk",+ "tableFrom": "artboard_rounds",+ "tableTo": "artboards",+ "columnsFrom": ["artboard_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "artboard_rounds_page_id_artboard_pages_id_fk": {+ "name": "artboard_rounds_page_id_artboard_pages_id_fk",+ "tableFrom": "artboard_rounds",+ "tableTo": "artboard_pages",+ "columnsFrom": ["page_id"],+ "columnsTo": ["id"],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "artboard_rounds_user_id_users_id_fk": {+ "name": "artboard_rounds_user_id_users_id_fk",+ "tableFrom": "artboard_rounds",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "artboard_rounds_workspace_id_workspaces_id_fk": {+ "name": "artboard_rounds_workspace_id_workspaces_id_fk",+ "tableFrom": "artboard_rounds",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"+ },+ "artboard_rounds_recommended_board_id_artboard_boards_id_fk": {+ "name": "artboard_rounds_recommended_board_id_artboard_boards_id_fk",+ "tableFrom": "artboard_rounds",+ "tableTo": "artboard_boards",+ "columnsFrom": ["recommended_board_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "artboard_rounds_chosen_board_id_artboard_boards_id_fk": {+ "name": "artboard_rounds_chosen_board_id_artboard_boards_id_fk",+ "tableFrom": "artboard_rounds",+ "tableTo": "artboard_boards",+ "columnsFrom": ["chosen_board_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "artboard_rounds_selected_by_users_id_fk": {+ "name": "artboard_rounds_selected_by_users_id_fk",+ "tableFrom": "artboard_rounds",+ "tableTo": "users",+ "columnsFrom": ["selected_by"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"}},"compositePrimaryKeys": {},@@ -11245,163 +12548,96 @@"checkConstraints": {},"isRLSEnabled": false},- "public.channel_jobs": {- "name": "channel_jobs",+ "public.artboards": {+ "name": "artboards","schema": "","columns": {"id": {"name": "id",- "type": "uuid",- "primaryKey": true,- "notNull": true,- "default": "gen_random_uuid()"- },- "channel_id": {- "name": "channel_id","type": "text",- "primaryKey": false,- "notNull": true- },- "member_id": {- "name": "member_id",- "type": "uuid",- "primaryKey": false,- "notNull": true- },- "message_id": {- "name": "message_id",- "type": "uuid",- "primaryKey": false,+ "primaryKey": true,"notNull": true},- "thread_id": {- "name": "thread_id",+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,- "notNull": false- },- "requester_member_id": {- "name": "requester_member_id",- "type": "uuid",- "primaryKey": false,"notNull": true},- "status": {- "name": "status",- "type": "text",- "primaryKey": false,- "notNull": true,- "default": "'queued'"- },- "blocked_reason": {- "name": "blocked_reason",- "type": "text",- "primaryKey": false,- "notNull": false- },- "blocked_code": {- "name": "blocked_code",+ "workspace_id": {+ "name": "workspace_id","type": "text","primaryKey": false,"notNull": false},- "claimed_at": {- "name": "claimed_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": false- },"topic_id": {"name": "topic_id","type": "text","primaryKey": false,"notNull": false},- "operation_id": {- "name": "operation_id",+ "task_id": {+ "name": "task_id","type": "text","primaryKey": false,"notNull": false},- "wake": {- "name": "wake",- "type": "jsonb",- "primaryKey": false,- "notNull": false- },- "manifest": {- "name": "manifest",- "type": "jsonb",- "primaryKey": false,- "notNull": false- },- "execution_config": {- "name": "execution_config",- "type": "jsonb",+ "project_id": {+ "name": "project_id",+ "type": "text","primaryKey": false,"notNull": false},- "device_id": {- "name": "device_id",- "type": "varchar(64)",+ "acceptance_id": {+ "name": "acceptance_id",+ "type": "uuid","primaryKey": false,"notNull": false},- "working_directory": {- "name": "working_directory",+ "title": {+ "name": "title","type": "text","primaryKey": false,- "notNull": false- },- "accepted_at": {- "name": "accepted_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": false+ "notNull": true},- "lease_owner": {- "name": "lease_owner",+ "description": {+ "name": "description","type": "text","primaryKey": false,"notNull": false},- "lease_expires_at": {- "name": "lease_expires_at",- "type": "timestamp with time zone",+ "content": {+ "name": "content",+ "type": "text","primaryKey": false,"notNull": false},- "writer_held": {- "name": "writer_held",- "type": "boolean",+ "phase": {+ "name": "phase",+ "type": "text","primaryKey": false,"notNull": true,- "default": false+ "default": "'discuss'"},- "isolated_at": {- "name": "isolated_at",- "type": "timestamp with time zone",+ "revision": {+ "name": "revision",+ "type": "integer","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": 1},- "draft": {- "name": "draft",- "type": "text",+ "metadata": {+ "name": "metadata",+ "type": "jsonb","primaryKey": false,"notNull": false},- "publication_revoked": {- "name": "publication_revoked",- "type": "boolean",+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone","primaryKey": false,"notNull": true,- "default": false- },- "published_message_id": {- "name": "published_message_id",- "type": "uuid",- "primaryKey": false,- "notNull": false+ "default": "now()"},"created_at": {"name": "created_at",@@ -11419,119 +12655,74 @@}},"indexes": {- "channel_jobs_delivery_unique": {- "name": "channel_jobs_delivery_unique",+ "artboards_user_id_idx": {+ "name": "artboards_user_id_idx","columns": [{- "expression": "message_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "member_id",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "channel_jobs_channel_status_idx": {- "name": "channel_jobs_channel_status_idx",+ "artboards_workspace_id_idx": {+ "name": "artboards_workspace_id_idx","columns": [{- "expression": "channel_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "status",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,+ "where": "\"artboards\".\"workspace_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}},- "channel_jobs_continuation_idx": {- "name": "channel_jobs_continuation_idx",+ "artboards_topic_id_idx": {+ "name": "artboards_topic_id_idx","columns": [{- "expression": "member_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "requester_member_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "thread_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "claimed_at",+ "expression": "topic_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,+ "where": "\"artboards\".\"topic_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}},- "channel_jobs_topic_idx": {- "name": "channel_jobs_topic_idx",+ "artboards_task_id_idx": {+ "name": "artboards_task_id_idx","columns": [{- "expression": "topic_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "published_message_id",+ "expression": "task_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,+ "where": "\"artboards\".\"task_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}},- "channel_jobs_member_queue_idx": {- "name": "channel_jobs_member_queue_idx",+ "artboards_project_id_idx": {+ "name": "artboards_project_id_idx","columns": [{- "expression": "member_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "status",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "created_at",+ "expression": "project_id","isExpression": false,"asc": true,"nulls": "last"@@ -11542,145 +12733,116 @@"method": "btree","with": {}},- "channel_jobs_lease_expires_idx": {- "name": "channel_jobs_lease_expires_idx",+ "artboards_phase_idx": {+ "name": "artboards_phase_idx","columns": [{- "expression": "lease_expires_at",+ "expression": "phase","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,- "where": "\"channel_jobs\".\"writer_held\" AND \"channel_jobs\".\"isolated_at\" IS NULL","concurrently": false,"method": "btree","with": {}},- "channel_jobs_active_member_unique": {- "name": "channel_jobs_active_member_unique",+ "artboards_created_at_idx": {+ "name": "artboards_created_at_idx","columns": [{- "expression": "member_id",+ "expression": "created_at","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,- "where": "\"channel_jobs\".\"writer_held\" AND \"channel_jobs\".\"isolated_at\" IS NULL",+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "channel_jobs_active_directory_unique": {- "name": "channel_jobs_active_directory_unique",+ "artboards_updated_at_idx": {+ "name": "artboards_updated_at_idx","columns": [{- "expression": "device_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "working_directory",+ "expression": "updated_at","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,- "where": "\"channel_jobs\".\"device_id\" IS NOT NULL AND \"channel_jobs\".\"working_directory\" IS NOT NULL AND \"channel_jobs\".\"writer_held\"",+ "isUnique": false,"concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "channel_jobs_channel_id_channels_id_fk": {- "name": "channel_jobs_channel_id_channels_id_fk",- "tableFrom": "channel_jobs",- "tableTo": "channels",- "columnsFrom": ["channel_id"],+ "artboards_user_id_users_id_fk": {+ "name": "artboards_user_id_users_id_fk",+ "tableFrom": "artboards",+ "tableTo": "users",+ "columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "channel_jobs_topic_id_topics_id_fk": {- "name": "channel_jobs_topic_id_topics_id_fk",- "tableFrom": "channel_jobs",+ "artboards_workspace_id_workspaces_id_fk": {+ "name": "artboards_workspace_id_workspaces_id_fk",+ "tableFrom": "artboards",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "artboards_topic_id_topics_id_fk": {+ "name": "artboards_topic_id_topics_id_fk",+ "tableFrom": "artboards","tableTo": "topics","columnsFrom": ["topic_id"],"columnsTo": ["id"],"onDelete": "set null","onUpdate": "no action"},- "channel_jobs_operation_id_agent_operations_id_fk": {- "name": "channel_jobs_operation_id_agent_operations_id_fk",- "tableFrom": "channel_jobs",- "tableTo": "agent_operations",- "columnsFrom": ["operation_id"],+ "artboards_task_id_tasks_id_fk": {+ "name": "artboards_task_id_tasks_id_fk",+ "tableFrom": "artboards",+ "tableTo": "tasks",+ "columnsFrom": ["task_id"],"columnsTo": ["id"],"onDelete": "set null","onUpdate": "no action"},- "channel_jobs_member_fk": {- "name": "channel_jobs_member_fk",- "tableFrom": "channel_jobs",- "tableTo": "channel_members",- "columnsFrom": ["channel_id", "member_id"],- "columnsTo": ["channel_id", "id"],- "onDelete": "no action",- "onUpdate": "no action"- },- "channel_jobs_requester_fk": {- "name": "channel_jobs_requester_fk",- "tableFrom": "channel_jobs",- "tableTo": "channel_members",- "columnsFrom": ["channel_id", "requester_member_id"],- "columnsTo": ["channel_id", "id"],- "onDelete": "no action",- "onUpdate": "no action"- },- "channel_jobs_message_fk": {- "name": "channel_jobs_message_fk",- "tableFrom": "channel_jobs",- "tableTo": "channel_messages",- "columnsFrom": ["channel_id", "message_id"],- "columnsTo": ["channel_id", "id"],- "onDelete": "no action",+ "artboards_project_id_projects_id_fk": {+ "name": "artboards_project_id_projects_id_fk",+ "tableFrom": "artboards",+ "tableTo": "projects",+ "columnsFrom": ["project_id"],+ "columnsTo": ["id"],+ "onDelete": "set null","onUpdate": "no action"},- "channel_jobs_thread_fk": {- "name": "channel_jobs_thread_fk",- "tableFrom": "channel_jobs",- "tableTo": "channel_threads",- "columnsFrom": ["channel_id", "thread_id"],- "columnsTo": ["channel_id", "id"],- "onDelete": "no action",+ "artboards_acceptance_id_acceptances_id_fk": {+ "name": "artboards_acceptance_id_acceptances_id_fk",+ "tableFrom": "artboards",+ "tableTo": "acceptances",+ "columnsFrom": ["acceptance_id"],+ "columnsTo": ["id"],+ "onDelete": "set null","onUpdate": "no action"}},"compositePrimaryKeys": {},- "uniqueConstraints": {- "channel_jobs_operation_id_unique": {- "name": "channel_jobs_operation_id_unique",- "nullsNotDistinct": false,- "columns": ["operation_id"]- },- "channel_jobs_scope_unique": {- "name": "channel_jobs_scope_unique",- "nullsNotDistinct": false,- "columns": ["channel_id", "id"]- }- },+ "uniqueConstraints": {},"policies": {},"checkConstraints": {},"isRLSEnabled": false},- "public.channel_member_grants": {- "name": "channel_member_grants",+ "public.async_tasks": {+ "name": "async_tasks","schema": "","columns": {"id": {@@ -11690,64 +12852,51 @@"notNull": true,"default": "gen_random_uuid()"},- "channel_id": {- "name": "channel_id",+ "type": {+ "name": "type","type": "text","primaryKey": false,- "notNull": true- },- "member_id": {- "name": "member_id",- "type": "uuid",- "primaryKey": false,- "notNull": true+ "notNull": false},- "device_owner_id": {- "name": "device_owner_id",+ "status": {+ "name": "status","type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "device_id": {- "name": "device_id",- "type": "varchar(64)",+ "error": {+ "name": "error",+ "type": "jsonb","primaryKey": false,- "notNull": true+ "notNull": false},- "working_directory": {- "name": "working_directory",+ "inference_id": {+ "name": "inference_id","type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "requested_by_member_id": {- "name": "requested_by_member_id",- "type": "uuid",+ "user_id": {+ "name": "user_id",+ "type": "text","primaryKey": false,"notNull": true},- "status": {- "name": "status",+ "workspace_id": {+ "name": "workspace_id","type": "text","primaryKey": false,- "notNull": true,- "default": "'pending'"- },- "decided_at": {- "name": "decided_at",- "type": "timestamp with time zone",- "primaryKey": false,"notNull": false},- "revoked_at": {- "name": "revoked_at",- "type": "timestamp with time zone",+ "duration": {+ "name": "duration",+ "type": "integer","primaryKey": false,"notNull": false},- "revoke_reason": {- "name": "revoke_reason",- "type": "text",+ "parent_id": {+ "name": "parent_id",+ "type": "uuid","primaryKey": false,"notNull": false},@@ -11755,8 +12904,15 @@"name": "metadata","type": "jsonb","primaryKey": false,- "notNull": false,- "default": "'{}'::jsonb"+ "notNull": true,+ "default": "'{}'"+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"},"created_at": {"name": "created_at",@@ -11774,26 +12930,41 @@}},"indexes": {- "channel_member_grants_member_unique": {- "name": "channel_member_grants_member_unique",+ "async_tasks_user_id_idx": {+ "name": "async_tasks_user_id_idx","columns": [{- "expression": "member_id",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "channel_member_grants_owner_status_idx": {- "name": "channel_member_grants_owner_status_idx",+ "async_tasks_parent_id_idx": {+ "name": "async_tasks_parent_id_idx","columns": [{- "expression": "device_owner_id",+ "expression": "parent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "async_tasks_type_status_idx": {+ "name": "async_tasks_type_status_idx",+ "columns": [+ {+ "expression": "type","isExpression": false,"asc": true,"nulls": "last"@@ -11809,44 +12980,71 @@"concurrently": false,"method": "btree","with": {}+ },+ "async_tasks_inference_id_idx": {+ "name": "async_tasks_inference_id_idx",+ "columns": [+ {+ "expression": "inference_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "async_tasks_metadata_idx": {+ "name": "async_tasks_metadata_idx",+ "columns": [+ {+ "expression": "metadata",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "gin",+ "with": {}+ },+ "async_tasks_workspace_id_idx": {+ "name": "async_tasks_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}}},"foreignKeys": {- "channel_member_grants_channel_id_channels_id_fk": {- "name": "channel_member_grants_channel_id_channels_id_fk",- "tableFrom": "channel_member_grants",- "tableTo": "channels",- "columnsFrom": ["channel_id"],+ "async_tasks_user_id_users_id_fk": {+ "name": "async_tasks_user_id_users_id_fk",+ "tableFrom": "async_tasks",+ "tableTo": "users",+ "columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "channel_member_grants_device_owner_id_users_id_fk": {- "name": "channel_member_grants_device_owner_id_users_id_fk",- "tableFrom": "channel_member_grants",- "tableTo": "users",- "columnsFrom": ["device_owner_id"],+ "async_tasks_workspace_id_workspaces_id_fk": {+ "name": "async_tasks_workspace_id_workspaces_id_fk",+ "tableFrom": "async_tasks",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"- },- "channel_member_grants_member_fk": {- "name": "channel_member_grants_member_fk",- "tableFrom": "channel_member_grants",- "tableTo": "channel_members",- "columnsFrom": ["channel_id", "member_id"],- "columnsTo": ["channel_id", "id"],- "onDelete": "no action",- "onUpdate": "no action"- },- "channel_member_grants_requester_fk": {- "name": "channel_member_grants_requester_fk",- "tableFrom": "channel_member_grants",- "tableTo": "channel_members",- "columnsFrom": ["channel_id", "requested_by_member_id"],- "columnsTo": ["channel_id", "id"],- "onDelete": "no action",- "onUpdate": "no action"}},"compositePrimaryKeys": {},@@ -11855,111 +13053,94 @@"checkConstraints": {},"isRLSEnabled": false},- "public.channel_members": {- "name": "channel_members",+ "public.accounts": {+ "name": "accounts","schema": "","columns": {- "id": {- "name": "id",- "type": "uuid",- "primaryKey": true,- "notNull": true,- "default": "gen_random_uuid()"- },- "channel_id": {- "name": "channel_id",- "type": "text",- "primaryKey": false,- "notNull": true- },- "actor_type": {- "name": "actor_type",+ "access_token": {+ "name": "access_token","type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "user_id": {- "name": "user_id",- "type": "text",+ "access_token_expires_at": {+ "name": "access_token_expires_at",+ "type": "timestamp","primaryKey": false,"notNull": false},- "role": {- "name": "role",+ "account_id": {+ "name": "account_id","type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "last_read_sequence": {- "name": "last_read_sequence",- "type": "integer",+ "created_at": {+ "name": "created_at",+ "type": "timestamp","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "now()"},- "agent_id": {- "name": "agent_id",+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "id_token": {+ "name": "id_token","type": "text","primaryKey": false,"notNull": false},- "name": {- "name": "name",+ "password": {+ "name": "password","type": "text","primaryKey": false,"notNull": false},- "description": {- "name": "description",+ "provider_id": {+ "name": "provider_id","type": "text","primaryKey": false,- "notNull": true,- "default": "''"+ "notNull": true},- "config": {- "name": "config",- "type": "jsonb",+ "refresh_token": {+ "name": "refresh_token",+ "type": "text","primaryKey": false,"notNull": false},- "metadata": {- "name": "metadata",- "type": "jsonb",+ "refresh_token_expires_at": {+ "name": "refresh_token_expires_at",+ "type": "timestamp","primaryKey": false,- "notNull": false,- "default": "'{}'::jsonb"+ "notNull": false},- "status": {- "name": "status",+ "scope": {+ "name": "scope","type": "text","primaryKey": false,- "notNull": true,- "default": "'active'"- },- "created_at": {- "name": "created_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": true,- "default": "now()"+ "notNull": false},"updated_at": {"name": "updated_at",- "type": "timestamp with time zone",+ "type": "timestamp","primaryKey": false,- "notNull": true,- "default": "now()"+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true}},"indexes": {- "channel_members_channel_user_unique": {- "name": "channel_members_channel_user_unique",+ "account_userId_idx": {+ "name": "account_userId_idx","columns": [- {- "expression": "channel_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },{"expression": "user_id","isExpression": false,@@ -11967,32 +13148,122 @@"nulls": "last"}],- "isUnique": true,- "where": "\"channel_members\".\"user_id\" IS NOT NULL",+ "isUnique": false,"concurrently": false,"method": "btree","with": {}+ }+ },+ "foreignKeys": {+ "accounts_user_id_users_id_fk": {+ "name": "accounts_user_id_users_id_fk",+ "tableFrom": "accounts",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.passkey": {+ "name": "passkey",+ "schema": "",+ "columns": {+ "aaguid": {+ "name": "aaguid",+ "type": "text",+ "primaryKey": false,+ "notNull": false},- "channel_members_user_id_idx": {- "name": "channel_members_user_id_idx",+ "backedUp": {+ "name": "backedUp",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false+ },+ "counter": {+ "name": "counter",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ },+ "credentialID": {+ "name": "credentialID",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "deviceType": {+ "name": "deviceType",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "publicKey": {+ "name": "publicKey",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "transports": {+ "name": "transports",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "passkey_credential_id_unique": {+ "name": "passkey_credential_id_unique","columns": [{- "expression": "user_id",+ "expression": "credentialID","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,"concurrently": false,"method": "btree","with": {}},- "channel_members_agent_id_idx": {- "name": "channel_members_agent_id_idx",+ "passkey_user_id_idx": {+ "name": "passkey_user_id_idx","columns": [{- "expression": "agent_id",+ "expression": "userId","isExpression": false,"asc": true,"nulls": "last"@@ -12005,77 +13276,386 @@}},"foreignKeys": {- "channel_members_channel_id_channels_id_fk": {- "name": "channel_members_channel_id_channels_id_fk",- "tableFrom": "channel_members",- "tableTo": "channels",- "columnsFrom": ["channel_id"],- "columnsTo": ["id"],- "onDelete": "cascade",+ "passkey_userId_users_id_fk": {+ "name": "passkey_userId_users_id_fk",+ "tableFrom": "passkey",+ "tableTo": "users",+ "columnsFrom": ["userId"],+ "columnsTo": ["id"],+ "onDelete": "cascade","onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.auth_sessions": {+ "name": "auth_sessions",+ "schema": "",+ "columns": {+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"},- "channel_members_user_id_users_id_fk": {- "name": "channel_members_user_id_users_id_fk",- "tableFrom": "channel_members",+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "impersonated_by": {+ "name": "impersonated_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "ip_address": {+ "name": "ip_address",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "token": {+ "name": "token",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "user_agent": {+ "name": "user_agent",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "auth_session_userId_idx": {+ "name": "auth_session_userId_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "auth_sessions_user_id_users_id_fk": {+ "name": "auth_sessions_user_id_users_id_fk",+ "tableFrom": "auth_sessions","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],- "onDelete": "set null",+ "onDelete": "cascade","onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "auth_sessions_token_unique": {+ "name": "auth_sessions_token_unique",+ "nullsNotDistinct": false,+ "columns": ["token"]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.two_factor": {+ "name": "two_factor",+ "schema": "",+ "columns": {+ "backup_codes": {+ "name": "backup_codes",+ "type": "text",+ "primaryKey": false,+ "notNull": true},- "channel_members_agent_id_agents_id_fk": {- "name": "channel_members_agent_id_agents_id_fk",- "tableFrom": "channel_members",- "tableTo": "agents",- "columnsFrom": ["agent_id"],+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "secret": {+ "name": "secret",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "two_factor_secret_idx": {+ "name": "two_factor_secret_idx",+ "columns": [+ {+ "expression": "secret",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "two_factor_user_id_idx": {+ "name": "two_factor_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "two_factor_user_id_users_id_fk": {+ "name": "two_factor_user_id_users_id_fk",+ "tableFrom": "two_factor",+ "tableTo": "users",+ "columnsFrom": ["user_id"],"columnsTo": ["id"],- "onDelete": "set null",+ "onDelete": "cascade","onUpdate": "no action"}},"compositePrimaryKeys": {},- "uniqueConstraints": {- "channel_members_scope_unique": {- "name": "channel_members_scope_unique",- "nullsNotDistinct": false,- "columns": ["channel_id", "id"]+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.verifications": {+ "name": "verifications",+ "schema": "",+ "columns": {+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "identifier": {+ "name": "identifier",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "value": {+ "name": "value",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "verification_identifier_idx": {+ "name": "verification_identifier_idx",+ "columns": [+ {+ "expression": "identifier",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}}},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},"policies": {},- "checkConstraints": {- "channel_members_actor_type_check": {- "name": "channel_members_actor_type_check",- "value": "\"channel_members\".\"actor_type\" IN ('user', 'agent')"+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.channel_audit": {+ "name": "channel_audit",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"},- "channel_members_user_shape_check": {- "name": "channel_members_user_shape_check",- "value": "\"channel_members\".\"actor_type\" <> 'user' OR \"channel_members\".\"role\" IS NOT NULL"+ "channel_id": {+ "name": "channel_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true},- "channel_members_agent_shape_check": {- "name": "channel_members_agent_shape_check",- "value": "\"channel_members\".\"actor_type\" <> 'agent' OR (\"channel_members\".\"name\" IS NOT NULL AND \"channel_members\".\"config\" IS NOT NULL)"+ "event": {+ "name": "event",+ "type": "text",+ "primaryKey": false,+ "notNull": true},- "channel_members_user_id_owner_check": {- "name": "channel_members_user_id_owner_check",- "value": "\"channel_members\".\"user_id\" IS NULL OR \"channel_members\".\"actor_type\" = 'user'"+ "target_id": {+ "name": "target_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true},- "channel_members_role_owner_check": {- "name": "channel_members_role_owner_check",- "value": "\"channel_members\".\"role\" IS NULL OR \"channel_members\".\"actor_type\" = 'user'"+ "details": {+ "name": "details",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"},- "channel_members_agent_id_owner_check": {- "name": "channel_members_agent_id_owner_check",- "value": "\"channel_members\".\"agent_id\" IS NULL OR \"channel_members\".\"actor_type\" = 'agent'"+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "channel_audit_channel_event_idx": {+ "name": "channel_audit_channel_event_idx",+ "columns": [+ {+ "expression": "channel_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "event",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}},- "channel_members_config_owner_check": {- "name": "channel_members_config_owner_check",- "value": "\"channel_members\".\"config\" IS NULL OR \"channel_members\".\"actor_type\" <> 'user'"+ "channel_audit_target_event_idx": {+ "name": "channel_audit_target_event_idx",+ "columns": [+ {+ "expression": "target_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "event",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "channel_audit_channel_id_channels_id_fk": {+ "name": "channel_audit_channel_id_channels_id_fk",+ "tableFrom": "channel_audit",+ "tableTo": "channels",+ "columnsFrom": ["channel_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"}},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},"isRLSEnabled": false},- "public.channel_message_files": {- "name": "channel_message_files",+ "public.channel_jobs": {+ "name": "channel_jobs","schema": "","columns": {"id": {@@ -12085,31 +13665,2165 @@"notNull": true,"default": "gen_random_uuid()"},- "message_id": {- "name": "message_id",- "type": "uuid",+ "channel_id": {+ "name": "channel_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "member_id": {+ "name": "member_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "message_id": {+ "name": "message_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "thread_id": {+ "name": "thread_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "requester_member_id": {+ "name": "requester_member_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'queued'"+ },+ "blocked_reason": {+ "name": "blocked_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "blocked_code": {+ "name": "blocked_code",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "claimed_at": {+ "name": "claimed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "topic_id": {+ "name": "topic_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "operation_id": {+ "name": "operation_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "wake": {+ "name": "wake",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "manifest": {+ "name": "manifest",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "execution_config": {+ "name": "execution_config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "device_id": {+ "name": "device_id",+ "type": "varchar(64)",+ "primaryKey": false,+ "notNull": false+ },+ "working_directory": {+ "name": "working_directory",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "accepted_at": {+ "name": "accepted_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "lease_owner": {+ "name": "lease_owner",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "lease_expires_at": {+ "name": "lease_expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "writer_held": {+ "name": "writer_held",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "isolated_at": {+ "name": "isolated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "draft": {+ "name": "draft",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "publication_revoked": {+ "name": "publication_revoked",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "published_message_id": {+ "name": "published_message_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "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": {+ "channel_jobs_delivery_unique": {+ "name": "channel_jobs_delivery_unique",+ "columns": [+ {+ "expression": "message_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "member_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "channel_jobs_channel_status_idx": {+ "name": "channel_jobs_channel_status_idx",+ "columns": [+ {+ "expression": "channel_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "channel_jobs_continuation_idx": {+ "name": "channel_jobs_continuation_idx",+ "columns": [+ {+ "expression": "member_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "requester_member_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "thread_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "claimed_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "channel_jobs_topic_idx": {+ "name": "channel_jobs_topic_idx",+ "columns": [+ {+ "expression": "topic_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "published_message_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "channel_jobs_member_queue_idx": {+ "name": "channel_jobs_member_queue_idx",+ "columns": [+ {+ "expression": "member_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "channel_jobs_lease_expires_idx": {+ "name": "channel_jobs_lease_expires_idx",+ "columns": [+ {+ "expression": "lease_expires_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"channel_jobs\".\"writer_held\" AND \"channel_jobs\".\"isolated_at\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "channel_jobs_active_member_unique": {+ "name": "channel_jobs_active_member_unique",+ "columns": [+ {+ "expression": "member_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"channel_jobs\".\"writer_held\" AND \"channel_jobs\".\"isolated_at\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "channel_jobs_active_directory_unique": {+ "name": "channel_jobs_active_directory_unique",+ "columns": [+ {+ "expression": "device_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "working_directory",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"channel_jobs\".\"device_id\" IS NOT NULL AND \"channel_jobs\".\"working_directory\" IS NOT NULL AND \"channel_jobs\".\"writer_held\"",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "channel_jobs_channel_id_channels_id_fk": {+ "name": "channel_jobs_channel_id_channels_id_fk",+ "tableFrom": "channel_jobs",+ "tableTo": "channels",+ "columnsFrom": ["channel_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "channel_jobs_topic_id_topics_id_fk": {+ "name": "channel_jobs_topic_id_topics_id_fk",+ "tableFrom": "channel_jobs",+ "tableTo": "topics",+ "columnsFrom": ["topic_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "channel_jobs_operation_id_agent_operations_id_fk": {+ "name": "channel_jobs_operation_id_agent_operations_id_fk",+ "tableFrom": "channel_jobs",+ "tableTo": "agent_operations",+ "columnsFrom": ["operation_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "channel_jobs_member_fk": {+ "name": "channel_jobs_member_fk",+ "tableFrom": "channel_jobs",+ "tableTo": "channel_members",+ "columnsFrom": ["channel_id", "member_id"],+ "columnsTo": ["channel_id", "id"],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "channel_jobs_requester_fk": {+ "name": "channel_jobs_requester_fk",+ "tableFrom": "channel_jobs",+ "tableTo": "channel_members",+ "columnsFrom": ["channel_id", "requester_member_id"],+ "columnsTo": ["channel_id", "id"],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "channel_jobs_message_fk": {+ "name": "channel_jobs_message_fk",+ "tableFrom": "channel_jobs",+ "tableTo": "channel_messages",+ "columnsFrom": ["channel_id", "message_id"],+ "columnsTo": ["channel_id", "id"],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "channel_jobs_thread_fk": {+ "name": "channel_jobs_thread_fk",+ "tableFrom": "channel_jobs",+ "tableTo": "channel_threads",+ "columnsFrom": ["channel_id", "thread_id"],+ "columnsTo": ["channel_id", "id"],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "channel_jobs_operation_id_unique": {+ "name": "channel_jobs_operation_id_unique",+ "nullsNotDistinct": false,+ "columns": ["operation_id"]+ },+ "channel_jobs_scope_unique": {+ "name": "channel_jobs_scope_unique",+ "nullsNotDistinct": false,+ "columns": ["channel_id", "id"]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.channel_member_grants": {+ "name": "channel_member_grants",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "channel_id": {+ "name": "channel_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "member_id": {+ "name": "member_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "device_owner_id": {+ "name": "device_owner_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "device_id": {+ "name": "device_id",+ "type": "varchar(64)",+ "primaryKey": false,+ "notNull": true+ },+ "working_directory": {+ "name": "working_directory",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "requested_by_member_id": {+ "name": "requested_by_member_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "decided_at": {+ "name": "decided_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "revoked_at": {+ "name": "revoked_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "revoke_reason": {+ "name": "revoke_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'{}'::jsonb"+ },+ "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": {+ "channel_member_grants_member_unique": {+ "name": "channel_member_grants_member_unique",+ "columns": [+ {+ "expression": "member_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "channel_member_grants_owner_status_idx": {+ "name": "channel_member_grants_owner_status_idx",+ "columns": [+ {+ "expression": "device_owner_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "channel_member_grants_channel_id_channels_id_fk": {+ "name": "channel_member_grants_channel_id_channels_id_fk",+ "tableFrom": "channel_member_grants",+ "tableTo": "channels",+ "columnsFrom": ["channel_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "channel_member_grants_device_owner_id_users_id_fk": {+ "name": "channel_member_grants_device_owner_id_users_id_fk",+ "tableFrom": "channel_member_grants",+ "tableTo": "users",+ "columnsFrom": ["device_owner_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "channel_member_grants_member_fk": {+ "name": "channel_member_grants_member_fk",+ "tableFrom": "channel_member_grants",+ "tableTo": "channel_members",+ "columnsFrom": ["channel_id", "member_id"],+ "columnsTo": ["channel_id", "id"],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "channel_member_grants_requester_fk": {+ "name": "channel_member_grants_requester_fk",+ "tableFrom": "channel_member_grants",+ "tableTo": "channel_members",+ "columnsFrom": ["channel_id", "requested_by_member_id"],+ "columnsTo": ["channel_id", "id"],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.channel_members": {+ "name": "channel_members",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "channel_id": {+ "name": "channel_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "actor_type": {+ "name": "actor_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "last_read_sequence": {+ "name": "last_read_sequence",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'{}'::jsonb"+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "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": {+ "channel_members_channel_user_unique": {+ "name": "channel_members_channel_user_unique",+ "columns": [+ {+ "expression": "channel_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"channel_members\".\"user_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "channel_members_user_id_idx": {+ "name": "channel_members_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "channel_members_agent_id_idx": {+ "name": "channel_members_agent_id_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "channel_members_channel_id_channels_id_fk": {+ "name": "channel_members_channel_id_channels_id_fk",+ "tableFrom": "channel_members",+ "tableTo": "channels",+ "columnsFrom": ["channel_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "channel_members_user_id_users_id_fk": {+ "name": "channel_members_user_id_users_id_fk",+ "tableFrom": "channel_members",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "channel_members_agent_id_agents_id_fk": {+ "name": "channel_members_agent_id_agents_id_fk",+ "tableFrom": "channel_members",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "channel_members_scope_unique": {+ "name": "channel_members_scope_unique",+ "nullsNotDistinct": false,+ "columns": ["channel_id", "id"]+ }+ },+ "policies": {},+ "checkConstraints": {+ "channel_members_actor_type_check": {+ "name": "channel_members_actor_type_check",+ "value": "\"channel_members\".\"actor_type\" IN ('user', 'agent')"+ },+ "channel_members_user_shape_check": {+ "name": "channel_members_user_shape_check",+ "value": "\"channel_members\".\"actor_type\" <> 'user' OR \"channel_members\".\"role\" IS NOT NULL"+ },+ "channel_members_agent_shape_check": {+ "name": "channel_members_agent_shape_check",+ "value": "\"channel_members\".\"actor_type\" <> 'agent' OR (\"channel_members\".\"name\" IS NOT NULL AND \"channel_members\".\"config\" IS NOT NULL)"+ },+ "channel_members_user_id_owner_check": {+ "name": "channel_members_user_id_owner_check",+ "value": "\"channel_members\".\"user_id\" IS NULL OR \"channel_members\".\"actor_type\" = 'user'"+ },+ "channel_members_role_owner_check": {+ "name": "channel_members_role_owner_check",+ "value": "\"channel_members\".\"role\" IS NULL OR \"channel_members\".\"actor_type\" = 'user'"+ },+ "channel_members_agent_id_owner_check": {+ "name": "channel_members_agent_id_owner_check",+ "value": "\"channel_members\".\"agent_id\" IS NULL OR \"channel_members\".\"actor_type\" = 'agent'"+ },+ "channel_members_config_owner_check": {+ "name": "channel_members_config_owner_check",+ "value": "\"channel_members\".\"config\" IS NULL OR \"channel_members\".\"actor_type\" <> 'user'"+ }+ },+ "isRLSEnabled": false+ },+ "public.channel_message_files": {+ "name": "channel_message_files",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "message_id": {+ "name": "message_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "file_id": {+ "name": "file_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "sort_order": {+ "name": "sort_order",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "channel_message_files_file_idx": {+ "name": "channel_message_files_file_idx",+ "columns": [+ {+ "expression": "file_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "channel_message_files_message_id_channel_messages_id_fk": {+ "name": "channel_message_files_message_id_channel_messages_id_fk",+ "tableFrom": "channel_message_files",+ "tableTo": "channel_messages",+ "columnsFrom": ["message_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "channel_message_files_file_id_files_id_fk": {+ "name": "channel_message_files_file_id_files_id_fk",+ "tableFrom": "channel_message_files",+ "tableTo": "files",+ "columnsFrom": ["file_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "channel_message_files_message_file_unique": {+ "name": "channel_message_files_message_file_unique",+ "nullsNotDistinct": false,+ "columns": ["message_id", "file_id"]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.channel_messages": {+ "name": "channel_messages",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "channel_id": {+ "name": "channel_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "thread_id": {+ "name": "thread_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "sequence": {+ "name": "sequence",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "mentions": {+ "name": "mentions",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "request_key": {+ "name": "request_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "reply_to_id": {+ "name": "reply_to_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "routing_status": {+ "name": "routing_status",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "routing_source": {+ "name": "routing_source",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "routing_reason": {+ "name": "routing_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "routing_attempt": {+ "name": "routing_attempt",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "recipient_member_ids": {+ "name": "recipient_member_ids",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'{}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "channel_messages_sequence_unique": {+ "name": "channel_messages_sequence_unique",+ "columns": [+ {+ "expression": "channel_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "sequence",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "channel_messages_request_key_unique": {+ "name": "channel_messages_request_key_unique",+ "columns": [+ {+ "expression": "channel_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "request_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "channel_messages_thread_sequence_idx": {+ "name": "channel_messages_thread_sequence_idx",+ "columns": [+ {+ "expression": "channel_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "thread_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "sequence",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "channel_messages_request_sequence_idx": {+ "name": "channel_messages_request_sequence_idx",+ "columns": [+ {+ "expression": "channel_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "thread_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "sequence",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"channel_messages\".\"routing_status\" <> 'reply'",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "channel_messages_routing_pending_idx": {+ "name": "channel_messages_routing_pending_idx",+ "columns": [+ {+ "expression": "channel_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"channel_messages\".\"routing_status\" = 'pending'",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "channel_messages_channel_id_channels_id_fk": {+ "name": "channel_messages_channel_id_channels_id_fk",+ "tableFrom": "channel_messages",+ "tableTo": "channels",+ "columnsFrom": ["channel_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "channel_messages_user_id_users_id_fk": {+ "name": "channel_messages_user_id_users_id_fk",+ "tableFrom": "channel_messages",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "channel_messages_agent_id_agents_id_fk": {+ "name": "channel_messages_agent_id_agents_id_fk",+ "tableFrom": "channel_messages",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "channel_messages_thread_fk": {+ "name": "channel_messages_thread_fk",+ "tableFrom": "channel_messages",+ "tableTo": "channel_threads",+ "columnsFrom": ["channel_id", "thread_id"],+ "columnsTo": ["channel_id", "id"],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "channel_messages_scope_unique": {+ "name": "channel_messages_scope_unique",+ "nullsNotDistinct": false,+ "columns": ["channel_id", "id"]+ }+ },+ "policies": {},+ "checkConstraints": {+ "channel_messages_sender_check": {+ "name": "channel_messages_sender_check",+ "value": "\"channel_messages\".\"user_id\" IS NULL OR \"channel_messages\".\"agent_id\" IS NULL"+ },+ "channel_messages_user_sender_check": {+ "name": "channel_messages_user_sender_check",+ "value": "\"channel_messages\".\"routing_status\" <> 'reply' OR \"channel_messages\".\"user_id\" IS NULL"+ },+ "channel_messages_agent_sender_check": {+ "name": "channel_messages_agent_sender_check",+ "value": "\"channel_messages\".\"routing_status\" = 'reply' OR \"channel_messages\".\"agent_id\" IS NULL"+ }+ },+ "isRLSEnabled": false+ },+ "public.channel_threads": {+ "name": "channel_threads",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "channel_id": {+ "name": "channel_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "root_message_id": {+ "name": "root_message_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "root_sequence": {+ "name": "root_sequence",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "follower_member_ids": {+ "name": "follower_member_ids",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'{}'::jsonb"+ },+ "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+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "channel_threads_root_unique": {+ "name": "channel_threads_root_unique",+ "columns": [+ {+ "expression": "channel_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "root_message_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"channel_threads\".\"is_deleted\" IS NOT TRUE",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "channel_threads_channel_id_channels_id_fk": {+ "name": "channel_threads_channel_id_channels_id_fk",+ "tableFrom": "channel_threads",+ "tableTo": "channels",+ "columnsFrom": ["channel_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "channel_threads_root_fk": {+ "name": "channel_threads_root_fk",+ "tableFrom": "channel_threads",+ "tableTo": "channel_messages",+ "columnsFrom": ["channel_id", "root_message_id"],+ "columnsTo": ["channel_id", "id"],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "channel_threads_scope_unique": {+ "name": "channel_threads_scope_unique",+ "nullsNotDistinct": false,+ "columns": ["channel_id", "id"]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.channels": {+ "name": "channels",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "project_id": {+ "name": "project_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "peer_user_id": {+ "name": "peer_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "sequence": {+ "name": "sequence",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'private'"+ },+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'{}'::jsonb"+ },+ "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+ },+ "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": {+ "channels_user_id_idx": {+ "name": "channels_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "channels_direct_unique": {+ "name": "channels_direct_unique",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "coalesce(\"workspace_id\", '')",+ "asc": true,+ "isExpression": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"channels\".\"agent_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "channels_project_id_idx": {+ "name": "channels_project_id_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"channels\".\"project_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "channels_workspace_visibility_idx": {+ "name": "channels_workspace_visibility_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "visibility",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "channels_user_id_users_id_fk": {+ "name": "channels_user_id_users_id_fk",+ "tableFrom": "channels",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "channels_workspace_id_workspaces_id_fk": {+ "name": "channels_workspace_id_workspaces_id_fk",+ "tableFrom": "channels",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "channels_project_id_projects_id_fk": {+ "name": "channels_project_id_projects_id_fk",+ "tableFrom": "channels",+ "tableTo": "projects",+ "columnsFrom": ["project_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "channels_agent_id_agents_id_fk": {+ "name": "channels_agent_id_agents_id_fk",+ "tableFrom": "channels",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "channels_peer_user_id_users_id_fk": {+ "name": "channels_peer_user_id_users_id_fk",+ "tableFrom": "channels",+ "tableTo": "users",+ "columnsFrom": ["peer_user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "channels_direct_visibility_check": {+ "name": "channels_direct_visibility_check",+ "value": "\"channels\".\"agent_id\" IS NULL OR \"channels\".\"visibility\" = 'private'"+ }+ },+ "isRLSEnabled": false+ },+ "public.chat_groups": {+ "name": "chat_groups",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "avatar": {+ "name": "avatar",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "background_color": {+ "name": "background_color",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "market_identifier": {+ "name": "market_identifier",+ "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+ },+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "group_id": {+ "name": "group_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "pinned": {+ "name": "pinned",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'public'"+ },+ "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": {+ "chat_groups_client_id_user_id_unique": {+ "name": "chat_groups_client_id_user_id_unique",+ "columns": [+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "chat_groups_user_id_idx": {+ "name": "chat_groups_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "chat_groups_group_id_idx": {+ "name": "chat_groups_group_id_idx",+ "columns": [+ {+ "expression": "group_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "chat_groups_workspace_id_idx": {+ "name": "chat_groups_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "chat_groups_workspace_visibility_idx": {+ "name": "chat_groups_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": {}+ }+ },+ "foreignKeys": {+ "chat_groups_user_id_users_id_fk": {+ "name": "chat_groups_user_id_users_id_fk",+ "tableFrom": "chat_groups",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "chat_groups_workspace_id_workspaces_id_fk": {+ "name": "chat_groups_workspace_id_workspaces_id_fk",+ "tableFrom": "chat_groups",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "chat_groups_group_id_session_groups_id_fk": {+ "name": "chat_groups_group_id_session_groups_id_fk",+ "tableFrom": "chat_groups",+ "tableTo": "session_groups",+ "columnsFrom": ["group_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.chat_groups_agents": {+ "name": "chat_groups_agents",+ "schema": "",+ "columns": {+ "chat_group_id": {+ "name": "chat_group_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_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+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ },+ "order": {+ "name": "order",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "default": 0+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "default": "'participant'"+ },+ "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": {+ "chat_groups_agents_user_id_idx": {+ "name": "chat_groups_agents_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "chat_groups_agents_workspace_id_idx": {+ "name": "chat_groups_agents_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "chat_groups_agents_chat_group_id_chat_groups_id_fk": {+ "name": "chat_groups_agents_chat_group_id_chat_groups_id_fk",+ "tableFrom": "chat_groups_agents",+ "tableTo": "chat_groups",+ "columnsFrom": ["chat_group_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "chat_groups_agents_agent_id_agents_id_fk": {+ "name": "chat_groups_agents_agent_id_agents_id_fk",+ "tableFrom": "chat_groups_agents",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "chat_groups_agents_user_id_users_id_fk": {+ "name": "chat_groups_agents_user_id_users_id_fk",+ "tableFrom": "chat_groups_agents",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "chat_groups_agents_workspace_id_workspaces_id_fk": {+ "name": "chat_groups_agents_workspace_id_workspaces_id_fk",+ "tableFrom": "chat_groups_agents",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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"]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_connector_tools": {+ "name": "user_connector_tools",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "user_connector_id": {+ "name": "user_connector_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+ },+ "tool_name": {+ "name": "tool_name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "display_name": {+ "name": "display_name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "input_schema": {+ "name": "input_schema",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "output_schema": {+ "name": "output_schema",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "crud_type": {+ "name": "crud_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "render_config": {+ "name": "render_config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "permission": {+ "name": "permission",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "is_work_artifact": {+ "name": "is_work_artifact",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "work_artifact_config": {+ "name": "work_artifact_config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "limit_config": {+ "name": "limit_config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": true+ "notNull": true,+ "default": "now()"},- "file_id": {- "name": "file_id",- "type": "text",+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": true+ "notNull": true,+ "default": "now()"},- "sort_order": {- "name": "sort_order",- "type": "integer",+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": true+ "notNull": true,+ "default": "now()"}},"indexes": {- "channel_message_files_file_idx": {- "name": "channel_message_files_file_idx",+ "user_connector_tools_connector_tool_unique": {+ "name": "user_connector_tools_connector_tool_unique","columns": [{- "expression": "file_id",+ "expression": "user_connector_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "tool_name",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_connector_tools_user_id_idx": {+ "name": "user_connector_tools_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_connector_tools_connector_id_idx": {+ "name": "user_connector_tools_connector_id_idx",+ "columns": [+ {+ "expression": "user_connector_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_connector_tools_workspace_id_idx": {+ "name": "user_connector_tools_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"@@ -12122,39 +15836,42 @@}},"foreignKeys": {- "channel_message_files_message_id_channel_messages_id_fk": {- "name": "channel_message_files_message_id_channel_messages_id_fk",- "tableFrom": "channel_message_files",- "tableTo": "channel_messages",- "columnsFrom": ["message_id"],+ "user_connector_tools_user_connector_id_user_connectors_id_fk": {+ "name": "user_connector_tools_user_connector_id_user_connectors_id_fk",+ "tableFrom": "user_connector_tools",+ "tableTo": "user_connectors",+ "columnsFrom": ["user_connector_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "channel_message_files_file_id_files_id_fk": {- "name": "channel_message_files_file_id_files_id_fk",- "tableFrom": "channel_message_files",- "tableTo": "files",- "columnsFrom": ["file_id"],+ "user_connector_tools_user_id_users_id_fk": {+ "name": "user_connector_tools_user_id_users_id_fk",+ "tableFrom": "user_connector_tools",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_connector_tools_workspace_id_workspaces_id_fk": {+ "name": "user_connector_tools_workspace_id_workspaces_id_fk",+ "tableFrom": "user_connector_tools",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"}},"compositePrimaryKeys": {},- "uniqueConstraints": {- "channel_message_files_message_file_unique": {- "name": "channel_message_files_message_file_unique",- "nullsNotDistinct": false,- "columns": ["message_id", "file_id"]- }- },+ "uniqueConstraints": {},"policies": {},"checkConstraints": {},"isRLSEnabled": false},- "public.channel_messages": {- "name": "channel_messages",+ "public.user_connectors": {+ "name": "user_connectors","schema": "","columns": {"id": {@@ -12164,99 +15881,110 @@"notNull": true,"default": "gen_random_uuid()"},- "channel_id": {- "name": "channel_id",+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,"notNull": true},- "thread_id": {- "name": "thread_id",+ "workspace_id": {+ "name": "workspace_id","type": "text","primaryKey": false,"notNull": false},- "sequence": {- "name": "sequence",- "type": "integer",+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "identifier": {+ "name": "identifier",+ "type": "varchar(255)","primaryKey": false,"notNull": true},- "content": {- "name": "content",+ "name": {+ "name": "name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "source_type": {+ "name": "source_type","type": "text","primaryKey": false,"notNull": true},- "user_id": {- "name": "user_id",+ "mcp_server_url": {+ "name": "mcp_server_url","type": "text","primaryKey": false,"notNull": false},- "agent_id": {- "name": "agent_id",+ "mcp_connection_type": {+ "name": "mcp_connection_type","type": "text","primaryKey": false,"notNull": false},- "mentions": {- "name": "mentions",+ "mcp_stdio_config": {+ "name": "mcp_stdio_config","type": "jsonb","primaryKey": false,- "notNull": true,- "default": "'[]'::jsonb"+ "notNull": false},- "request_key": {- "name": "request_key",+ "status": {+ "name": "status","type": "text","primaryKey": false,"notNull": true},- "reply_to_id": {- "name": "reply_to_id",- "type": "uuid",+ "is_enabled": {+ "name": "is_enabled",+ "type": "boolean","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": true},- "routing_status": {- "name": "routing_status",- "type": "text",+ "oidc_config": {+ "name": "oidc_config",+ "type": "jsonb","primaryKey": false,- "notNull": true+ "notNull": false},- "routing_source": {- "name": "routing_source",+ "credentials": {+ "name": "credentials","type": "text","primaryKey": false,"notNull": false},- "routing_reason": {- "name": "routing_reason",- "type": "text",+ "token_expires_at": {+ "name": "token_expires_at",+ "type": "timestamp with time zone","primaryKey": false,"notNull": false},- "routing_attempt": {- "name": "routing_attempt",- "type": "integer",+ "metadata": {+ "name": "metadata",+ "type": "jsonb","primaryKey": false,- "notNull": true,- "default": 0+ "notNull": false},- "recipient_member_ids": {- "name": "recipient_member_ids",- "type": "jsonb",+ "visibility": {+ "name": "visibility",+ "type": "text","primaryKey": false,"notNull": true,- "default": "'[]'::jsonb"+ "default": "'public'"},- "metadata": {- "name": "metadata",- "type": "jsonb",+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": false,- "default": "'{}'::jsonb"+ "notNull": true,+ "default": "now()"},"created_at": {"name": "created_at",@@ -12264,252 +15992,242 @@"primaryKey": false,"notNull": true,"default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"}},"indexes": {- "channel_messages_sequence_unique": {- "name": "channel_messages_sequence_unique",+ "user_connectors_personal_identifier_idx": {+ "name": "user_connectors_personal_identifier_idx","columns": [{- "expression": "channel_id",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "sequence",+ "expression": "identifier","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,+ "isUnique": false,+ "where": "\"user_connectors\".\"workspace_id\" IS NULL AND \"user_connectors\".\"agent_id\" IS NULL","concurrently": false,"method": "btree","with": {}},- "channel_messages_request_key_unique": {- "name": "channel_messages_request_key_unique",+ "user_connectors_workspace_identifier_idx": {+ "name": "user_connectors_workspace_identifier_idx","columns": [{- "expression": "channel_id",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "request_key",+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "identifier","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,+ "isUnique": false,+ "where": "\"user_connectors\".\"workspace_id\" IS NOT NULL AND \"user_connectors\".\"agent_id\" IS NULL","concurrently": false,"method": "btree","with": {}},- "channel_messages_thread_sequence_idx": {- "name": "channel_messages_thread_sequence_idx",+ "user_connectors_agent_identifier_idx": {+ "name": "user_connectors_agent_identifier_idx","columns": [{- "expression": "channel_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "thread_id",+ "expression": "agent_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "sequence",+ "expression": "identifier","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,+ "where": "\"user_connectors\".\"agent_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}},- "channel_messages_request_sequence_idx": {- "name": "channel_messages_request_sequence_idx",+ "user_connectors_user_id_idx": {+ "name": "user_connectors_user_id_idx","columns": [{- "expression": "channel_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "thread_id",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_connectors_token_expires_at_idx": {+ "name": "user_connectors_token_expires_at_idx",+ "columns": [{- "expression": "sequence",+ "expression": "token_expires_at","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,- "where": "\"channel_messages\".\"routing_status\" <> 'reply'","concurrently": false,"method": "btree","with": {}},- "channel_messages_routing_pending_idx": {- "name": "channel_messages_routing_pending_idx",+ "user_connectors_workspace_id_idx": {+ "name": "user_connectors_workspace_id_idx","columns": [{- "expression": "channel_id",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_connectors_agent_id_idx": {+ "name": "user_connectors_agent_id_idx",+ "columns": [{- "expression": "id",+ "expression": "agent_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,- "where": "\"channel_messages\".\"routing_status\" = 'pending'","concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "channel_messages_channel_id_channels_id_fk": {- "name": "channel_messages_channel_id_channels_id_fk",- "tableFrom": "channel_messages",- "tableTo": "channels",- "columnsFrom": ["channel_id"],+ "user_connectors_user_id_users_id_fk": {+ "name": "user_connectors_user_id_users_id_fk",+ "tableFrom": "user_connectors",+ "tableTo": "users",+ "columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "channel_messages_user_id_users_id_fk": {- "name": "channel_messages_user_id_users_id_fk",- "tableFrom": "channel_messages",- "tableTo": "users",- "columnsFrom": ["user_id"],+ "user_connectors_workspace_id_workspaces_id_fk": {+ "name": "user_connectors_workspace_id_workspaces_id_fk",+ "tableFrom": "user_connectors",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],"columnsTo": ["id"],- "onDelete": "set null",+ "onDelete": "cascade","onUpdate": "no action"},- "channel_messages_agent_id_agents_id_fk": {- "name": "channel_messages_agent_id_agents_id_fk",- "tableFrom": "channel_messages",+ "user_connectors_agent_id_agents_id_fk": {+ "name": "user_connectors_agent_id_agents_id_fk",+ "tableFrom": "user_connectors","tableTo": "agents","columnsFrom": ["agent_id"],"columnsTo": ["id"],- "onDelete": "set null",- "onUpdate": "no action"- },- "channel_messages_thread_fk": {- "name": "channel_messages_thread_fk",- "tableFrom": "channel_messages",- "tableTo": "channel_threads",- "columnsFrom": ["channel_id", "thread_id"],- "columnsTo": ["channel_id", "id"],- "onDelete": "no action",+ "onDelete": "cascade","onUpdate": "no action"}},"compositePrimaryKeys": {},- "uniqueConstraints": {- "channel_messages_scope_unique": {- "name": "channel_messages_scope_unique",- "nullsNotDistinct": false,- "columns": ["channel_id", "id"]- }- },+ "uniqueConstraints": {},"policies": {},- "checkConstraints": {- "channel_messages_sender_check": {- "name": "channel_messages_sender_check",- "value": "\"channel_messages\".\"user_id\" IS NULL OR \"channel_messages\".\"agent_id\" IS NULL"- },- "channel_messages_user_sender_check": {- "name": "channel_messages_user_sender_check",- "value": "\"channel_messages\".\"routing_status\" <> 'reply' OR \"channel_messages\".\"user_id\" IS NULL"- },- "channel_messages_agent_sender_check": {- "name": "channel_messages_agent_sender_check",- "value": "\"channel_messages\".\"routing_status\" = 'reply' OR \"channel_messages\".\"agent_id\" IS NULL"- }- },+ "checkConstraints": {},"isRLSEnabled": false},- "public.channel_threads": {- "name": "channel_threads",+ "public.user_installed_plugins": {+ "name": "user_installed_plugins","schema": "","columns": {- "id": {- "name": "id",+ "user_id": {+ "name": "user_id","type": "text",- "primaryKey": true,+ "primaryKey": false,"notNull": true},- "channel_id": {- "name": "channel_id",+ "workspace_id": {+ "name": "workspace_id","type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "root_message_id": {- "name": "root_message_id",- "type": "uuid",+ "identifier": {+ "name": "identifier",+ "type": "text","primaryKey": false,"notNull": true},- "root_sequence": {- "name": "root_sequence",- "type": "integer",+ "type": {+ "name": "type",+ "type": "text","primaryKey": false,"notNull": true},- "follower_member_ids": {- "name": "follower_member_ids",+ "manifest": {+ "name": "manifest","type": "jsonb","primaryKey": false,- "notNull": true,- "default": "'[]'::jsonb"+ "notNull": false},- "status": {- "name": "status",- "type": "text",+ "settings": {+ "name": "settings",+ "type": "jsonb","primaryKey": false,- "notNull": true,- "default": "'active'"+ "notNull": false},- "metadata": {- "name": "metadata",+ "custom_params": {+ "name": "custom_params","type": "jsonb","primaryKey": false,- "notNull": false,- "default": "'{}'::jsonb"+ "notNull": false},- "deleted_at": {- "name": "deleted_at",- "type": "timestamp with time zone",+ "source": {+ "name": "source",+ "type": "varchar(255)","primaryKey": false,"notNull": false},- "is_deleted": {- "name": "is_deleted",- "type": "boolean",+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "now()"},"created_at": {"name": "created_at",@@ -12517,149 +16235,111 @@"primaryKey": false,"notNull": true,"default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"}},"indexes": {- "channel_threads_root_unique": {- "name": "channel_threads_root_unique",+ "user_installed_plugins_workspace_id_idx": {+ "name": "user_installed_plugins_workspace_id_idx","columns": [{- "expression": "channel_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "root_message_id",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,- "where": "\"channel_threads\".\"is_deleted\" IS NOT TRUE",+ "isUnique": false,"concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "channel_threads_channel_id_channels_id_fk": {- "name": "channel_threads_channel_id_channels_id_fk",- "tableFrom": "channel_threads",- "tableTo": "channels",- "columnsFrom": ["channel_id"],+ "user_installed_plugins_user_id_users_id_fk": {+ "name": "user_installed_plugins_user_id_users_id_fk",+ "tableFrom": "user_installed_plugins",+ "tableTo": "users",+ "columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "channel_threads_root_fk": {- "name": "channel_threads_root_fk",- "tableFrom": "channel_threads",- "tableTo": "channel_messages",- "columnsFrom": ["channel_id", "root_message_id"],- "columnsTo": ["channel_id", "id"],- "onDelete": "no action",+ "user_installed_plugins_workspace_id_workspaces_id_fk": {+ "name": "user_installed_plugins_workspace_id_workspaces_id_fk",+ "tableFrom": "user_installed_plugins",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade","onUpdate": "no action"}},- "compositePrimaryKeys": {},- "uniqueConstraints": {- "channel_threads_scope_unique": {- "name": "channel_threads_scope_unique",- "nullsNotDistinct": false,- "columns": ["channel_id", "id"]+ "compositePrimaryKeys": {+ "user_installed_plugins_user_id_identifier_pk": {+ "name": "user_installed_plugins_user_id_identifier_pk",+ "columns": ["user_id", "identifier"]}},+ "uniqueConstraints": {},"policies": {},"checkConstraints": {},"isRLSEnabled": false},- "public.channels": {- "name": "channels",+ "public.user_contact_requests": {+ "name": "user_contact_requests","schema": "","columns": {"id": {"name": "id",- "type": "text",+ "type": "uuid","primaryKey": true,- "notNull": true- },- "user_id": {- "name": "user_id",- "type": "text",- "primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "gen_random_uuid()"},- "workspace_id": {- "name": "workspace_id",+ "requester_id": {+ "name": "requester_id","type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "project_id": {- "name": "project_id",+ "addressee_id": {+ "name": "addressee_id","type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "agent_id": {- "name": "agent_id",+ "message": {+ "name": "message","type": "text","primaryKey": false,"notNull": false},- "title": {- "name": "title",- "type": "text",- "primaryKey": false,- "notNull": true- },- "sequence": {- "name": "sequence",- "type": "integer",- "primaryKey": false,- "notNull": true,- "default": 0- },"status": {"name": "status","type": "text","primaryKey": false,"notNull": true,- "default": "'active'"- },- "visibility": {- "name": "visibility",- "type": "text",- "primaryKey": false,- "notNull": true,- "default": "'private'"- },- "config": {- "name": "config",- "type": "jsonb",- "primaryKey": false,- "notNull": false- },- "metadata": {- "name": "metadata",- "type": "jsonb",- "primaryKey": false,- "notNull": false,- "default": "'{}'::jsonb"+ "default": "'pending'"},- "deleted_at": {- "name": "deleted_at",+ "responded_at": {+ "name": "responded_at","type": "timestamp with time zone","primaryKey": false,"notNull": false},- "is_deleted": {- "name": "is_deleted",- "type": "boolean",+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "now()"},"created_at": {"name": "created_at",@@ -12677,76 +16357,60 @@}},"indexes": {- "channels_user_id_idx": {- "name": "channels_user_id_idx",- "columns": [- {- "expression": "user_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "channels_direct_unique": {- "name": "channels_direct_unique",+ "user_contact_requests_pending_unique": {+ "name": "user_contact_requests_pending_unique","columns": [{- "expression": "agent_id",+ "expression": "requester_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "user_id",+ "expression": "addressee_id","isExpression": false,"asc": true,"nulls": "last"- },- {- "expression": "coalesce(\"workspace_id\", '')",- "asc": true,- "isExpression": true,- "nulls": "last"}],"isUnique": true,- "where": "\"channels\".\"agent_id\" IS NOT NULL",+ "where": "\"user_contact_requests\".\"status\" = 'pending'","concurrently": false,"method": "btree","with": {}},- "channels_project_id_idx": {- "name": "channels_project_id_idx",+ "user_contact_requests_addressee_status_idx": {+ "name": "user_contact_requests_addressee_status_idx","columns": [{- "expression": "project_id",+ "expression": "addressee_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,- "where": "\"channels\".\"project_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}},- "channels_workspace_visibility_idx": {- "name": "channels_workspace_visibility_idx",+ "user_contact_requests_requester_status_idx": {+ "name": "user_contact_requests_requester_status_idx","columns": [{- "expression": "workspace_id",+ "expression": "requester_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "visibility",+ "expression": "status","isExpression": false,"asc": true,"nulls": "last"@@ -12759,38 +16423,20 @@}},"foreignKeys": {- "channels_user_id_users_id_fk": {- "name": "channels_user_id_users_id_fk",- "tableFrom": "channels",+ "user_contact_requests_requester_id_users_id_fk": {+ "name": "user_contact_requests_requester_id_users_id_fk",+ "tableFrom": "user_contact_requests","tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],- "onDelete": "set null",- "onUpdate": "no action"- },- "channels_workspace_id_workspaces_id_fk": {- "name": "channels_workspace_id_workspaces_id_fk",- "tableFrom": "channels",- "tableTo": "workspaces",- "columnsFrom": ["workspace_id"],+ "columnsFrom": ["requester_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "channels_project_id_projects_id_fk": {- "name": "channels_project_id_projects_id_fk",- "tableFrom": "channels",- "tableTo": "projects",- "columnsFrom": ["project_id"],- "columnsTo": ["id"],- "onDelete": "set null",- "onUpdate": "no action"- },- "channels_agent_id_agents_id_fk": {- "name": "channels_agent_id_agents_id_fk",- "tableFrom": "channels",- "tableTo": "agents",- "columnsFrom": ["agent_id"],+ "user_contact_requests_addressee_id_users_id_fk": {+ "name": "user_contact_requests_addressee_id_users_id_fk",+ "tableFrom": "user_contact_requests",+ "tableTo": "users",+ "columnsFrom": ["addressee_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"@@ -12800,76 +16446,35 @@"uniqueConstraints": {},"policies": {},"checkConstraints": {- "channels_direct_visibility_check": {- "name": "channels_direct_visibility_check",- "value": "\"channels\".\"agent_id\" IS NULL OR \"channels\".\"visibility\" = 'private'"+ "user_contact_requests_not_self_check": {+ "name": "user_contact_requests_not_self_check",+ "value": "\"user_contact_requests\".\"requester_id\" <> \"user_contact_requests\".\"addressee_id\""}},"isRLSEnabled": false},- "public.chat_groups": {- "name": "chat_groups",+ "public.user_contact_tag_assignments": {+ "name": "user_contact_tag_assignments","schema": "","columns": {"id": {"name": "id",- "type": "text",+ "type": "uuid","primaryKey": true,- "notNull": true- },- "title": {- "name": "title",- "type": "text",- "primaryKey": false,- "notNull": false- },- "description": {- "name": "description",- "type": "text",- "primaryKey": false,- "notNull": false- },- "avatar": {- "name": "avatar",- "type": "text",- "primaryKey": false,- "notNull": false- },- "background_color": {- "name": "background_color",- "type": "text",- "primaryKey": false,- "notNull": false- },- "market_identifier": {- "name": "market_identifier",- "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+ "notNull": true,+ "default": "gen_random_uuid()"},- "config": {- "name": "config",- "type": "jsonb",+ "tag_id": {+ "name": "tag_id",+ "type": "uuid","primaryKey": false,- "notNull": false+ "notNull": true},- "client_id": {- "name": "client_id",- "type": "text",+ "contact_id": {+ "name": "contact_id",+ "type": "uuid","primaryKey": false,- "notNull": false+ "notNull": true},"user_id": {"name": "user_id",@@ -12877,44 +16482,6 @@"primaryKey": false,"notNull": true},- "workspace_id": {- "name": "workspace_id",- "type": "text",- "primaryKey": false,- "notNull": false- },- "group_id": {- "name": "group_id",- "type": "text",- "primaryKey": false,- "notNull": false- },- "pinned": {- "name": "pinned",- "type": "boolean",- "primaryKey": false,- "notNull": false,- "default": false- },- "visibility": {- "name": "visibility",- "type": "text",- "primaryKey": false,- "notNull": true,- "default": "'public'"- },- "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",@@ -12938,17 +16505,17 @@}},"indexes": {- "chat_groups_client_id_user_id_unique": {- "name": "chat_groups_client_id_user_id_unique",+ "user_contact_tag_assignments_tag_id_contact_id_unique": {+ "name": "user_contact_tag_assignments_tag_id_contact_id_unique","columns": [{- "expression": "client_id",+ "expression": "tag_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "user_id",+ "expression": "contact_id","isExpression": false,"asc": true,"nulls": "last"@@ -12959,11 +16526,11 @@"method": "btree","with": {}},- "chat_groups_user_id_idx": {- "name": "chat_groups_user_id_idx",+ "user_contact_tag_assignments_contact_id_idx": {+ "name": "user_contact_tag_assignments_contact_id_idx","columns": [{- "expression": "user_id",+ "expression": "contact_id","isExpression": false,"asc": true,"nulls": "last"@@ -12974,11 +16541,11 @@"method": "btree","with": {}},- "chat_groups_group_id_idx": {- "name": "chat_groups_group_id_idx",+ "user_contact_tag_assignments_user_id_idx": {+ "name": "user_contact_tag_assignments_user_id_idx","columns": [{- "expression": "group_id",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"@@ -12988,77 +16555,133 @@"concurrently": false,"method": "btree","with": {}+ }+ },+ "foreignKeys": {+ "user_contact_tag_assignments_tag_id_user_contact_tags_id_fk": {+ "name": "user_contact_tag_assignments_tag_id_user_contact_tags_id_fk",+ "tableFrom": "user_contact_tag_assignments",+ "tableTo": "user_contact_tags",+ "columnsFrom": ["tag_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"},- "chat_groups_workspace_id_idx": {- "name": "chat_groups_workspace_id_idx",- "columns": [- {- "expression": "workspace_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}+ "user_contact_tag_assignments_contact_id_user_contacts_id_fk": {+ "name": "user_contact_tag_assignments_contact_id_user_contacts_id_fk",+ "tableFrom": "user_contact_tag_assignments",+ "tableTo": "user_contacts",+ "columnsFrom": ["contact_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"},- "chat_groups_workspace_visibility_idx": {- "name": "chat_groups_workspace_visibility_idx",+ "user_contact_tag_assignments_user_id_users_id_fk": {+ "name": "user_contact_tag_assignments_user_id_users_id_fk",+ "tableFrom": "user_contact_tag_assignments",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_contact_tags": {+ "name": "user_contact_tags",+ "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+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "sort_order": {+ "name": "sort_order",+ "type": "integer",+ "primaryKey": 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": {+ "user_contact_tags_user_id_name_unique": {+ "name": "user_contact_tags_user_id_name_unique","columns": [{- "expression": "workspace_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "visibility",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "user_id",+ "expression": "name","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,"concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "chat_groups_user_id_users_id_fk": {- "name": "chat_groups_user_id_users_id_fk",- "tableFrom": "chat_groups",+ "user_contact_tags_user_id_users_id_fk": {+ "name": "user_contact_tags_user_id_users_id_fk",+ "tableFrom": "user_contact_tags","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"- },- "chat_groups_workspace_id_workspaces_id_fk": {- "name": "chat_groups_workspace_id_workspaces_id_fk",- "tableFrom": "chat_groups",- "tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "chat_groups_group_id_session_groups_id_fk": {- "name": "chat_groups_group_id_session_groups_id_fk",- "tableFrom": "chat_groups",- "tableTo": "session_groups",- "columnsFrom": ["group_id"],- "columnsTo": ["id"],- "onDelete": "set null",- "onUpdate": "no action"}},"compositePrimaryKeys": {},@@ -13067,54 +16690,64 @@"checkConstraints": {},"isRLSEnabled": false},- "public.chat_groups_agents": {- "name": "chat_groups_agents",+ "public.user_contacts": {+ "name": "user_contacts","schema": "","columns": {- "chat_group_id": {- "name": "chat_group_id",+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,"notNull": true},- "agent_id": {- "name": "agent_id",+ "type": {+ "name": "type","type": "text","primaryKey": false,"notNull": true},- "user_id": {- "name": "user_id",+ "contact_user_id": {+ "name": "contact_user_id","type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "workspace_id": {- "name": "workspace_id",+ "agent_id": {+ "name": "agent_id","type": "text","primaryKey": false,"notNull": false},- "enabled": {- "name": "enabled",- "type": "boolean",+ "remark": {+ "name": "remark",+ "type": "text","primaryKey": false,- "notNull": false,- "default": true+ "notNull": false},- "order": {- "name": "order",- "type": "integer",+ "description": {+ "name": "description",+ "type": "text","primaryKey": false,- "notNull": false,- "default": 0+ "notNull": false},- "role": {- "name": "role",- "type": "text",+ "phones": {+ "name": "phones",+ "type": "text[]","primaryKey": false,- "notNull": false,- "default": "'participant'"+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false},"accessed_at": {"name": "accessed_at",@@ -13139,14 +16772,58 @@}},"indexes": {- "chat_groups_agents_user_id_idx": {- "name": "chat_groups_agents_user_id_idx",+ "user_contacts_user_unique": {+ "name": "user_contacts_user_unique",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "contact_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"user_contacts\".\"contact_user_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_contacts_agent_unique": {+ "name": "user_contacts_agent_unique","columns": [{"expression": "user_id","isExpression": false,"asc": true,"nulls": "last"+ },+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"user_contacts\".\"agent_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_contacts_contact_user_id_idx": {+ "name": "user_contacts_contact_user_id_idx",+ "columns": [+ {+ "expression": "contact_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"}],"isUnique": false,@@ -13154,11 +16831,11 @@"method": "btree","with": {}},- "chat_groups_agents_workspace_id_idx": {- "name": "chat_groups_agents_workspace_id_idx",+ "user_contacts_agent_id_idx": {+ "name": "user_contacts_agent_id_idx","columns": [{- "expression": "workspace_id",+ "expression": "agent_id","isExpression": false,"asc": true,"nulls": "last"@@ -13171,56 +16848,42 @@}},"foreignKeys": {- "chat_groups_agents_chat_group_id_chat_groups_id_fk": {- "name": "chat_groups_agents_chat_group_id_chat_groups_id_fk",- "tableFrom": "chat_groups_agents",- "tableTo": "chat_groups",- "columnsFrom": ["chat_group_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "chat_groups_agents_agent_id_agents_id_fk": {- "name": "chat_groups_agents_agent_id_agents_id_fk",- "tableFrom": "chat_groups_agents",- "tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "chat_groups_agents_user_id_users_id_fk": {- "name": "chat_groups_agents_user_id_users_id_fk",- "tableFrom": "chat_groups_agents",+ "user_contacts_user_id_users_id_fk": {+ "name": "user_contacts_user_id_users_id_fk",+ "tableFrom": "user_contacts","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "chat_groups_agents_workspace_id_workspaces_id_fk": {- "name": "chat_groups_agents_workspace_id_workspaces_id_fk",- "tableFrom": "chat_groups_agents",- "tableTo": "workspaces",- "columnsFrom": ["workspace_id"],+ "user_contacts_contact_user_id_users_id_fk": {+ "name": "user_contacts_contact_user_id_users_id_fk",+ "tableFrom": "user_contacts",+ "tableTo": "users",+ "columnsFrom": ["contact_user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_contacts_agent_id_agents_id_fk": {+ "name": "user_contacts_agent_id_agents_id_fk",+ "tableFrom": "user_contacts",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"}},- "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"]- }- },+ "compositePrimaryKeys": {},"uniqueConstraints": {},"policies": {},"checkConstraints": {},"isRLSEnabled": false},- "public.user_connector_tools": {- "name": "user_connector_tools",+ "public.dashboard_items": {+ "name": "dashboard_items","schema": "","columns": {"id": {@@ -13230,8 +16893,14 @@"notNull": true,"default": "gen_random_uuid()"},- "user_connector_id": {- "name": "user_connector_id",+ "dashboard_id": {+ "name": "dashboard_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "widget_id": {+ "name": "widget_id","type": "uuid","primaryKey": false,"notNull": true@@ -13248,78 +16917,18 @@"primaryKey": false,"notNull": false},- "tool_name": {- "name": "tool_name",- "type": "varchar(255)",- "primaryKey": false,- "notNull": true- },- "display_name": {- "name": "display_name",- "type": "varchar(255)",- "primaryKey": false,- "notNull": false- },- "description": {- "name": "description",- "type": "text",- "primaryKey": false,- "notNull": false- },- "input_schema": {- "name": "input_schema",- "type": "jsonb",- "primaryKey": false,- "notNull": false- },- "output_schema": {- "name": "output_schema",- "type": "jsonb",- "primaryKey": false,- "notNull": false- },- "crud_type": {- "name": "crud_type",- "type": "text",- "primaryKey": false,- "notNull": true- },- "render_config": {- "name": "render_config",+ "layout": {+ "name": "layout","type": "jsonb","primaryKey": false,"notNull": false},- "permission": {- "name": "permission",- "type": "text",- "primaryKey": false,- "notNull": true- },- "is_work_artifact": {- "name": "is_work_artifact",- "type": "boolean",+ "sort_order": {+ "name": "sort_order",+ "type": "integer","primaryKey": false,"notNull": true,- "default": false- },- "work_artifact_config": {- "name": "work_artifact_config",- "type": "jsonb",- "primaryKey": false,- "notNull": false- },- "limit_config": {- "name": "limit_config",- "type": "jsonb",- "primaryKey": false,- "notNull": false- },- "metadata": {- "name": "metadata",- "type": "jsonb",- "primaryKey": false,- "notNull": false+ "default": 0},"accessed_at": {"name": "accessed_at",@@ -13344,17 +16953,17 @@}},"indexes": {- "user_connector_tools_connector_tool_unique": {- "name": "user_connector_tools_connector_tool_unique",+ "dashboard_items_dashboard_id_widget_id_unique": {+ "name": "dashboard_items_dashboard_id_widget_id_unique","columns": [{- "expression": "user_connector_id",+ "expression": "dashboard_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "tool_name",+ "expression": "widget_id","isExpression": false,"asc": true,"nulls": "last"@@ -13365,11 +16974,17 @@"method": "btree","with": {}},- "user_connector_tools_user_id_idx": {- "name": "user_connector_tools_user_id_idx",+ "dashboard_items_dashboard_id_sort_order_idx": {+ "name": "dashboard_items_dashboard_id_sort_order_idx","columns": [{- "expression": "user_id",+ "expression": "dashboard_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "sort_order","isExpression": false,"asc": true,"nulls": "last"@@ -13380,11 +16995,11 @@"method": "btree","with": {}},- "user_connector_tools_connector_id_idx": {- "name": "user_connector_tools_connector_id_idx",+ "dashboard_items_widget_id_idx": {+ "name": "dashboard_items_widget_id_idx","columns": [{- "expression": "user_connector_id",+ "expression": "widget_id","isExpression": false,"asc": true,"nulls": "last"@@ -13395,8 +17010,23 @@"method": "btree","with": {}},- "user_connector_tools_workspace_id_idx": {- "name": "user_connector_tools_workspace_id_idx",+ "dashboard_items_user_id_idx": {+ "name": "dashboard_items_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "dashboard_items_workspace_id_idx": {+ "name": "dashboard_items_workspace_id_idx","columns": [{"expression": "workspace_id",@@ -13412,27 +17042,36 @@}},"foreignKeys": {- "user_connector_tools_user_connector_id_user_connectors_id_fk": {- "name": "user_connector_tools_user_connector_id_user_connectors_id_fk",- "tableFrom": "user_connector_tools",- "tableTo": "user_connectors",- "columnsFrom": ["user_connector_id"],+ "dashboard_items_dashboard_id_dashboards_id_fk": {+ "name": "dashboard_items_dashboard_id_dashboards_id_fk",+ "tableFrom": "dashboard_items",+ "tableTo": "dashboards",+ "columnsFrom": ["dashboard_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "user_connector_tools_user_id_users_id_fk": {- "name": "user_connector_tools_user_id_users_id_fk",- "tableFrom": "user_connector_tools",+ "dashboard_items_widget_id_widgets_id_fk": {+ "name": "dashboard_items_widget_id_widgets_id_fk",+ "tableFrom": "dashboard_items",+ "tableTo": "widgets",+ "columnsFrom": ["widget_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "dashboard_items_user_id_users_id_fk": {+ "name": "dashboard_items_user_id_users_id_fk",+ "tableFrom": "dashboard_items","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "user_connector_tools_workspace_id_workspaces_id_fk": {- "name": "user_connector_tools_workspace_id_workspaces_id_fk",- "tableFrom": "user_connector_tools",+ "dashboard_items_workspace_id_workspaces_id_fk": {+ "name": "dashboard_items_workspace_id_workspaces_id_fk",+ "tableFrom": "dashboard_items","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],@@ -13446,8 +17085,8 @@"checkConstraints": {},"isRLSEnabled": false},- "public.user_connectors": {- "name": "user_connectors",+ "public.dashboards": {+ "name": "dashboards","schema": "","columns": {"id": {@@ -13469,82 +17108,65 @@"primaryKey": false,"notNull": false},- "agent_id": {- "name": "agent_id",+ "project_id": {+ "name": "project_id","type": "text","primaryKey": false,"notNull": false},- "identifier": {- "name": "identifier",- "type": "varchar(255)",- "primaryKey": false,- "notNull": true- },- "name": {- "name": "name",- "type": "varchar(255)",+ "agent_id": {+ "name": "agent_id",+ "type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "source_type": {- "name": "source_type",+ "title": {+ "name": "title","type": "text","primaryKey": false,"notNull": true},- "mcp_server_url": {- "name": "mcp_server_url",+ "description": {+ "name": "description","type": "text","primaryKey": false,"notNull": false},- "mcp_connection_type": {- "name": "mcp_connection_type",+ "icon": {+ "name": "icon","type": "text","primaryKey": false,"notNull": false},- "mcp_stdio_config": {- "name": "mcp_stdio_config",- "type": "jsonb",- "primaryKey": false,- "notNull": false- },- "status": {- "name": "status",- "type": "text",- "primaryKey": false,- "notNull": true- },- "is_enabled": {- "name": "is_enabled",- "type": "boolean",+ "sort_order": {+ "name": "sort_order",+ "type": "integer","primaryKey": false,"notNull": true,- "default": true+ "default": 0},- "oidc_config": {- "name": "oidc_config",+ "metadata": {+ "name": "metadata","type": "jsonb","primaryKey": false,"notNull": false},- "credentials": {- "name": "credentials",+ "visibility": {+ "name": "visibility","type": "text","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "'public'"},- "token_expires_at": {- "name": "token_expires_at",+ "deleted_at": {+ "name": "deleted_at","type": "timestamp with time zone","primaryKey": false,"notNull": false},- "metadata": {- "name": "metadata",- "type": "jsonb",+ "is_deleted": {+ "name": "is_deleted",+ "type": "boolean","primaryKey": false,"notNull": false},@@ -13571,8 +17193,8 @@}},"indexes": {- "user_connectors_personal_identifier_idx": {- "name": "user_connectors_personal_identifier_idx",+ "dashboards_personal_idx": {+ "name": "dashboards_personal_idx","columns": [{"expression": "user_id",@@ -13581,27 +17203,21 @@"nulls": "last"},{- "expression": "identifier",+ "expression": "sort_order","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,- "where": "\"user_connectors\".\"workspace_id\" IS NULL AND \"user_connectors\".\"agent_id\" IS NULL",+ "where": "\"dashboards\".\"workspace_id\" IS NULL AND \"dashboards\".\"project_id\" IS NULL AND \"dashboards\".\"agent_id\" IS NULL AND \"dashboards\".\"is_deleted\" IS NOT TRUE","concurrently": false,"method": "btree","with": {}},- "user_connectors_workspace_identifier_idx": {- "name": "user_connectors_workspace_identifier_idx",+ "dashboards_workspace_idx": {+ "name": "dashboards_workspace_idx","columns": [- {- "expression": "user_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },{"expression": "workspace_id","isExpression": false,@@ -13609,75 +17225,67 @@"nulls": "last"},{- "expression": "identifier",+ "expression": "sort_order","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,- "where": "\"user_connectors\".\"workspace_id\" IS NOT NULL AND \"user_connectors\".\"agent_id\" IS NULL",+ "where": "\"dashboards\".\"workspace_id\" IS NOT NULL AND \"dashboards\".\"project_id\" IS NULL AND \"dashboards\".\"agent_id\" IS NULL AND \"dashboards\".\"is_deleted\" IS NOT TRUE","concurrently": false,"method": "btree","with": {}},- "user_connectors_agent_identifier_idx": {- "name": "user_connectors_agent_identifier_idx",+ "dashboards_project_idx": {+ "name": "dashboards_project_idx","columns": [{- "expression": "agent_id",+ "expression": "project_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "identifier",+ "expression": "sort_order","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,- "where": "\"user_connectors\".\"agent_id\" IS NOT NULL",+ "where": "\"dashboards\".\"project_id\" IS NOT NULL AND \"dashboards\".\"agent_id\" IS NULL AND \"dashboards\".\"is_deleted\" IS NOT TRUE","concurrently": false,"method": "btree","with": {}},- "user_connectors_user_id_idx": {- "name": "user_connectors_user_id_idx",+ "dashboards_agent_idx": {+ "name": "dashboards_agent_idx","columns": [{- "expression": "user_id",+ "expression": "agent_id","isExpression": false,"asc": true,"nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "user_connectors_token_expires_at_idx": {- "name": "user_connectors_token_expires_at_idx",- "columns": [+ },{- "expression": "token_expires_at",+ "expression": "sort_order","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,+ "where": "\"dashboards\".\"agent_id\" IS NOT NULL AND \"dashboards\".\"is_deleted\" IS NOT TRUE","concurrently": false,"method": "btree","with": {}},- "user_connectors_workspace_id_idx": {- "name": "user_connectors_workspace_id_idx",+ "dashboards_user_id_idx": {+ "name": "dashboards_user_id_idx","columns": [{- "expression": "workspace_id",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"@@ -13688,11 +17296,11 @@"method": "btree","with": {}},- "user_connectors_agent_id_idx": {- "name": "user_connectors_agent_id_idx",+ "dashboards_workspace_id_idx": {+ "name": "dashboards_workspace_id_idx","columns": [{- "expression": "agent_id",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"@@ -13705,27 +17313,36 @@}},"foreignKeys": {- "user_connectors_user_id_users_id_fk": {- "name": "user_connectors_user_id_users_id_fk",- "tableFrom": "user_connectors",+ "dashboards_user_id_users_id_fk": {+ "name": "dashboards_user_id_users_id_fk",+ "tableFrom": "dashboards","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "user_connectors_workspace_id_workspaces_id_fk": {- "name": "user_connectors_workspace_id_workspaces_id_fk",- "tableFrom": "user_connectors",+ "dashboards_workspace_id_workspaces_id_fk": {+ "name": "dashboards_workspace_id_workspaces_id_fk",+ "tableFrom": "dashboards","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "user_connectors_agent_id_agents_id_fk": {- "name": "user_connectors_agent_id_agents_id_fk",- "tableFrom": "user_connectors",+ "dashboards_project_id_projects_id_fk": {+ "name": "dashboards_project_id_projects_id_fk",+ "tableFrom": "dashboards",+ "tableTo": "projects",+ "columnsFrom": ["project_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "dashboards_agent_id_agents_id_fk": {+ "name": "dashboards_agent_id_agents_id_fk",+ "tableFrom": "dashboards","tableTo": "agents","columnsFrom": ["agent_id"],"columnsTo": ["id"],@@ -13739,10 +17356,17 @@"checkConstraints": {},"isRLSEnabled": false},- "public.user_installed_plugins": {- "name": "user_installed_plugins",+ "public.devices": {+ "name": "devices","schema": "","columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },"user_id": {"name": "user_id","type": "text",@@ -13755,42 +17379,95 @@"primaryKey": false,"notNull": false},- "identifier": {- "name": "identifier",+ "visibility": {+ "name": "visibility","type": "text","primaryKey": false,+ "notNull": true,+ "default": "'private'"+ },+ "shared_from_device_id": {+ "name": "shared_from_device_id",+ "type": "varchar(64)",+ "primaryKey": false,+ "notNull": false+ },+ "device_id": {+ "name": "device_id",+ "type": "varchar(64)",+ "primaryKey": false,"notNull": true},- "type": {- "name": "type",- "type": "text",+ "identity_source": {+ "name": "identity_source",+ "type": "varchar(20)","primaryKey": false,"notNull": true},- "manifest": {- "name": "manifest",- "type": "jsonb",+ "hostname": {+ "name": "hostname",+ "type": "text","primaryKey": false,"notNull": false},- "settings": {- "name": "settings",- "type": "jsonb",+ "platform": {+ "name": "platform",+ "type": "varchar(20)","primaryKey": false,"notNull": false},- "custom_params": {- "name": "custom_params",+ "architecture": {+ "name": "architecture",+ "type": "varchar(20)",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata","type": "jsonb","primaryKey": false,"notNull": false},- "source": {- "name": "source",- "type": "varchar(255)",+ "friendly_name": {+ "name": "friendly_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "default_cwd": {+ "name": "default_cwd",+ "type": "text","primaryKey": false,"notNull": false},+ "recent_cwds": {+ "name": "recent_cwds",+ "type": "text[]",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'"+ },+ "working_dirs": {+ "name": "working_dirs",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'[]'::jsonb"+ },+ "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",@@ -13814,11 +17491,97 @@}},"indexes": {- "user_installed_plugins_workspace_id_idx": {- "name": "user_installed_plugins_workspace_id_idx",+ "devices_user_id_device_id_unique": {+ "name": "devices_user_id_device_id_unique",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "device_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"devices\".\"workspace_id\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "devices_workspace_id_device_id_unique": {+ "name": "devices_workspace_id_device_id_unique",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "device_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"devices\".\"workspace_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "devices_user_id_idx": {+ "name": "devices_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "devices_workspace_id_idx": {+ "name": "devices_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "devices_workspace_visibility_idx": {+ "name": "devices_workspace_visibility_idx","columns": [{- "expression": "workspace_id",+ "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"@@ -13831,18 +17594,18 @@}},"foreignKeys": {- "user_installed_plugins_user_id_users_id_fk": {- "name": "user_installed_plugins_user_id_users_id_fk",- "tableFrom": "user_installed_plugins",+ "devices_user_id_users_id_fk": {+ "name": "devices_user_id_users_id_fk",+ "tableFrom": "devices","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "user_installed_plugins_workspace_id_workspaces_id_fk": {- "name": "user_installed_plugins_workspace_id_workspaces_id_fk",- "tableFrom": "user_installed_plugins",+ "devices_workspace_id_workspaces_id_fk": {+ "name": "devices_workspace_id_workspaces_id_fk",+ "tableFrom": "devices","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],@@ -13850,19 +17613,14 @@"onUpdate": "no action"}},- "compositePrimaryKeys": {- "user_installed_plugins_user_id_identifier_pk": {- "name": "user_installed_plugins_user_id_identifier_pk",- "columns": ["user_id", "identifier"]- }- },+ "compositePrimaryKeys": {},"uniqueConstraints": {},"policies": {},"checkConstraints": {},"isRLSEnabled": false},- "public.dashboard_items": {- "name": "dashboard_items",+ "public.document_comment_mentions": {+ "name": "document_comment_mentions","schema": "","columns": {"id": {@@ -13872,20 +17630,14 @@"notNull": true,"default": "gen_random_uuid()"},- "dashboard_id": {- "name": "dashboard_id",- "type": "uuid",- "primaryKey": false,- "notNull": true- },- "widget_id": {- "name": "widget_id",+ "comment_id": {+ "name": "comment_id","type": "uuid","primaryKey": false,"notNull": true},- "user_id": {- "name": "user_id",+ "mentioned_user_id": {+ "name": "mentioned_user_id","type": "text","primaryKey": false,"notNull": true@@ -13894,27 +17646,7 @@"name": "workspace_id","type": "text","primaryKey": false,- "notNull": false- },- "layout": {- "name": "layout",- "type": "jsonb",- "primaryKey": false,- "notNull": false- },- "sort_order": {- "name": "sort_order",- "type": "integer",- "primaryKey": false,- "notNull": true,- "default": 0- },- "accessed_at": {- "name": "accessed_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": true,- "default": "now()"+ "notNull": true},"created_at": {"name": "created_at",@@ -13922,27 +17654,20 @@"primaryKey": false,"notNull": true,"default": "now()"- },- "updated_at": {- "name": "updated_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": true,- "default": "now()"}},"indexes": {- "dashboard_items_dashboard_id_widget_id_unique": {- "name": "dashboard_items_dashboard_id_widget_id_unique",+ "document_comment_mentions_comment_id_mentioned_user_id_unique": {+ "name": "document_comment_mentions_comment_id_mentioned_user_id_unique","columns": [{- "expression": "dashboard_id",+ "expression": "comment_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "widget_id",+ "expression": "mentioned_user_id","isExpression": false,"asc": true,"nulls": "last"@@ -13953,47 +17678,17 @@"method": "btree","with": {}},- "dashboard_items_dashboard_id_sort_order_idx": {- "name": "dashboard_items_dashboard_id_sort_order_idx",+ "document_comment_mentions_mentioned_user_id_created_at_idx": {+ "name": "document_comment_mentions_mentioned_user_id_created_at_idx","columns": [{- "expression": "dashboard_id",+ "expression": "mentioned_user_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "sort_order",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "dashboard_items_widget_id_idx": {- "name": "dashboard_items_widget_id_idx",- "columns": [- {- "expression": "widget_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "dashboard_items_user_id_idx": {- "name": "dashboard_items_user_id_idx",- "columns": [- {- "expression": "user_id",+ "expression": "created_at","isExpression": false,"asc": true,"nulls": "last"@@ -14004,8 +17699,8 @@"method": "btree","with": {}},- "dashboard_items_workspace_id_idx": {- "name": "dashboard_items_workspace_id_idx",+ "document_comment_mentions_workspace_id_idx": {+ "name": "document_comment_mentions_workspace_id_idx","columns": [{"expression": "workspace_id",@@ -14021,36 +17716,27 @@}},"foreignKeys": {- "dashboard_items_dashboard_id_dashboards_id_fk": {- "name": "dashboard_items_dashboard_id_dashboards_id_fk",- "tableFrom": "dashboard_items",- "tableTo": "dashboards",- "columnsFrom": ["dashboard_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "dashboard_items_widget_id_widgets_id_fk": {- "name": "dashboard_items_widget_id_widgets_id_fk",- "tableFrom": "dashboard_items",- "tableTo": "widgets",- "columnsFrom": ["widget_id"],+ "document_comment_mentions_comment_id_document_comments_id_fk": {+ "name": "document_comment_mentions_comment_id_document_comments_id_fk",+ "tableFrom": "document_comment_mentions",+ "tableTo": "document_comments",+ "columnsFrom": ["comment_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "dashboard_items_user_id_users_id_fk": {- "name": "dashboard_items_user_id_users_id_fk",- "tableFrom": "dashboard_items",+ "document_comment_mentions_mentioned_user_id_users_id_fk": {+ "name": "document_comment_mentions_mentioned_user_id_users_id_fk",+ "tableFrom": "document_comment_mentions","tableTo": "users",- "columnsFrom": ["user_id"],+ "columnsFrom": ["mentioned_user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "dashboard_items_workspace_id_workspaces_id_fk": {- "name": "dashboard_items_workspace_id_workspaces_id_fk",- "tableFrom": "dashboard_items",+ "document_comment_mentions_workspace_id_workspaces_id_fk": {+ "name": "document_comment_mentions_workspace_id_workspaces_id_fk",+ "tableFrom": "document_comment_mentions","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],@@ -14064,8 +17750,8 @@"checkConstraints": {},"isRLSEnabled": false},- "public.dashboards": {- "name": "dashboards",+ "public.document_comments": {+ "name": "document_comments","schema": "","columns": {"id": {@@ -14075,67 +17761,59 @@"notNull": true,"default": "gen_random_uuid()"},- "user_id": {- "name": "user_id",+ "document_id": {+ "name": "document_id","type": "text","primaryKey": false,"notNull": true},- "workspace_id": {- "name": "workspace_id",- "type": "text",+ "parent_comment_id": {+ "name": "parent_comment_id",+ "type": "uuid","primaryKey": false,"notNull": false},- "project_id": {- "name": "project_id",- "type": "text",+ "reply_to_comment_id": {+ "name": "reply_to_comment_id",+ "type": "uuid","primaryKey": false,"notNull": false},- "agent_id": {- "name": "agent_id",+ "author_user_id": {+ "name": "author_user_id","type": "text","primaryKey": false,"notNull": false},- "title": {- "name": "title",+ "workspace_id": {+ "name": "workspace_id","type": "text","primaryKey": false,"notNull": true},- "description": {- "name": "description",+ "content": {+ "name": "content","type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "icon": {- "name": "icon",- "type": "text",+ "editor_data": {+ "name": "editor_data",+ "type": "jsonb","primaryKey": false,"notNull": false},- "sort_order": {- "name": "sort_order",- "type": "integer",- "primaryKey": false,- "notNull": true,- "default": 0- },- "metadata": {- "name": "metadata",+ "selection_anchor": {+ "name": "selection_anchor","type": "jsonb","primaryKey": false,"notNull": false},- "visibility": {- "name": "visibility",+ "client_id": {+ "name": "client_id","type": "text","primaryKey": false,- "notNull": true,- "default": "'public'"+ "notNull": true},"deleted_at": {"name": "deleted_at",@@ -14143,19 +17821,6 @@"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",@@ -14172,99 +17837,107 @@}},"indexes": {- "dashboards_personal_idx": {- "name": "dashboards_personal_idx",+ "document_comments_document_id_author_user_id_client_id_unique": {+ "name": "document_comments_document_id_author_user_id_client_id_unique","columns": [{- "expression": "user_id",+ "expression": "document_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "sort_order",+ "expression": "author_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "client_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,- "where": "\"dashboards\".\"workspace_id\" IS NULL AND \"dashboards\".\"project_id\" IS NULL AND \"dashboards\".\"agent_id\" IS NULL AND \"dashboards\".\"is_deleted\" IS NOT TRUE",+ "isUnique": true,"concurrently": false,"method": "btree","with": {}},- "dashboards_workspace_idx": {- "name": "dashboards_workspace_idx",+ "document_comments_parent_comment_id_created_at_id_idx": {+ "name": "document_comments_parent_comment_id_created_at_id_idx","columns": [{- "expression": "workspace_id",+ "expression": "parent_comment_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "sort_order",+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,- "where": "\"dashboards\".\"workspace_id\" IS NOT NULL AND \"dashboards\".\"project_id\" IS NULL AND \"dashboards\".\"agent_id\" IS NULL AND \"dashboards\".\"is_deleted\" IS NOT TRUE","concurrently": false,"method": "btree","with": {}},- "dashboards_project_idx": {- "name": "dashboards_project_idx",+ "document_comments_reply_to_comment_id_idx": {+ "name": "document_comments_reply_to_comment_id_idx","columns": [{- "expression": "project_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "sort_order",+ "expression": "reply_to_comment_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,- "where": "\"dashboards\".\"project_id\" IS NOT NULL AND \"dashboards\".\"agent_id\" IS NULL AND \"dashboards\".\"is_deleted\" IS NOT TRUE","concurrently": false,"method": "btree","with": {}},- "dashboards_agent_idx": {- "name": "dashboards_agent_idx",+ "document_comments_document_id_created_at_id_idx": {+ "name": "document_comments_document_id_created_at_id_idx","columns": [{- "expression": "agent_id",+ "expression": "document_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "sort_order",+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,- "where": "\"dashboards\".\"agent_id\" IS NOT NULL AND \"dashboards\".\"is_deleted\" IS NOT TRUE","concurrently": false,"method": "btree","with": {}},- "dashboards_user_id_idx": {- "name": "dashboards_user_id_idx",+ "document_comments_author_user_id_idx": {+ "name": "document_comments_author_user_id_idx","columns": [{- "expression": "user_id",+ "expression": "author_user_id","isExpression": false,"asc": true,"nulls": "last"@@ -14275,8 +17948,8 @@"method": "btree","with": {}},- "dashboards_workspace_id_idx": {- "name": "dashboards_workspace_id_idx",+ "document_comments_workspace_id_idx": {+ "name": "document_comments_workspace_id_idx","columns": [{"expression": "workspace_id",@@ -14292,38 +17965,47 @@}},"foreignKeys": {- "dashboards_user_id_users_id_fk": {- "name": "dashboards_user_id_users_id_fk",- "tableFrom": "dashboards",- "tableTo": "users",- "columnsFrom": ["user_id"],+ "document_comments_document_id_documents_id_fk": {+ "name": "document_comments_document_id_documents_id_fk",+ "tableFrom": "document_comments",+ "tableTo": "documents",+ "columnsFrom": ["document_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "dashboards_workspace_id_workspaces_id_fk": {- "name": "dashboards_workspace_id_workspaces_id_fk",- "tableFrom": "dashboards",- "tableTo": "workspaces",- "columnsFrom": ["workspace_id"],+ "document_comments_parent_comment_id_document_comments_id_fk": {+ "name": "document_comments_parent_comment_id_document_comments_id_fk",+ "tableFrom": "document_comments",+ "tableTo": "document_comments",+ "columnsFrom": ["parent_comment_id"],"columnsTo": ["id"],- "onDelete": "cascade",+ "onDelete": "no action","onUpdate": "no action"},- "dashboards_project_id_projects_id_fk": {- "name": "dashboards_project_id_projects_id_fk",- "tableFrom": "dashboards",- "tableTo": "projects",- "columnsFrom": ["project_id"],+ "document_comments_reply_to_comment_id_document_comments_id_fk": {+ "name": "document_comments_reply_to_comment_id_document_comments_id_fk",+ "tableFrom": "document_comments",+ "tableTo": "document_comments",+ "columnsFrom": ["reply_to_comment_id"],"columnsTo": ["id"],- "onDelete": "cascade",+ "onDelete": "set null","onUpdate": "no action"},- "dashboards_agent_id_agents_id_fk": {- "name": "dashboards_agent_id_agents_id_fk",- "tableFrom": "dashboards",- "tableTo": "agents",- "columnsFrom": ["agent_id"],+ "document_comments_author_user_id_users_id_fk": {+ "name": "document_comments_author_user_id_users_id_fk",+ "tableFrom": "document_comments",+ "tableTo": "users",+ "columnsFrom": ["author_user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "document_comments_workspace_id_workspaces_id_fk": {+ "name": "document_comments_workspace_id_workspaces_id_fk",+ "tableFrom": "document_comments",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"@@ -14332,19 +18014,29 @@"compositePrimaryKeys": {},"uniqueConstraints": {},"policies": {},- "checkConstraints": {},+ "checkConstraints": {+ "document_comments_reply_has_no_anchor": {+ "name": "document_comments_reply_has_no_anchor",+ "value": "\"document_comments\".\"parent_comment_id\" IS NULL OR \"document_comments\".\"selection_anchor\" IS NULL"+ }+ },"isRLSEnabled": false},- "public.devices": {- "name": "devices",+ "public.document_histories": {+ "name": "document_histories","schema": "","columns": {"id": {"name": "id",- "type": "uuid",+ "type": "varchar(255)","primaryKey": true,- "notNull": true,- "default": "gen_random_uuid()"+ "notNull": true+ },+ "document_id": {+ "name": "document_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true},"user_id": {"name": "user_id",@@ -14358,164 +18050,61 @@"primaryKey": false,"notNull": false},- "visibility": {- "name": "visibility",- "type": "text",- "primaryKey": false,- "notNull": true,- "default": "'private'"- },- "shared_from_device_id": {- "name": "shared_from_device_id",- "type": "varchar(64)",- "primaryKey": false,- "notNull": false- },- "device_id": {- "name": "device_id",- "type": "varchar(64)",- "primaryKey": false,- "notNull": true- },- "identity_source": {- "name": "identity_source",- "type": "varchar(20)",+ "editor_data": {+ "name": "editor_data",+ "type": "jsonb","primaryKey": false,"notNull": true},- "hostname": {- "name": "hostname",+ "save_source": {+ "name": "save_source","type": "text","primaryKey": false,- "notNull": false- },- "platform": {- "name": "platform",- "type": "varchar(20)",- "primaryKey": false,- "notNull": false- },- "architecture": {- "name": "architecture",- "type": "varchar(20)",- "primaryKey": false,- "notNull": false+ "notNull": true},- "metadata": {- "name": "metadata",- "type": "jsonb",+ "editor_ids": {+ "name": "editor_ids",+ "type": "text[]","primaryKey": false,"notNull": false},- "friendly_name": {- "name": "friendly_name",+ "operation_id": {+ "name": "operation_id","type": "text","primaryKey": false,"notNull": false},- "default_cwd": {- "name": "default_cwd",+ "agent_id": {+ "name": "agent_id","type": "text","primaryKey": false,"notNull": false},- "recent_cwds": {- "name": "recent_cwds",- "type": "text[]",- "primaryKey": false,- "notNull": true,- "default": "'{}'"- },- "working_dirs": {- "name": "working_dirs",- "type": "jsonb",- "primaryKey": false,- "notNull": false,- "default": "'[]'::jsonb"- },- "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",+ "saved_at": {+ "name": "saved_at","type": "timestamp with time zone","primaryKey": false,- "notNull": true,- "default": "now()"+ "notNull": true}},"indexes": {- "devices_user_id_device_id_unique": {- "name": "devices_user_id_device_id_unique",- "columns": [- {- "expression": "user_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "device_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": true,- "where": "\"devices\".\"workspace_id\" IS NULL",- "concurrently": false,- "method": "btree",- "with": {}- },- "devices_workspace_id_device_id_unique": {- "name": "devices_workspace_id_device_id_unique",- "columns": [- {- "expression": "workspace_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },+ "document_histories_document_id_idx": {+ "name": "document_histories_document_id_idx",+ "columns": [{- "expression": "device_id",+ "expression": "document_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,- "where": "\"devices\".\"workspace_id\" IS NOT NULL",+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "devices_user_id_idx": {- "name": "devices_user_id_idx",+ "document_histories_user_id_idx": {+ "name": "document_histories_user_id_idx","columns": [{"expression": "user_id",@@ -14529,8 +18118,8 @@"method": "btree","with": {}},- "devices_workspace_id_idx": {- "name": "devices_workspace_id_idx",+ "document_histories_workspace_id_idx": {+ "name": "document_histories_workspace_id_idx","columns": [{"expression": "workspace_id",@@ -14544,23 +18133,11 @@"method": "btree","with": {}},- "devices_workspace_visibility_idx": {- "name": "devices_workspace_visibility_idx",+ "document_histories_saved_at_idx": {+ "name": "document_histories_saved_at_idx","columns": [{- "expression": "workspace_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "visibility",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "user_id",+ "expression": "saved_at","isExpression": false,"asc": true,"nulls": "last"@@ -14573,18 +18150,27 @@}},"foreignKeys": {- "devices_user_id_users_id_fk": {- "name": "devices_user_id_users_id_fk",- "tableFrom": "devices",+ "document_histories_document_id_documents_id_fk": {+ "name": "document_histories_document_id_documents_id_fk",+ "tableFrom": "document_histories",+ "tableTo": "documents",+ "columnsFrom": ["document_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "document_histories_user_id_users_id_fk": {+ "name": "document_histories_user_id_users_id_fk",+ "tableFrom": "document_histories","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "devices_workspace_id_workspaces_id_fk": {- "name": "devices_workspace_id_workspaces_id_fk",- "tableFrom": "devices",+ "document_histories_workspace_id_workspaces_id_fk": {+ "name": "document_histories_workspace_id_workspaces_id_fk",+ "tableFrom": "document_histories","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],@@ -14598,8 +18184,8 @@"checkConstraints": {},"isRLSEnabled": false},- "public.document_comment_mentions": {- "name": "document_comment_mentions",+ "public.document_likes": {+ "name": "document_likes","schema": "","columns": {"id": {@@ -14609,14 +18195,14 @@"notNull": true,"default": "gen_random_uuid()"},- "comment_id": {- "name": "comment_id",- "type": "uuid",+ "document_id": {+ "name": "document_id",+ "type": "text","primaryKey": false,"notNull": true},- "mentioned_user_id": {- "name": "mentioned_user_id",+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,"notNull": true@@ -14636,17 +18222,17 @@}},"indexes": {- "document_comment_mentions_comment_id_mentioned_user_id_unique": {- "name": "document_comment_mentions_comment_id_mentioned_user_id_unique",+ "document_likes_document_id_user_id_unique": {+ "name": "document_likes_document_id_user_id_unique","columns": [{- "expression": "comment_id",+ "expression": "document_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "mentioned_user_id",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"@@ -14657,11 +18243,11 @@"method": "btree","with": {}},- "document_comment_mentions_mentioned_user_id_created_at_idx": {- "name": "document_comment_mentions_mentioned_user_id_created_at_idx",+ "document_likes_document_id_created_at_idx": {+ "name": "document_likes_document_id_created_at_idx","columns": [{- "expression": "mentioned_user_id",+ "expression": "document_id","isExpression": false,"asc": true,"nulls": "last"@@ -14678,8 +18264,23 @@"method": "btree","with": {}},- "document_comment_mentions_workspace_id_idx": {- "name": "document_comment_mentions_workspace_id_idx",+ "document_likes_user_id_idx": {+ "name": "document_likes_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "document_likes_workspace_id_idx": {+ "name": "document_likes_workspace_id_idx","columns": [{"expression": "workspace_id",@@ -14695,27 +18296,27 @@}},"foreignKeys": {- "document_comment_mentions_comment_id_document_comments_id_fk": {- "name": "document_comment_mentions_comment_id_document_comments_id_fk",- "tableFrom": "document_comment_mentions",- "tableTo": "document_comments",- "columnsFrom": ["comment_id"],+ "document_likes_document_id_documents_id_fk": {+ "name": "document_likes_document_id_documents_id_fk",+ "tableFrom": "document_likes",+ "tableTo": "documents",+ "columnsFrom": ["document_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "document_comment_mentions_mentioned_user_id_users_id_fk": {- "name": "document_comment_mentions_mentioned_user_id_users_id_fk",- "tableFrom": "document_comment_mentions",+ "document_likes_user_id_users_id_fk": {+ "name": "document_likes_user_id_users_id_fk",+ "tableFrom": "document_likes","tableTo": "users",- "columnsFrom": ["mentioned_user_id"],+ "columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "document_comment_mentions_workspace_id_workspaces_id_fk": {- "name": "document_comment_mentions_workspace_id_workspaces_id_fk",- "tableFrom": "document_comment_mentions",+ "document_likes_workspace_id_workspaces_id_fk": {+ "name": "document_likes_workspace_id_workspaces_id_fk",+ "tableFrom": "document_likes","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],@@ -14729,8 +18330,8 @@"checkConstraints": {},"isRLSEnabled": false},- "public.document_comments": {- "name": "document_comments",+ "public.document_shares": {+ "name": "document_shares","schema": "","columns": {"id": {@@ -14742,63 +18343,49 @@},"document_id": {"name": "document_id",- "type": "text",+ "type": "varchar(255)","primaryKey": false,"notNull": true},- "parent_comment_id": {- "name": "parent_comment_id",- "type": "uuid",- "primaryKey": false,- "notNull": false- },- "reply_to_comment_id": {- "name": "reply_to_comment_id",- "type": "uuid",- "primaryKey": false,- "notNull": false- },- "author_user_id": {- "name": "author_user_id",+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,- "notNull": false+ "notNull": true},"workspace_id": {"name": "workspace_id","type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "content": {- "name": "content",+ "visibility": {+ "name": "visibility","type": "text","primaryKey": false,- "notNull": true- },- "editor_data": {- "name": "editor_data",- "type": "jsonb",- "primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "'private'"},- "selection_anchor": {- "name": "selection_anchor",- "type": "jsonb",+ "permission": {+ "name": "permission",+ "type": "text","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "'read'"},- "client_id": {- "name": "client_id",- "type": "text",+ "page_view_count": {+ "name": "page_view_count",+ "type": "integer","primaryKey": false,- "notNull": true+ "notNull": true,+ "default": 0},- "deleted_at": {- "name": "deleted_at",+ "accessed_at": {+ "name": "accessed_at","type": "timestamp with time zone","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "now()"},"created_at": {"name": "created_at",@@ -14816,26 +18403,14 @@}},"indexes": {- "document_comments_document_id_author_user_id_client_id_unique": {- "name": "document_comments_document_id_author_user_id_client_id_unique",+ "document_shares_document_id_unique": {+ "name": "document_shares_document_id_unique","columns": [{"expression": "document_id","isExpression": false,"asc": true,"nulls": "last"- },- {- "expression": "author_user_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "client_id",- "isExpression": false,- "asc": true,- "nulls": "last"}],"isUnique": true,@@ -14843,23 +18418,155 @@"method": "btree","with": {}},- "document_comments_parent_comment_id_created_at_id_idx": {- "name": "document_comments_parent_comment_id_created_at_id_idx",+ "document_shares_user_id_idx": {+ "name": "document_shares_user_id_idx","columns": [{- "expression": "parent_comment_id",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "document_shares_workspace_id_idx": {+ "name": "document_shares_workspace_id_idx",+ "columns": [{- "expression": "created_at",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "document_shares_document_id_documents_id_fk": {+ "name": "document_shares_document_id_documents_id_fk",+ "tableFrom": "document_shares",+ "tableTo": "documents",+ "columnsFrom": ["document_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "document_shares_user_id_users_id_fk": {+ "name": "document_shares_user_id_users_id_fk",+ "tableFrom": "document_shares",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "document_shares_workspace_id_workspaces_id_fk": {+ "name": "document_shares_workspace_id_workspaces_id_fk",+ "tableFrom": "document_shares",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.environments": {+ "name": "environments",+ "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+ },+ "name": {+ "name": "name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'private'"+ },+ "configuration": {+ "name": "configuration",+ "type": "jsonb",+ "primaryKey": 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": {+ "environments_user_id_idx": {+ "name": "environments_user_id_idx",+ "columns": [{- "expression": "id",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"@@ -14870,11 +18577,11 @@"method": "btree","with": {}},- "document_comments_reply_to_comment_id_idx": {- "name": "document_comments_reply_to_comment_id_idx",+ "environments_workspace_id_idx": {+ "name": "environments_workspace_id_idx","columns": [{- "expression": "reply_to_comment_id",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"@@ -14885,23 +18592,23 @@"method": "btree","with": {}},- "document_comments_document_id_created_at_id_idx": {- "name": "document_comments_document_id_created_at_id_idx",+ "environments_workspace_visibility_idx": {+ "name": "environments_workspace_visibility_idx","columns": [{- "expression": "document_id",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "created_at",+ "expression": "visibility","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "id",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"@@ -14912,81 +18619,74 @@"method": "btree","with": {}},- "document_comments_author_user_id_idx": {- "name": "document_comments_author_user_id_idx",+ "environments_user_name_unique": {+ "name": "environments_user_name_unique","columns": [{- "expression": "author_user_id",+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "name","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,+ "where": "\"environments\".\"workspace_id\" is null","concurrently": false,"method": "btree","with": {}},- "document_comments_workspace_id_idx": {- "name": "document_comments_workspace_id_idx",+ "environments_workspace_user_name_unique": {+ "name": "environments_workspace_user_name_unique","columns": [{"expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "name",+ "isExpression": false,+ "asc": true,+ "nulls": "last"}],- "isUnique": false,+ "isUnique": true,+ "where": "\"environments\".\"workspace_id\" is not null","concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "document_comments_document_id_documents_id_fk": {- "name": "document_comments_document_id_documents_id_fk",- "tableFrom": "document_comments",- "tableTo": "documents",- "columnsFrom": ["document_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "document_comments_parent_comment_id_document_comments_id_fk": {- "name": "document_comments_parent_comment_id_document_comments_id_fk",- "tableFrom": "document_comments",- "tableTo": "document_comments",- "columnsFrom": ["parent_comment_id"],- "columnsTo": ["id"],- "onDelete": "no action",- "onUpdate": "no action"- },- "document_comments_reply_to_comment_id_document_comments_id_fk": {- "name": "document_comments_reply_to_comment_id_document_comments_id_fk",- "tableFrom": "document_comments",- "tableTo": "document_comments",- "columnsFrom": ["reply_to_comment_id"],- "columnsTo": ["id"],- "onDelete": "set null",- "onUpdate": "no action"- },- "document_comments_author_user_id_users_id_fk": {- "name": "document_comments_author_user_id_users_id_fk",- "tableFrom": "document_comments",+ "environments_user_id_users_id_fk": {+ "name": "environments_user_id_users_id_fk",+ "tableFrom": "environments","tableTo": "users",- "columnsFrom": ["author_user_id"],+ "columnsFrom": ["user_id"],"columnsTo": ["id"],- "onDelete": "set null",+ "onDelete": "restrict","onUpdate": "no action"},- "document_comments_workspace_id_workspaces_id_fk": {- "name": "document_comments_workspace_id_workspaces_id_fk",- "tableFrom": "document_comments",+ "environments_workspace_id_workspaces_id_fk": {+ "name": "environments_workspace_id_workspaces_id_fk",+ "tableFrom": "environments","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],- "onDelete": "cascade",+ "onDelete": "restrict","onUpdate": "no action"}},@@ -14994,129 +18694,225 @@"uniqueConstraints": {},"policies": {},"checkConstraints": {- "document_comments_reply_has_no_anchor": {- "name": "document_comments_reply_has_no_anchor",- "value": "\"document_comments\".\"parent_comment_id\" IS NULL OR \"document_comments\".\"selection_anchor\" IS NULL"+ "environments_name_not_empty": {+ "name": "environments_name_not_empty",+ "value": "length(btrim(\"environments\".\"name\")) > 0"+ },+ "environments_configuration_object": {+ "name": "environments_configuration_object",+ "value": "jsonb_typeof(\"environments\".\"configuration\") = 'object'"}},"isRLSEnabled": false},- "public.document_histories": {- "name": "document_histories",+ "public.environment_instances": {+ "name": "environment_instances","schema": "","columns": {"id": {"name": "id",- "type": "varchar(255)",+ "type": "uuid","primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "environment_id": {+ "name": "environment_id",+ "type": "uuid",+ "primaryKey": false,"notNull": true},- "document_id": {- "name": "document_id",+ "name": {+ "name": "name","type": "varchar(255)","primaryKey": false,"notNull": true},- "user_id": {- "name": "user_id",+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "device_id": {+ "name": "device_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "provider_scope": {+ "name": "provider_scope",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "provider_resource_id": {+ "name": "provider_resource_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "working_directory": {+ "name": "working_directory","type": "text","primaryKey": false,"notNull": true},- "workspace_id": {- "name": "workspace_id",- "type": "text",+ "configuration_snapshot": {+ "name": "configuration_snapshot",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "configuration": {+ "name": "configuration",+ "type": "jsonb","primaryKey": false,"notNull": false},- "editor_data": {- "name": "editor_data",- "type": "jsonb",+ "enabled": {+ "name": "enabled",+ "type": "boolean","primaryKey": false,- "notNull": true+ "notNull": true,+ "default": true},- "save_source": {- "name": "save_source",+ "status": {+ "name": "status","type": "text","primaryKey": false,- "notNull": true+ "notNull": true,+ "default": "'pending'"},- "editor_ids": {- "name": "editor_ids",- "type": "text[]",+ "build_id": {+ "name": "build_id",+ "type": "text","primaryKey": false,"notNull": false},- "operation_id": {- "name": "operation_id",+ "build_error": {+ "name": "build_error","type": "text","primaryKey": false,"notNull": false},- "agent_id": {- "name": "agent_id",- "type": "text",+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "now()"},- "saved_at": {- "name": "saved_at",+ "created_at": {+ "name": "created_at","type": "timestamp with time zone","primaryKey": false,- "notNull": true+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"}},"indexes": {- "document_histories_document_id_idx": {- "name": "document_histories_document_id_idx",+ "environment_instances_environment_id_id_unique": {+ "name": "environment_instances_environment_id_id_unique","columns": [{- "expression": "document_id",+ "expression": "environment_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,"concurrently": false,"method": "btree","with": {}},- "document_histories_user_id_idx": {- "name": "document_histories_user_id_idx",+ "environment_instances_device_path_unique": {+ "name": "environment_instances_device_path_unique","columns": [{- "expression": "user_id",+ "expression": "device_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "working_directory","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,+ "where": "\"environment_instances\".\"device_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}},- "document_histories_workspace_id_idx": {- "name": "document_histories_workspace_id_idx",+ "environment_instances_provider_path_unique": {+ "name": "environment_instances_provider_path_unique","columns": [{- "expression": "workspace_id",+ "expression": "kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "provider",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "provider_scope",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "provider_resource_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "working_directory","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,+ "where": "\"environment_instances\".\"device_id\" IS NULL","concurrently": false,"method": "btree","with": {}},- "document_histories_saved_at_idx": {- "name": "document_histories_saved_at_idx",+ "environment_instances_environment_id_idx": {+ "name": "environment_instances_environment_id_idx","columns": [{- "expression": "saved_at",+ "expression": "environment_id","isExpression": false,"asc": true,"nulls": "last"@@ -15129,42 +18925,54 @@}},"foreignKeys": {- "document_histories_document_id_documents_id_fk": {- "name": "document_histories_document_id_documents_id_fk",- "tableFrom": "document_histories",- "tableTo": "documents",- "columnsFrom": ["document_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "document_histories_user_id_users_id_fk": {- "name": "document_histories_user_id_users_id_fk",- "tableFrom": "document_histories",- "tableTo": "users",- "columnsFrom": ["user_id"],+ "environment_instances_environment_id_environments_id_fk": {+ "name": "environment_instances_environment_id_environments_id_fk",+ "tableFrom": "environment_instances",+ "tableTo": "environments",+ "columnsFrom": ["environment_id"],"columnsTo": ["id"],- "onDelete": "cascade",+ "onDelete": "restrict","onUpdate": "no action"},- "document_histories_workspace_id_workspaces_id_fk": {- "name": "document_histories_workspace_id_workspaces_id_fk",- "tableFrom": "document_histories",- "tableTo": "workspaces",- "columnsFrom": ["workspace_id"],+ "environment_instances_device_id_devices_id_fk": {+ "name": "environment_instances_device_id_devices_id_fk",+ "tableFrom": "environment_instances",+ "tableTo": "devices",+ "columnsFrom": ["device_id"],"columnsTo": ["id"],- "onDelete": "cascade",+ "onDelete": "restrict","onUpdate": "no action"}},"compositePrimaryKeys": {},"uniqueConstraints": {},"policies": {},- "checkConstraints": {},+ "checkConstraints": {+ "environment_instances_name_not_empty": {+ "name": "environment_instances_name_not_empty",+ "value": "length(btrim(\"environment_instances\".\"name\")) > 0"+ },+ "environment_instances_directory_not_empty": {+ "name": "environment_instances_directory_not_empty",+ "value": "length(btrim(\"environment_instances\".\"working_directory\")) > 0"+ },+ "environment_instances_snapshot_object": {+ "name": "environment_instances_snapshot_object",+ "value": "jsonb_typeof(\"environment_instances\".\"configuration_snapshot\") = 'object'"+ },+ "environment_instances_configuration_object": {+ "name": "environment_instances_configuration_object",+ "value": "\"environment_instances\".\"configuration\" IS NULL OR jsonb_typeof(\"environment_instances\".\"configuration\") = 'object'"+ },+ "environment_instances_binding": {+ "name": "environment_instances_binding",+ "value": "(\n \"environment_instances\".\"kind\" = 'device' AND \"environment_instances\".\"device_id\" IS NOT NULL AND \"environment_instances\".\"provider\" IS NULL AND \"environment_instances\".\"provider_scope\" IS NULL AND \"environment_instances\".\"provider_resource_id\" IS NULL\n ) OR (\n \"environment_instances\".\"kind\" <> 'device' AND \"environment_instances\".\"device_id\" IS NULL AND\n \"environment_instances\".\"provider\" IS NOT NULL AND length(btrim(\"environment_instances\".\"provider\")) > 0 AND\n \"environment_instances\".\"provider_scope\" IS NOT NULL AND length(btrim(\"environment_instances\".\"provider_scope\")) > 0 AND\n \"environment_instances\".\"provider_resource_id\" IS NOT NULL AND length(btrim(\"environment_instances\".\"provider_resource_id\")) > 0\n )"+ }+ },"isRLSEnabled": false},- "public.document_likes": {- "name": "document_likes",+ "public.expertise_bindings": {+ "name": "expertise_bindings","schema": "","columns": {"id": {@@ -15174,23 +18982,75 @@"notNull": true,"default": "gen_random_uuid()"},- "document_id": {- "name": "document_id",- "type": "text",+ "domain_id": {+ "name": "domain_id",+ "type": "varchar(255)","primaryKey": false,"notNull": true},- "user_id": {- "name": "user_id",+ "agent_id": {+ "name": "agent_id","type": "text","primaryKey": false,- "notNull": true+ "notNull": false+ },+ "project_id": {+ "name": "project_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "bound_workspace_id": {+ "name": "bound_workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "bound_user_id": {+ "name": "bound_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "contribution_mode": {+ "name": "contribution_mode",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'derive'"+ },+ "added_by_user_id": {+ "name": "added_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false},"workspace_id": {"name": "workspace_id","type": "text","primaryKey": false,- "notNull": true+ "notNull": false+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "sort_order": {+ "name": "sort_order",+ "type": "integer",+ "primaryKey": 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",@@ -15198,56 +19058,109 @@"primaryKey": false,"notNull": true,"default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"}},"indexes": {- "document_likes_document_id_user_id_unique": {- "name": "document_likes_document_id_user_id_unique",+ "expertise_bindings_agent_domain_unique": {+ "name": "expertise_bindings_agent_domain_unique","columns": [{- "expression": "document_id",+ "expression": "agent_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "user_id",+ "expression": "domain_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": true,+ "where": "\"expertise_bindings\".\"agent_id\" is not null","concurrently": false,"method": "btree","with": {}},- "document_likes_document_id_created_at_idx": {- "name": "document_likes_document_id_created_at_idx",+ "expertise_bindings_project_domain_unique": {+ "name": "expertise_bindings_project_domain_unique","columns": [{- "expression": "document_id",+ "expression": "project_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "created_at",+ "expression": "domain_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,+ "where": "\"expertise_bindings\".\"project_id\" is not null","concurrently": false,"method": "btree","with": {}},- "document_likes_user_id_idx": {- "name": "document_likes_user_id_idx",+ "expertise_bindings_workspace_domain_unique": {+ "name": "expertise_bindings_workspace_domain_unique","columns": [{- "expression": "user_id",+ "expression": "bound_workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "domain_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"expertise_bindings\".\"bound_workspace_id\" is not null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "expertise_bindings_user_domain_unique": {+ "name": "expertise_bindings_user_domain_unique",+ "columns": [+ {+ "expression": "bound_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "domain_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"expertise_bindings\".\"bound_user_id\" is not null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "expertise_bindings_domain_idx": {+ "name": "expertise_bindings_domain_idx",+ "columns": [+ {+ "expression": "domain_id","isExpression": false,"asc": true,"nulls": "last"@@ -15258,8 +19171,8 @@"method": "btree","with": {}},- "document_likes_workspace_id_idx": {- "name": "document_likes_workspace_id_idx",+ "expertise_bindings_workspace_id_idx": {+ "name": "expertise_bindings_workspace_id_idx","columns": [{"expression": "workspace_id",@@ -15275,27 +19188,63 @@}},"foreignKeys": {- "document_likes_document_id_documents_id_fk": {- "name": "document_likes_document_id_documents_id_fk",- "tableFrom": "document_likes",- "tableTo": "documents",- "columnsFrom": ["document_id"],+ "expertise_bindings_domain_id_expertise_domains_id_fk": {+ "name": "expertise_bindings_domain_id_expertise_domains_id_fk",+ "tableFrom": "expertise_bindings",+ "tableTo": "expertise_domains",+ "columnsFrom": ["domain_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "document_likes_user_id_users_id_fk": {- "name": "document_likes_user_id_users_id_fk",- "tableFrom": "document_likes",+ "expertise_bindings_agent_id_agents_id_fk": {+ "name": "expertise_bindings_agent_id_agents_id_fk",+ "tableFrom": "expertise_bindings",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "expertise_bindings_project_id_projects_id_fk": {+ "name": "expertise_bindings_project_id_projects_id_fk",+ "tableFrom": "expertise_bindings",+ "tableTo": "projects",+ "columnsFrom": ["project_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "expertise_bindings_bound_workspace_id_workspaces_id_fk": {+ "name": "expertise_bindings_bound_workspace_id_workspaces_id_fk",+ "tableFrom": "expertise_bindings",+ "tableTo": "workspaces",+ "columnsFrom": ["bound_workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "expertise_bindings_bound_user_id_users_id_fk": {+ "name": "expertise_bindings_bound_user_id_users_id_fk",+ "tableFrom": "expertise_bindings","tableTo": "users",- "columnsFrom": ["user_id"],+ "columnsFrom": ["bound_user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "document_likes_workspace_id_workspaces_id_fk": {- "name": "document_likes_workspace_id_workspaces_id_fk",- "tableFrom": "document_likes",+ "expertise_bindings_added_by_user_id_users_id_fk": {+ "name": "expertise_bindings_added_by_user_id_users_id_fk",+ "tableFrom": "expertise_bindings",+ "tableTo": "users",+ "columnsFrom": ["added_by_user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "expertise_bindings_workspace_id_workspaces_id_fk": {+ "name": "expertise_bindings_workspace_id_workspaces_id_fk",+ "tableFrom": "expertise_bindings","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],@@ -15306,11 +19255,16 @@"compositePrimaryKeys": {},"uniqueConstraints": {},"policies": {},- "checkConstraints": {},+ "checkConstraints": {+ "expertise_bindings_exactly_one_carrier": {+ "name": "expertise_bindings_exactly_one_carrier",+ "value": "(\"expertise_bindings\".\"agent_id\" IS NOT NULL)::int + (\"expertise_bindings\".\"project_id\" IS NOT NULL)::int + (\"expertise_bindings\".\"bound_workspace_id\" IS NOT NULL)::int + (\"expertise_bindings\".\"bound_user_id\" IS NOT NULL)::int = 1"+ }+ },"isRLSEnabled": false},- "public.document_shares": {- "name": "document_shares",+ "public.expertise_domain_snapshots": {+ "name": "expertise_domain_snapshots","schema": "","columns": {"id": {@@ -15320,61 +19274,138 @@"notNull": true,"default": "gen_random_uuid()"},- "document_id": {- "name": "document_id",+ "domain_id": {+ "name": "domain_id","type": "varchar(255)","primaryKey": false,"notNull": true},- "user_id": {- "name": "user_id",- "type": "text",+ "run_id": {+ "name": "run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "run_index": {+ "name": "run_index",+ "type": "integer","primaryKey": false,"notNull": true},- "workspace_id": {- "name": "workspace_id",- "type": "text",+ "learned_total": {+ "name": "learned_total",+ "type": "integer","primaryKey": false,- "notNull": false+ "notNull": true},- "visibility": {- "name": "visibility",- "type": "text",+ "retired_total": {+ "name": "retired_total",+ "type": "integer","primaryKey": false,"notNull": true,- "default": "'private'"+ "default": 0},- "permission": {- "name": "permission",+ "active_count": {+ "name": "active_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "compiled_count": {+ "name": "compiled_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "layer_counts": {+ "name": "layer_counts",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "p_inf": {+ "name": "p_inf",+ "type": "numeric",+ "primaryKey": false,+ "notNull": false+ },+ "tau": {+ "name": "tau",+ "type": "numeric",+ "primaryKey": false,+ "notNull": false+ },+ "maturity": {+ "name": "maturity",+ "type": "numeric",+ "primaryKey": false,+ "notNull": false+ },+ "fit_sample_size": {+ "name": "fit_sample_size",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "fit_r2": {+ "name": "fit_r2",+ "type": "numeric",+ "primaryKey": false,+ "notNull": false+ },+ "fit_confidence": {+ "name": "fit_confidence","type": "text","primaryKey": false,+ "notNull": false+ },+ "fit_computed_at": {+ "name": "fit_computed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "tau_pinned": {+ "name": "tau_pinned",+ "type": "boolean",+ "primaryKey": false,"notNull": true,- "default": "'read'"+ "default": false+ },+ "observed_span": {+ "name": "observed_span",+ "type": "numeric",+ "primaryKey": false,+ "notNull": false+ },+ "plateau_kind": {+ "name": "plateau_kind",+ "type": "text",+ "primaryKey": false,+ "notNull": false},- "page_view_count": {- "name": "page_view_count",- "type": "integer",+ "layer_coverage": {+ "name": "layer_coverage",+ "type": "numeric","primaryKey": false,- "notNull": true,- "default": 0+ "notNull": false},- "accessed_at": {- "name": "accessed_at",- "type": "timestamp with time zone",+ "canon_coverage": {+ "name": "canon_coverage",+ "type": "numeric","primaryKey": false,- "notNull": true,- "default": "now()"+ "notNull": false},- "created_at": {- "name": "created_at",- "type": "timestamp with time zone",+ "active_rate": {+ "name": "active_rate",+ "type": "numeric","primaryKey": false,- "notNull": true,- "default": "now()"+ "notNull": false},- "updated_at": {- "name": "updated_at",+ "captured_at": {+ "name": "captured_at","type": "timestamp with time zone","primaryKey": false,"notNull": true,@@ -15382,11 +19413,17 @@}},"indexes": {- "document_shares_document_id_unique": {- "name": "document_shares_document_id_unique",+ "expertise_domain_snapshots_domain_run_index_unique": {+ "name": "expertise_domain_snapshots_domain_run_index_unique","columns": [{- "expression": "document_id",+ "expression": "domain_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "run_index","isExpression": false,"asc": true,"nulls": "last"@@ -15397,11 +19434,17 @@"method": "btree","with": {}},- "document_shares_user_id_idx": {- "name": "document_shares_user_id_idx",+ "expertise_domain_snapshots_domain_captured_idx": {+ "name": "expertise_domain_snapshots_domain_captured_idx","columns": [{- "expression": "user_id",+ "expression": "domain_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "captured_at","isExpression": false,"asc": true,"nulls": "last"@@ -15412,48 +19455,49 @@"method": "btree","with": {}},- "document_shares_workspace_id_idx": {- "name": "document_shares_workspace_id_idx",+ "expertise_domain_snapshots_pending_fit_idx": {+ "name": "expertise_domain_snapshots_pending_fit_idx","columns": [{- "expression": "workspace_id",+ "expression": "domain_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,+ "where": "\"expertise_domain_snapshots\".\"fit_computed_at\" is null","concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "document_shares_document_id_documents_id_fk": {- "name": "document_shares_document_id_documents_id_fk",- "tableFrom": "document_shares",- "tableTo": "documents",- "columnsFrom": ["document_id"],+ "expertise_domain_snapshots_domain_id_expertise_domains_id_fk": {+ "name": "expertise_domain_snapshots_domain_id_expertise_domains_id_fk",+ "tableFrom": "expertise_domain_snapshots",+ "tableTo": "expertise_domains",+ "columnsFrom": ["domain_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "document_shares_user_id_users_id_fk": {- "name": "document_shares_user_id_users_id_fk",- "tableFrom": "document_shares",- "tableTo": "users",- "columnsFrom": ["user_id"],+ "expertise_domain_snapshots_run_id_expertise_runs_id_fk": {+ "name": "expertise_domain_snapshots_run_id_expertise_runs_id_fk",+ "tableFrom": "expertise_domain_snapshots",+ "tableTo": "expertise_runs",+ "columnsFrom": ["run_id"],"columnsTo": ["id"],- "onDelete": "cascade",+ "onDelete": "set null","onUpdate": "no action"},- "document_shares_workspace_id_workspaces_id_fk": {- "name": "document_shares_workspace_id_workspaces_id_fk",- "tableFrom": "document_shares",- "tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],- "onDelete": "cascade",+ "expertise_domain_snapshots_run_domain_fk": {+ "name": "expertise_domain_snapshots_run_domain_fk",+ "tableFrom": "expertise_domain_snapshots",+ "tableTo": "expertise_runs",+ "columnsFrom": ["run_id", "domain_id"],+ "columnsTo": ["id", "domain_id"],+ "onDelete": "no action","onUpdate": "no action"}},@@ -15463,16 +19507,33 @@"checkConstraints": {},"isRLSEnabled": false},- "public.environments": {- "name": "environments",+ "public.expertise_domains": {+ "name": "expertise_domains","schema": "","columns": {"id": {"name": "id",- "type": "uuid",+ "type": "varchar(255)","primaryKey": true,- "notNull": true,- "default": "gen_random_uuid()"+ "notNull": true+ },+ "slug": {+ "name": "slug",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false},"user_id": {"name": "user_id",@@ -15486,37 +19547,115 @@"primaryKey": false,"notNull": false},- "name": {- "name": "name",+ "visibility": {+ "name": "visibility",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'private'"+ },+ "source": {+ "name": "source",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'user'"+ },+ "parent_domain_id": {+ "name": "parent_domain_id","type": "varchar(255)","primaryKey": false,+ "notNull": false+ },+ "domain_filter": {+ "name": "domain_filter",+ "type": "text",+ "primaryKey": false,"notNull": true},- "description": {- "name": "description",+ "out_of_scope": {+ "name": "out_of_scope","type": "text","primaryKey": false,"notNull": false},- "enabled": {- "name": "enabled",- "type": "boolean",+ "layers": {+ "name": "layers",+ "type": "jsonb","primaryKey": false,"notNull": true,- "default": true+ "default": "'[]'::jsonb"},- "visibility": {- "name": "visibility",+ "layer_source": {+ "name": "layer_source","type": "text","primaryKey": false,"notNull": true,- "default": "'private'"+ "default": "'invented'"},- "configuration": {- "name": "configuration",+ "canon_entries": {+ "name": "canon_entries","type": "jsonb","primaryKey": false,- "notNull": true+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "canon_document_id": {+ "name": "canon_document_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "flow": {+ "name": "flow",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "evidence_spec": {+ "name": "evidence_spec",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "lesson_base_document_id": {+ "name": "lesson_base_document_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "anchor_candidates": {+ "name": "anchor_candidates",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "anchor_chosen_at": {+ "name": "anchor_chosen_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "anchor_chosen_by_user_id": {+ "name": "anchor_chosen_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "seed_state": {+ "name": "seed_state",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'seeding'"+ },+ "seed_run_id": {+ "name": "seed_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false},"accessed_at": {"name": "accessed_at",@@ -15541,38 +19680,30 @@}},"indexes": {- "environments_user_id_idx": {- "name": "environments_user_id_idx",+ "expertise_domains_slug_user_unique": {+ "name": "expertise_domains_slug_user_unique","columns": [{- "expression": "user_id",+ "expression": "slug","isExpression": false,"asc": true,"nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "environments_workspace_id_idx": {- "name": "environments_workspace_id_idx",- "columns": [+ },{- "expression": "workspace_id",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,+ "where": "\"expertise_domains\".\"workspace_id\" is null","concurrently": false,"method": "btree","with": {}},- "environments_workspace_visibility_idx": {- "name": "environments_workspace_visibility_idx",+ "expertise_domains_slug_workspace_unique": {+ "name": "expertise_domains_slug_workspace_unique","columns": [{"expression": "workspace_id",@@ -15581,47 +19712,35 @@"nulls": "last"},{- "expression": "visibility",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "user_id",+ "expression": "slug","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,+ "where": "\"expertise_domains\".\"workspace_id\" is not null","concurrently": false,"method": "btree","with": {}},- "environments_user_name_unique": {- "name": "environments_user_name_unique",+ "expertise_domains_user_id_idx": {+ "name": "expertise_domains_user_id_idx","columns": [{"expression": "user_id","isExpression": false,"asc": true,"nulls": "last"- },- {- "expression": "name",- "isExpression": false,- "asc": true,- "nulls": "last"}],- "isUnique": true,- "where": "\"environments\".\"workspace_id\" is null",+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "environments_workspace_user_name_unique": {- "name": "environments_workspace_user_name_unique",+ "expertise_domains_workspace_visibility_idx": {+ "name": "expertise_domains_workspace_visibility_idx","columns": [{"expression": "workspace_id",@@ -15630,62 +19749,97 @@"nulls": "last"},{- "expression": "user_id",+ "expression": "visibility","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "expertise_domains_parent_idx": {+ "name": "expertise_domains_parent_idx",+ "columns": [{- "expression": "name",+ "expression": "parent_domain_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,- "where": "\"environments\".\"workspace_id\" is not null",+ "isUnique": false,"concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "environments_user_id_users_id_fk": {- "name": "environments_user_id_users_id_fk",- "tableFrom": "environments",+ "expertise_domains_user_id_users_id_fk": {+ "name": "expertise_domains_user_id_users_id_fk",+ "tableFrom": "expertise_domains","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],- "onDelete": "restrict",+ "onDelete": "cascade","onUpdate": "no action"},- "environments_workspace_id_workspaces_id_fk": {- "name": "environments_workspace_id_workspaces_id_fk",- "tableFrom": "environments",+ "expertise_domains_workspace_id_workspaces_id_fk": {+ "name": "expertise_domains_workspace_id_workspaces_id_fk",+ "tableFrom": "expertise_domains","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],- "onDelete": "restrict",+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "expertise_domains_parent_domain_id_expertise_domains_id_fk": {+ "name": "expertise_domains_parent_domain_id_expertise_domains_id_fk",+ "tableFrom": "expertise_domains",+ "tableTo": "expertise_domains",+ "columnsFrom": ["parent_domain_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "expertise_domains_canon_document_id_documents_id_fk": {+ "name": "expertise_domains_canon_document_id_documents_id_fk",+ "tableFrom": "expertise_domains",+ "tableTo": "documents",+ "columnsFrom": ["canon_document_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "expertise_domains_lesson_base_document_id_documents_id_fk": {+ "name": "expertise_domains_lesson_base_document_id_documents_id_fk",+ "tableFrom": "expertise_domains",+ "tableTo": "documents",+ "columnsFrom": ["lesson_base_document_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "expertise_domains_anchor_chosen_by_user_id_users_id_fk": {+ "name": "expertise_domains_anchor_chosen_by_user_id_users_id_fk",+ "tableFrom": "expertise_domains",+ "tableTo": "users",+ "columnsFrom": ["anchor_chosen_by_user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null","onUpdate": "no action"}},"compositePrimaryKeys": {},"uniqueConstraints": {},"policies": {},- "checkConstraints": {- "environments_name_not_empty": {- "name": "environments_name_not_empty",- "value": "length(btrim(\"environments\".\"name\")) > 0"- },- "environments_configuration_object": {- "name": "environments_configuration_object",- "value": "jsonb_typeof(\"environments\".\"configuration\") = 'object'"- }- },+ "checkConstraints": {},"isRLSEnabled": false},- "public.environment_instances": {- "name": "environment_instances",+ "public.expertise_hits": {+ "name": "expertise_hits","schema": "","columns": {"id": {@@ -15695,98 +19849,89 @@"notNull": true,"default": "gen_random_uuid()"},- "environment_id": {- "name": "environment_id",+ "run_id": {+ "name": "run_id","type": "uuid","primaryKey": false,"notNull": true},- "name": {- "name": "name",- "type": "varchar(255)",+ "lesson_id": {+ "name": "lesson_id",+ "type": "uuid","primaryKey": false,"notNull": true},- "kind": {- "name": "kind",- "type": "text",+ "domain_id": {+ "name": "domain_id",+ "type": "varchar(255)","primaryKey": false,"notNull": true},- "device_id": {- "name": "device_id",- "type": "uuid",+ "outcome": {+ "name": "outcome",+ "type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "provider": {- "name": "provider",+ "where": {+ "name": "where","type": "text","primaryKey": false,"notNull": false},- "provider_scope": {- "name": "provider_scope",+ "note": {+ "name": "note","type": "text","primaryKey": false,"notNull": false},- "provider_resource_id": {- "name": "provider_resource_id",+ "example": {+ "name": "example","type": "text","primaryKey": false,"notNull": false},- "working_directory": {- "name": "working_directory",+ "severity": {+ "name": "severity","type": "text","primaryKey": false,- "notNull": true- },- "configuration_snapshot": {- "name": "configuration_snapshot",- "type": "jsonb",- "primaryKey": false,- "notNull": true+ "notNull": false},- "configuration": {- "name": "configuration",- "type": "jsonb",+ "evidence_id": {+ "name": "evidence_id",+ "type": "uuid","primaryKey": false,"notNull": false},- "enabled": {- "name": "enabled",- "type": "boolean",+ "operation_id": {+ "name": "operation_id",+ "type": "text","primaryKey": false,- "notNull": true,- "default": true+ "notNull": false},- "status": {- "name": "status",- "type": "text",+ "source_check_result_id": {+ "name": "source_check_result_id",+ "type": "uuid","primaryKey": false,- "notNull": true,- "default": "'pending'"+ "notNull": false},- "build_id": {- "name": "build_id",+ "source_message_id": {+ "name": "source_message_id","type": "text","primaryKey": false,"notNull": false},- "build_error": {- "name": "build_error",+ "user_decision": {+ "name": "user_decision","type": "text","primaryKey": false,"notNull": false},- "accessed_at": {- "name": "accessed_at",+ "user_decision_at": {+ "name": "user_decision_at","type": "timestamp with time zone","primaryKey": false,- "notNull": true,- "default": "now()"+ "notNull": false},"created_at": {"name": "created_at",@@ -15794,164 +19939,171 @@"primaryKey": false,"notNull": true,"default": "now()"- },- "updated_at": {- "name": "updated_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": true,- "default": "now()"}},"indexes": {- "environment_instances_environment_id_id_unique": {- "name": "environment_instances_environment_id_id_unique",+ "expertise_hits_lesson_created_idx": {+ "name": "expertise_hits_lesson_created_idx","columns": [{- "expression": "environment_id",+ "expression": "lesson_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "id",+ "expression": "created_at","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "environment_instances_device_path_unique": {- "name": "environment_instances_device_path_unique",+ "expertise_hits_run_idx": {+ "name": "expertise_hits_run_idx","columns": [{- "expression": "device_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "working_directory",+ "expression": "run_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,- "where": "\"environment_instances\".\"device_id\" IS NOT NULL",+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "environment_instances_provider_path_unique": {- "name": "environment_instances_provider_path_unique",+ "expertise_hits_domain_outcome_idx": {+ "name": "expertise_hits_domain_outcome_idx","columns": [{- "expression": "kind",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "provider",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "provider_scope",+ "expression": "domain_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "provider_resource_id",+ "expression": "outcome","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "expertise_hits_operation_idx": {+ "name": "expertise_hits_operation_idx",+ "columns": [{- "expression": "working_directory",+ "expression": "operation_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,- "where": "\"environment_instances\".\"device_id\" IS NULL",+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "environment_instances_environment_id_idx": {- "name": "environment_instances_environment_id_idx",+ "expertise_hits_source_message_idx": {+ "name": "expertise_hits_source_message_idx","columns": [{- "expression": "environment_id",+ "expression": "source_message_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,+ "where": "\"expertise_hits\".\"source_message_id\" is not null","concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "environment_instances_environment_id_environments_id_fk": {- "name": "environment_instances_environment_id_environments_id_fk",- "tableFrom": "environment_instances",- "tableTo": "environments",- "columnsFrom": ["environment_id"],+ "expertise_hits_domain_id_expertise_domains_id_fk": {+ "name": "expertise_hits_domain_id_expertise_domains_id_fk",+ "tableFrom": "expertise_hits",+ "tableTo": "expertise_domains",+ "columnsFrom": ["domain_id"],"columnsTo": ["id"],- "onDelete": "restrict",+ "onDelete": "cascade","onUpdate": "no action"},- "environment_instances_device_id_devices_id_fk": {- "name": "environment_instances_device_id_devices_id_fk",- "tableFrom": "environment_instances",- "tableTo": "devices",- "columnsFrom": ["device_id"],+ "expertise_hits_evidence_id_verify_evidence_id_fk": {+ "name": "expertise_hits_evidence_id_verify_evidence_id_fk",+ "tableFrom": "expertise_hits",+ "tableTo": "verify_evidence",+ "columnsFrom": ["evidence_id"],"columnsTo": ["id"],- "onDelete": "restrict",+ "onDelete": "set null","onUpdate": "no action"- }- },- "compositePrimaryKeys": {},- "uniqueConstraints": {},- "policies": {},- "checkConstraints": {- "environment_instances_name_not_empty": {- "name": "environment_instances_name_not_empty",- "value": "length(btrim(\"environment_instances\".\"name\")) > 0"},- "environment_instances_directory_not_empty": {- "name": "environment_instances_directory_not_empty",- "value": "length(btrim(\"environment_instances\".\"working_directory\")) > 0"+ "expertise_hits_operation_id_agent_operations_id_fk": {+ "name": "expertise_hits_operation_id_agent_operations_id_fk",+ "tableFrom": "expertise_hits",+ "tableTo": "agent_operations",+ "columnsFrom": ["operation_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"},- "environment_instances_snapshot_object": {- "name": "environment_instances_snapshot_object",- "value": "jsonb_typeof(\"environment_instances\".\"configuration_snapshot\") = 'object'"+ "expertise_hits_source_check_result_id_verify_check_results_id_fk": {+ "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"],+ "onDelete": "set null",+ "onUpdate": "no action"},- "environment_instances_configuration_object": {- "name": "environment_instances_configuration_object",- "value": "\"environment_instances\".\"configuration\" IS NULL OR jsonb_typeof(\"environment_instances\".\"configuration\") = 'object'"+ "expertise_hits_source_message_id_messages_id_fk": {+ "name": "expertise_hits_source_message_id_messages_id_fk",+ "tableFrom": "expertise_hits",+ "tableTo": "messages",+ "columnsFrom": ["source_message_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"},- "environment_instances_binding": {- "name": "environment_instances_binding",- "value": "(\n \"environment_instances\".\"kind\" = 'device' AND \"environment_instances\".\"device_id\" IS NOT NULL AND \"environment_instances\".\"provider\" IS NULL AND \"environment_instances\".\"provider_scope\" IS NULL AND \"environment_instances\".\"provider_resource_id\" IS NULL\n ) OR (\n \"environment_instances\".\"kind\" <> 'device' AND \"environment_instances\".\"device_id\" IS NULL AND\n \"environment_instances\".\"provider\" IS NOT NULL AND length(btrim(\"environment_instances\".\"provider\")) > 0 AND\n \"environment_instances\".\"provider_scope\" IS NOT NULL AND length(btrim(\"environment_instances\".\"provider_scope\")) > 0 AND\n \"environment_instances\".\"provider_resource_id\" IS NOT NULL AND length(btrim(\"environment_instances\".\"provider_resource_id\")) > 0\n )"+ "expertise_hits_run_domain_fk": {+ "name": "expertise_hits_run_domain_fk",+ "tableFrom": "expertise_hits",+ "tableTo": "expertise_runs",+ "columnsFrom": ["run_id", "domain_id"],+ "columnsTo": ["id", "domain_id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "expertise_hits_lesson_domain_fk": {+ "name": "expertise_hits_lesson_domain_fk",+ "tableFrom": "expertise_hits",+ "tableTo": "expertise_lessons",+ "columnsFrom": ["lesson_id", "domain_id"],+ "columnsTo": ["id", "domain_id"],+ "onDelete": "cascade",+ "onUpdate": "no action"}},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},"isRLSEnabled": false},- "public.expertise_bindings": {- "name": "expertise_bindings",+ "public.expertise_insights": {+ "name": "expertise_insights","schema": "","columns": {"id": {@@ -15965,71 +20117,87 @@"name": "domain_id","type": "varchar(255)","primaryKey": false,- "notNull": true+ "notNull": false},- "agent_id": {- "name": "agent_id",+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,"notNull": false},- "project_id": {- "name": "project_id",+ "workspace_id": {+ "name": "workspace_id","type": "text","primaryKey": false,"notNull": false},- "bound_workspace_id": {- "name": "bound_workspace_id",- "type": "text",+ "kind": {+ "name": "kind",+ "type": "varchar(255)","primaryKey": false,- "notNull": false+ "notNull": true},- "bound_user_id": {- "name": "bound_user_id",+ "headline": {+ "name": "headline","type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "contribution_mode": {- "name": "contribution_mode",+ "body": {+ "name": "body","type": "text","primaryKey": false,- "notNull": true,- "default": "'derive'"+ "notNull": true},- "added_by_user_id": {- "name": "added_by_user_id",+ "action_label": {+ "name": "action_label","type": "text","primaryKey": false,"notNull": false},- "workspace_id": {- "name": "workspace_id",- "type": "text",+ "action_target": {+ "name": "action_target",+ "type": "jsonb","primaryKey": false,"notNull": false},- "enabled": {- "name": "enabled",- "type": "boolean",+ "evidence": {+ "name": "evidence",+ "type": "jsonb","primaryKey": false,"notNull": true,- "default": true+ "default": "'[]'::jsonb"},- "sort_order": {- "name": "sort_order",- "type": "integer",+ "confidence": {+ "name": "confidence",+ "type": "real","primaryKey": false,- "notNull": true,- "default": 0+ "notNull": false},- "accessed_at": {- "name": "accessed_at",- "type": "timestamp with time zone",+ "status": {+ "name": "status",+ "type": "text","primaryKey": false,"notNull": true,- "default": "now()"+ "default": "'active'"+ },+ "dismiss_reason": {+ "name": "dismiss_reason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "stale_after_run_index": {+ "name": "stale_after_run_index",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "generated_by_operation_id": {+ "name": "generated_by_operation_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false},"created_at": {"name": "created_at",@@ -16047,99 +20215,38 @@}},"indexes": {- "expertise_bindings_agent_domain_unique": {- "name": "expertise_bindings_agent_domain_unique",- "columns": [- {- "expression": "agent_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "domain_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": true,- "where": "\"expertise_bindings\".\"agent_id\" is not null",- "concurrently": false,- "method": "btree",- "with": {}- },- "expertise_bindings_project_domain_unique": {- "name": "expertise_bindings_project_domain_unique",+ "expertise_insights_domain_status_idx": {+ "name": "expertise_insights_domain_status_idx","columns": [- {- "expression": "project_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },{"expression": "domain_id","isExpression": false,"asc": true,"nulls": "last"- }- ],- "isUnique": true,- "where": "\"expertise_bindings\".\"project_id\" is not null",- "concurrently": false,- "method": "btree",- "with": {}- },- "expertise_bindings_workspace_domain_unique": {- "name": "expertise_bindings_workspace_domain_unique",- "columns": [- {- "expression": "bound_workspace_id",- "isExpression": false,- "asc": true,- "nulls": "last"},{- "expression": "domain_id",+ "expression": "status","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,- "where": "\"expertise_bindings\".\"bound_workspace_id\" is not null",+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "expertise_bindings_user_domain_unique": {- "name": "expertise_bindings_user_domain_unique",+ "expertise_insights_user_status_idx": {+ "name": "expertise_insights_user_status_idx","columns": [{- "expression": "bound_user_id",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "domain_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": true,- "where": "\"expertise_bindings\".\"bound_user_id\" is not null",- "concurrently": false,- "method": "btree",- "with": {}- },- "expertise_bindings_domain_idx": {- "name": "expertise_bindings_domain_idx",- "columns": [- {- "expression": "domain_id",+ "expression": "status","isExpression": false,"asc": true,"nulls": "last"@@ -16150,8 +20257,8 @@"method": "btree","with": {}},- "expertise_bindings_workspace_id_idx": {- "name": "expertise_bindings_workspace_id_idx",+ "expertise_insights_workspace_idx": {+ "name": "expertise_insights_workspace_idx","columns": [{"expression": "workspace_id",@@ -16167,83 +20274,51 @@}},"foreignKeys": {- "expertise_bindings_domain_id_expertise_domains_id_fk": {- "name": "expertise_bindings_domain_id_expertise_domains_id_fk",- "tableFrom": "expertise_bindings",+ "expertise_insights_domain_id_expertise_domains_id_fk": {+ "name": "expertise_insights_domain_id_expertise_domains_id_fk",+ "tableFrom": "expertise_insights","tableTo": "expertise_domains","columnsFrom": ["domain_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "expertise_bindings_agent_id_agents_id_fk": {- "name": "expertise_bindings_agent_id_agents_id_fk",- "tableFrom": "expertise_bindings",- "tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "expertise_bindings_project_id_projects_id_fk": {- "name": "expertise_bindings_project_id_projects_id_fk",- "tableFrom": "expertise_bindings",- "tableTo": "projects",- "columnsFrom": ["project_id"],+ "expertise_insights_user_id_users_id_fk": {+ "name": "expertise_insights_user_id_users_id_fk",+ "tableFrom": "expertise_insights",+ "tableTo": "users",+ "columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "expertise_bindings_bound_workspace_id_workspaces_id_fk": {- "name": "expertise_bindings_bound_workspace_id_workspaces_id_fk",- "tableFrom": "expertise_bindings",+ "expertise_insights_workspace_id_workspaces_id_fk": {+ "name": "expertise_insights_workspace_id_workspaces_id_fk",+ "tableFrom": "expertise_insights","tableTo": "workspaces",- "columnsFrom": ["bound_workspace_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "expertise_bindings_bound_user_id_users_id_fk": {- "name": "expertise_bindings_bound_user_id_users_id_fk",- "tableFrom": "expertise_bindings",- "tableTo": "users",- "columnsFrom": ["bound_user_id"],+ "columnsFrom": ["workspace_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "expertise_bindings_added_by_user_id_users_id_fk": {- "name": "expertise_bindings_added_by_user_id_users_id_fk",- "tableFrom": "expertise_bindings",- "tableTo": "users",- "columnsFrom": ["added_by_user_id"],+ "expertise_insights_generated_by_operation_id_agent_operations_id_fk": {+ "name": "expertise_insights_generated_by_operation_id_agent_operations_id_fk",+ "tableFrom": "expertise_insights",+ "tableTo": "agent_operations",+ "columnsFrom": ["generated_by_operation_id"],"columnsTo": ["id"],"onDelete": "set null","onUpdate": "no action"- },- "expertise_bindings_workspace_id_workspaces_id_fk": {- "name": "expertise_bindings_workspace_id_workspaces_id_fk",- "tableFrom": "expertise_bindings",- "tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"}},"compositePrimaryKeys": {},"uniqueConstraints": {},"policies": {},- "checkConstraints": {- "expertise_bindings_exactly_one_carrier": {- "name": "expertise_bindings_exactly_one_carrier",- "value": "(\"expertise_bindings\".\"agent_id\" IS NOT NULL)::int + (\"expertise_bindings\".\"project_id\" IS NOT NULL)::int + (\"expertise_bindings\".\"bound_workspace_id\" IS NOT NULL)::int + (\"expertise_bindings\".\"bound_user_id\" IS NOT NULL)::int = 1"- }- },+ "checkConstraints": {},"isRLSEnabled": false},- "public.expertise_domain_snapshots": {- "name": "expertise_domain_snapshots",+ "public.expertise_lesson_revisions": {+ "name": "expertise_lesson_revisions","schema": "","columns": {"id": {@@ -16253,138 +20328,75 @@"notNull": true,"default": "gen_random_uuid()"},- "domain_id": {- "name": "domain_id",- "type": "varchar(255)",- "primaryKey": false,- "notNull": true- },- "run_id": {- "name": "run_id",+ "lesson_id": {+ "name": "lesson_id","type": "uuid","primaryKey": false,- "notNull": false- },- "run_index": {- "name": "run_index",- "type": "integer",- "primaryKey": false,- "notNull": true- },- "learned_total": {- "name": "learned_total",- "type": "integer",- "primaryKey": false,"notNull": true},- "retired_total": {- "name": "retired_total",- "type": "integer",- "primaryKey": false,- "notNull": true,- "default": 0- },- "active_count": {- "name": "active_count",+ "revision": {+ "name": "revision","type": "integer","primaryKey": false,"notNull": true},- "compiled_count": {- "name": "compiled_count",- "type": "integer",- "primaryKey": false,- "notNull": true,- "default": 0- },- "layer_counts": {- "name": "layer_counts",+ "sections": {+ "name": "sections","type": "jsonb","primaryKey": false,- "notNull": true,- "default": "'{}'::jsonb"- },- "p_inf": {- "name": "p_inf",- "type": "numeric",- "primaryKey": false,- "notNull": false- },- "tau": {- "name": "tau",- "type": "numeric",- "primaryKey": false,- "notNull": false- },- "maturity": {- "name": "maturity",- "type": "numeric",- "primaryKey": false,- "notNull": false- },- "fit_sample_size": {- "name": "fit_sample_size",- "type": "integer",- "primaryKey": false,- "notNull": false- },- "fit_r2": {- "name": "fit_r2",- "type": "numeric",- "primaryKey": false,- "notNull": false+ "notNull": true},- "fit_confidence": {- "name": "fit_confidence",+ "feedback": {+ "name": "feedback","type": "text","primaryKey": false,"notNull": false},- "fit_computed_at": {- "name": "fit_computed_at",- "type": "timestamp with time zone",+ "changed_by": {+ "name": "changed_by",+ "type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "tau_pinned": {- "name": "tau_pinned",- "type": "boolean",+ "kind": {+ "name": "kind",+ "type": "text","primaryKey": false,"notNull": true,- "default": false+ "default": "'user-feedback'"},- "observed_span": {- "name": "observed_span",- "type": "numeric",+ "prev_title": {+ "name": "prev_title",+ "type": "text","primaryKey": false,"notNull": false},- "plateau_kind": {- "name": "plateau_kind",- "type": "text",+ "evidence": {+ "name": "evidence",+ "type": "jsonb","primaryKey": false,"notNull": false},- "layer_coverage": {- "name": "layer_coverage",- "type": "numeric",+ "changed_by_user_id": {+ "name": "changed_by_user_id",+ "type": "text","primaryKey": false,"notNull": false},- "canon_coverage": {- "name": "canon_coverage",- "type": "numeric",+ "source_run_id": {+ "name": "source_run_id",+ "type": "uuid","primaryKey": false,"notNull": false},- "active_rate": {- "name": "active_rate",- "type": "numeric",+ "operation_id": {+ "name": "operation_id",+ "type": "text","primaryKey": false,"notNull": false},- "captured_at": {- "name": "captured_at",+ "created_at": {+ "name": "created_at","type": "timestamp with time zone","primaryKey": false,"notNull": true,@@ -16392,91 +20404,69 @@}},"indexes": {- "expertise_domain_snapshots_domain_run_index_unique": {- "name": "expertise_domain_snapshots_domain_run_index_unique",- "columns": [- {- "expression": "domain_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "run_index",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": true,- "concurrently": false,- "method": "btree",- "with": {}- },- "expertise_domain_snapshots_domain_captured_idx": {- "name": "expertise_domain_snapshots_domain_captured_idx",+ "expertise_lesson_revisions_lesson_revision_unique": {+ "name": "expertise_lesson_revisions_lesson_revision_unique","columns": [{- "expression": "domain_id",+ "expression": "lesson_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "captured_at",+ "expression": "revision","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,"concurrently": false,"method": "btree","with": {}},- "expertise_domain_snapshots_pending_fit_idx": {- "name": "expertise_domain_snapshots_pending_fit_idx",+ "expertise_lesson_revisions_lesson_idx": {+ "name": "expertise_lesson_revisions_lesson_idx","columns": [{- "expression": "domain_id",+ "expression": "lesson_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,- "where": "\"expertise_domain_snapshots\".\"fit_computed_at\" is null","concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "expertise_domain_snapshots_domain_id_expertise_domains_id_fk": {- "name": "expertise_domain_snapshots_domain_id_expertise_domains_id_fk",- "tableFrom": "expertise_domain_snapshots",- "tableTo": "expertise_domains",- "columnsFrom": ["domain_id"],+ "expertise_lesson_revisions_lesson_id_expertise_lessons_id_fk": {+ "name": "expertise_lesson_revisions_lesson_id_expertise_lessons_id_fk",+ "tableFrom": "expertise_lesson_revisions",+ "tableTo": "expertise_lessons",+ "columnsFrom": ["lesson_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "expertise_domain_snapshots_run_id_expertise_runs_id_fk": {- "name": "expertise_domain_snapshots_run_id_expertise_runs_id_fk",- "tableFrom": "expertise_domain_snapshots",- "tableTo": "expertise_runs",- "columnsFrom": ["run_id"],+ "expertise_lesson_revisions_changed_by_user_id_users_id_fk": {+ "name": "expertise_lesson_revisions_changed_by_user_id_users_id_fk",+ "tableFrom": "expertise_lesson_revisions",+ "tableTo": "users",+ "columnsFrom": ["changed_by_user_id"],"columnsTo": ["id"],"onDelete": "set null","onUpdate": "no action"},- "expertise_domain_snapshots_run_domain_fk": {- "name": "expertise_domain_snapshots_run_domain_fk",- "tableFrom": "expertise_domain_snapshots",- "tableTo": "expertise_runs",- "columnsFrom": ["run_id", "domain_id"],- "columnsTo": ["id", "domain_id"],- "onDelete": "no action",+ "expertise_lesson_revisions_operation_id_agent_operations_id_fk": {+ "name": "expertise_lesson_revisions_operation_id_agent_operations_id_fk",+ "tableFrom": "expertise_lesson_revisions",+ "tableTo": "agent_operations",+ "columnsFrom": ["operation_id"],+ "columnsTo": ["id"],+ "onDelete": "set null","onUpdate": "no action"}},@@ -16486,155 +20476,215 @@"checkConstraints": {},"isRLSEnabled": false},- "public.expertise_domains": {- "name": "expertise_domains",+ "public.expertise_lessons": {+ "name": "expertise_lessons","schema": "","columns": {"id": {"name": "id",- "type": "varchar(255)",+ "type": "uuid","primaryKey": true,- "notNull": true+ "notNull": true,+ "default": "gen_random_uuid()"},- "slug": {- "name": "slug",+ "domain_id": {+ "name": "domain_id","type": "varchar(255)","primaryKey": false,"notNull": true},+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "code": {+ "name": "code",+ "type": "varchar(20)",+ "primaryKey": false,+ "notNull": true+ },+ "polarity": {+ "name": "polarity",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },"title": {"name": "title","type": "text","primaryKey": false,"notNull": true},- "description": {- "name": "description",+ "sections": {+ "name": "sections",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "layer": {+ "name": "layer",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "tags": {+ "name": "tags",+ "type": "text[]",+ "primaryKey": false,+ "notNull": false+ },+ "reason_kind": {+ "name": "reason_kind","type": "text","primaryKey": false,"notNull": false},- "user_id": {- "name": "user_id",+ "reason_source": {+ "name": "reason_source","type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "workspace_id": {- "name": "workspace_id",+ "canon_anchor": {+ "name": "canon_anchor","type": "text","primaryKey": false,"notNull": false},- "visibility": {- "name": "visibility",+ "origin_run_id": {+ "name": "origin_run_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "origin_hit_id": {+ "name": "origin_hit_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status","type": "text","primaryKey": false,"notNull": true,- "default": "'private'"+ "default": "'active'"},- "source": {- "name": "source",+ "rejected_reason": {+ "name": "rejected_reason","type": "text","primaryKey": false,- "notNull": true,- "default": "'user'"+ "notNull": false},- "parent_domain_id": {- "name": "parent_domain_id",- "type": "varchar(255)",+ "salvaged_from_id": {+ "name": "salvaged_from_id",+ "type": "uuid","primaryKey": false,"notNull": false},- "domain_filter": {- "name": "domain_filter",- "type": "text",+ "retired_at": {+ "name": "retired_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": true+ "notNull": false},- "out_of_scope": {- "name": "out_of_scope",+ "sort_order": {+ "name": "sort_order",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "enforcement": {+ "name": "enforcement","type": "text","primaryKey": false,"notNull": false},- "layers": {- "name": "layers",- "type": "jsonb",+ "direction": {+ "name": "direction",+ "type": "text","primaryKey": false,- "notNull": true,- "default": "'[]'::jsonb"+ "notNull": false},- "layer_source": {- "name": "layer_source",+ "compilability": {+ "name": "compilability","type": "text","primaryKey": false,"notNull": true,- "default": "'invented'"+ "default": "'compilable'"},- "canon_entries": {- "name": "canon_entries",+ "backtest": {+ "name": "backtest","type": "jsonb","primaryKey": false,- "notNull": true,- "default": "'[]'::jsonb"+ "notNull": false},- "canon_document_id": {- "name": "canon_document_id",- "type": "varchar(255)",+ "compiled_criterion_id": {+ "name": "compiled_criterion_id",+ "type": "uuid","primaryKey": false,"notNull": false},- "flow": {- "name": "flow",- "type": "jsonb",+ "hit_count": {+ "name": "hit_count",+ "type": "integer","primaryKey": false,"notNull": true,- "default": "'[]'::jsonb"+ "default": 0},- "evidence_spec": {- "name": "evidence_spec",- "type": "jsonb",+ "hit_run_count": {+ "name": "hit_run_count",+ "type": "integer","primaryKey": false,"notNull": true,- "default": "'[]'::jsonb"+ "default": 0},- "lesson_base_document_id": {- "name": "lesson_base_document_id",- "type": "varchar(255)",+ "false_positive_count": {+ "name": "false_positive_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "last_hit_at": {+ "name": "last_hit_at",+ "type": "timestamp with time zone","primaryKey": false,"notNull": false},- "anchor_candidates": {- "name": "anchor_candidates",- "type": "jsonb",+ "last_hit_run_id": {+ "name": "last_hit_run_id",+ "type": "uuid","primaryKey": false,"notNull": false},- "anchor_chosen_at": {- "name": "anchor_chosen_at",- "type": "timestamp with time zone",+ "generalized_from_ids": {+ "name": "generalized_from_ids",+ "type": "jsonb","primaryKey": false,"notNull": false},- "anchor_chosen_by_user_id": {- "name": "anchor_chosen_by_user_id",+ "specificity": {+ "name": "specificity","type": "text","primaryKey": false,"notNull": false},- "seed_state": {- "name": "seed_state",- "type": "text",+ "example_count": {+ "name": "example_count",+ "type": "integer","primaryKey": false,"notNull": true,- "default": "'seeding'"+ "default": 0},- "seed_run_id": {- "name": "seed_run_id",- "type": "uuid",+ "current_revision": {+ "name": "current_revision",+ "type": "integer","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": 1},"accessed_at": {"name": "accessed_at",@@ -16659,55 +20709,44 @@}},"indexes": {- "expertise_domains_slug_user_unique": {- "name": "expertise_domains_slug_user_unique",+ "expertise_lessons_domain_code_unique": {+ "name": "expertise_lessons_domain_code_unique","columns": [{- "expression": "slug",+ "expression": "domain_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "user_id",+ "expression": "code","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": true,- "where": "\"expertise_domains\".\"workspace_id\" is null","concurrently": false,"method": "btree","with": {}},- "expertise_domains_slug_workspace_unique": {- "name": "expertise_domains_slug_workspace_unique",+ "expertise_lessons_domain_status_hits_idx": {+ "name": "expertise_lessons_domain_status_hits_idx","columns": [{- "expression": "workspace_id",+ "expression": "domain_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "slug",+ "expression": "status","isExpression": false,"asc": true,"nulls": "last"- }- ],- "isUnique": true,- "where": "\"expertise_domains\".\"workspace_id\" is not null",- "concurrently": false,- "method": "btree",- "with": {}- },- "expertise_domains_user_id_idx": {- "name": "expertise_domains_user_id_idx",- "columns": [+ },{- "expression": "user_id",+ "expression": "hit_count","isExpression": false,"asc": true,"nulls": "last"@@ -16718,17 +20757,17 @@"method": "btree","with": {}},- "expertise_domains_workspace_visibility_idx": {- "name": "expertise_domains_workspace_visibility_idx",+ "expertise_lessons_domain_layer_idx": {+ "name": "expertise_lessons_domain_layer_idx","columns": [{- "expression": "workspace_id",+ "expression": "domain_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "visibility",+ "expression": "layer","isExpression": false,"asc": true,"nulls": "last"@@ -16739,11 +20778,11 @@"method": "btree","with": {}},- "expertise_domains_parent_idx": {- "name": "expertise_domains_parent_idx",+ "expertise_lessons_compiled_criterion_idx": {+ "name": "expertise_lessons_compiled_criterion_idx","columns": [{- "expression": "parent_domain_id",+ "expression": "compiled_criterion_id","isExpression": false,"asc": true,"nulls": "last"@@ -16756,69 +20795,57 @@}},"foreignKeys": {- "expertise_domains_user_id_users_id_fk": {- "name": "expertise_domains_user_id_users_id_fk",- "tableFrom": "expertise_domains",- "tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "expertise_domains_workspace_id_workspaces_id_fk": {- "name": "expertise_domains_workspace_id_workspaces_id_fk",- "tableFrom": "expertise_domains",- "tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "expertise_domains_parent_domain_id_expertise_domains_id_fk": {- "name": "expertise_domains_parent_domain_id_expertise_domains_id_fk",- "tableFrom": "expertise_domains",+ "expertise_lessons_domain_id_expertise_domains_id_fk": {+ "name": "expertise_lessons_domain_id_expertise_domains_id_fk",+ "tableFrom": "expertise_lessons","tableTo": "expertise_domains",- "columnsFrom": ["parent_domain_id"],+ "columnsFrom": ["domain_id"],"columnsTo": ["id"],- "onDelete": "set null",+ "onDelete": "cascade","onUpdate": "no action"},- "expertise_domains_canon_document_id_documents_id_fk": {- "name": "expertise_domains_canon_document_id_documents_id_fk",- "tableFrom": "expertise_domains",- "tableTo": "documents",- "columnsFrom": ["canon_document_id"],+ "expertise_lessons_created_by_user_id_users_id_fk": {+ "name": "expertise_lessons_created_by_user_id_users_id_fk",+ "tableFrom": "expertise_lessons",+ "tableTo": "users",+ "columnsFrom": ["created_by_user_id"],"columnsTo": ["id"],"onDelete": "set null","onUpdate": "no action"},- "expertise_domains_lesson_base_document_id_documents_id_fk": {- "name": "expertise_domains_lesson_base_document_id_documents_id_fk",- "tableFrom": "expertise_domains",- "tableTo": "documents",- "columnsFrom": ["lesson_base_document_id"],+ "expertise_lessons_salvaged_from_id_expertise_lessons_id_fk": {+ "name": "expertise_lessons_salvaged_from_id_expertise_lessons_id_fk",+ "tableFrom": "expertise_lessons",+ "tableTo": "expertise_lessons",+ "columnsFrom": ["salvaged_from_id"],"columnsTo": ["id"],"onDelete": "set null","onUpdate": "no action"},- "expertise_domains_anchor_chosen_by_user_id_users_id_fk": {- "name": "expertise_domains_anchor_chosen_by_user_id_users_id_fk",- "tableFrom": "expertise_domains",- "tableTo": "users",- "columnsFrom": ["anchor_chosen_by_user_id"],+ "expertise_lessons_compiled_criterion_id_verify_criteria_id_fk": {+ "name": "expertise_lessons_compiled_criterion_id_verify_criteria_id_fk",+ "tableFrom": "expertise_lessons",+ "tableTo": "verify_criteria",+ "columnsFrom": ["compiled_criterion_id"],"columnsTo": ["id"],"onDelete": "set null","onUpdate": "no action"}},"compositePrimaryKeys": {},- "uniqueConstraints": {},+ "uniqueConstraints": {+ "expertise_lessons_id_domain_unique": {+ "name": "expertise_lessons_id_domain_unique",+ "nullsNotDistinct": false,+ "columns": ["id", "domain_id"]+ }+ },"policies": {},"checkConstraints": {},"isRLSEnabled": false},- "public.expertise_hits": {- "name": "expertise_hits",+ "public.expertise_runs": {+ "name": "expertise_runs","schema": "","columns": {"id": {@@ -16828,125 +20855,197 @@"notNull": true,"default": "gen_random_uuid()"},- "run_id": {- "name": "run_id",- "type": "uuid",+ "domain_id": {+ "name": "domain_id",+ "type": "varchar(255)","primaryKey": false,"notNull": true},- "lesson_id": {- "name": "lesson_id",- "type": "uuid",+ "run_index": {+ "name": "run_index",+ "type": "integer","primaryKey": false,"notNull": true},- "domain_id": {- "name": "domain_id",- "type": "varchar(255)",+ "is_seed_run": {+ "name": "is_seed_run",+ "type": "boolean","primaryKey": false,- "notNull": true+ "notNull": true,+ "default": false},- "outcome": {- "name": "outcome",+ "actor_type": {+ "name": "actor_type","type": "text","primaryKey": false,"notNull": true},- "where": {- "name": "where",+ "actor_id": {+ "name": "actor_id","type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "note": {- "name": "note",+ "subject_type": {+ "name": "subject_type","type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "example": {- "name": "example",+ "subject_id": {+ "name": "subject_id","type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "severity": {- "name": "severity",- "type": "text",+ "window_start": {+ "name": "window_start",+ "type": "timestamp with time zone","primaryKey": false,"notNull": false},- "evidence_id": {- "name": "evidence_id",- "type": "uuid",+ "window_end": {+ "name": "window_end",+ "type": "timestamp with time zone","primaryKey": false,"notNull": false},- "operation_id": {- "name": "operation_id",- "type": "text",+ "reflection_key": {+ "name": "reflection_key",+ "type": "varchar(255)","primaryKey": false,"notNull": false},- "source_check_result_id": {- "name": "source_check_result_id",- "type": "uuid",+ "had_human_in_loop": {+ "name": "had_human_in_loop",+ "type": "boolean","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": false},- "source_message_id": {- "name": "source_message_id",+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,"notNull": false},- "user_decision": {- "name": "user_decision",+ "workspace_id": {+ "name": "workspace_id","type": "text","primaryKey": false,"notNull": false},- "user_decision_at": {- "name": "user_decision_at",+ "instance_count": {+ "name": "instance_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "refine_count": {+ "name": "refine_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "new_count": {+ "name": "new_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "completed_at": {+ "name": "completed_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": {- "expertise_hits_lesson_created_idx": {- "name": "expertise_hits_lesson_created_idx",+ "expertise_runs_domain_run_index_unique": {+ "name": "expertise_runs_domain_run_index_unique","columns": [{- "expression": "lesson_id",+ "expression": "domain_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "run_index",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "expertise_runs_domain_reflection_key_unique": {+ "name": "expertise_runs_domain_reflection_key_unique",+ "columns": [+ {+ "expression": "domain_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "created_at",+ "expression": "reflection_key","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,+ "where": "\"expertise_runs\".\"reflection_key\" is not null","concurrently": false,"method": "btree","with": {}},- "expertise_hits_run_idx": {- "name": "expertise_hits_run_idx",+ "expertise_runs_domain_started_idx": {+ "name": "expertise_runs_domain_started_idx","columns": [{- "expression": "run_id",+ "expression": "domain_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "started_at","isExpression": false,"asc": true,"nulls": "last"@@ -16957,17 +21056,17 @@"method": "btree","with": {}},- "expertise_hits_domain_outcome_idx": {- "name": "expertise_hits_domain_outcome_idx",+ "expertise_runs_actor_idx": {+ "name": "expertise_runs_actor_idx","columns": [{- "expression": "domain_id",+ "expression": "actor_type","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "outcome",+ "expression": "actor_id","isExpression": false,"asc": true,"nulls": "last"@@ -16978,111 +21077,71 @@"method": "btree","with": {}},- "expertise_hits_operation_idx": {- "name": "expertise_hits_operation_idx",+ "expertise_runs_subject_idx": {+ "name": "expertise_runs_subject_idx","columns": [{- "expression": "operation_id",+ "expression": "subject_type","isExpression": false,"asc": true,"nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "expertise_hits_source_message_idx": {- "name": "expertise_hits_source_message_idx",- "columns": [+ },{- "expression": "source_message_id",+ "expression": "subject_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,- "where": "\"expertise_hits\".\"source_message_id\" is not null","concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "expertise_hits_domain_id_expertise_domains_id_fk": {- "name": "expertise_hits_domain_id_expertise_domains_id_fk",- "tableFrom": "expertise_hits",+ "expertise_runs_domain_id_expertise_domains_id_fk": {+ "name": "expertise_runs_domain_id_expertise_domains_id_fk",+ "tableFrom": "expertise_runs","tableTo": "expertise_domains","columnsFrom": ["domain_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "expertise_hits_evidence_id_verify_evidence_id_fk": {- "name": "expertise_hits_evidence_id_verify_evidence_id_fk",- "tableFrom": "expertise_hits",- "tableTo": "verify_evidence",- "columnsFrom": ["evidence_id"],- "columnsTo": ["id"],- "onDelete": "set null",- "onUpdate": "no action"- },- "expertise_hits_operation_id_agent_operations_id_fk": {- "name": "expertise_hits_operation_id_agent_operations_id_fk",- "tableFrom": "expertise_hits",- "tableTo": "agent_operations",- "columnsFrom": ["operation_id"],- "columnsTo": ["id"],- "onDelete": "set null",- "onUpdate": "no action"- },- "expertise_hits_source_check_result_id_verify_check_results_id_fk": {- "name": "expertise_hits_source_check_result_id_verify_check_results_id_fk",- "tableFrom": "expertise_hits",- "tableTo": "verify_check_results",- "columnsFrom": ["source_check_result_id"],+ "expertise_runs_user_id_users_id_fk": {+ "name": "expertise_runs_user_id_users_id_fk",+ "tableFrom": "expertise_runs",+ "tableTo": "users",+ "columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "set null","onUpdate": "no action"},- "expertise_hits_source_message_id_messages_id_fk": {- "name": "expertise_hits_source_message_id_messages_id_fk",- "tableFrom": "expertise_hits",- "tableTo": "messages",- "columnsFrom": ["source_message_id"],+ "expertise_runs_workspace_id_workspaces_id_fk": {+ "name": "expertise_runs_workspace_id_workspaces_id_fk",+ "tableFrom": "expertise_runs",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],"columnsTo": ["id"],- "onDelete": "set null",- "onUpdate": "no action"- },- "expertise_hits_run_domain_fk": {- "name": "expertise_hits_run_domain_fk",- "tableFrom": "expertise_hits",- "tableTo": "expertise_runs",- "columnsFrom": ["run_id", "domain_id"],- "columnsTo": ["id", "domain_id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "expertise_hits_lesson_domain_fk": {- "name": "expertise_hits_lesson_domain_fk",- "tableFrom": "expertise_hits",- "tableTo": "expertise_lessons",- "columnsFrom": ["lesson_id", "domain_id"],- "columnsTo": ["id", "domain_id"],"onDelete": "cascade","onUpdate": "no action"}},"compositePrimaryKeys": {},- "uniqueConstraints": {},+ "uniqueConstraints": {+ "expertise_runs_id_domain_unique": {+ "name": "expertise_runs_id_domain_unique",+ "nullsNotDistinct": false,+ "columns": ["id", "domain_id"]+ }+ },"policies": {},"checkConstraints": {},"isRLSEnabled": false},- "public.expertise_insights": {- "name": "expertise_insights",+ "public.user_favorites": {+ "name": "user_favorites","schema": "","columns": {"id": {@@ -17092,17 +21151,11 @@"notNull": true,"default": "gen_random_uuid()"},- "domain_id": {- "name": "domain_id",- "type": "varchar(255)",- "primaryKey": false,- "notNull": false- },"user_id": {"name": "user_id","type": "text","primaryKey": false,- "notNull": false+ "notNull": true},"workspace_id": {"name": "workspace_id",@@ -17110,73 +21163,49 @@"primaryKey": false,"notNull": false},- "kind": {- "name": "kind",- "type": "varchar(255)",- "primaryKey": false,- "notNull": true- },- "headline": {- "name": "headline",+ "type": {+ "name": "type","type": "text","primaryKey": false,"notNull": true},- "body": {- "name": "body",+ "target_id": {+ "name": "target_id","type": "text","primaryKey": false,"notNull": true},- "action_label": {- "name": "action_label",+ "path": {+ "name": "path","type": "text","primaryKey": false,- "notNull": false- },- "action_target": {- "name": "action_target",- "type": "jsonb",- "primaryKey": false,- "notNull": false- },- "evidence": {- "name": "evidence",- "type": "jsonb",- "primaryKey": false,- "notNull": true,- "default": "'[]'::jsonb"- },- "confidence": {- "name": "confidence",- "type": "real",- "primaryKey": false,- "notNull": false+ "notNull": true},- "status": {- "name": "status",+ "title": {+ "name": "title","type": "text","primaryKey": false,- "notNull": true,- "default": "'active'"+ "notNull": true},- "dismiss_reason": {- "name": "dismiss_reason",+ "icon": {+ "name": "icon","type": "text","primaryKey": false,"notNull": false},- "stale_after_run_index": {- "name": "stale_after_run_index",+ "sort_order": {+ "name": "sort_order","type": "integer","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": 0},- "generated_by_operation_id": {- "name": "generated_by_operation_id",- "type": "text",+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "now()"},"created_at": {"name": "created_at",@@ -17194,29 +21223,36 @@}},"indexes": {- "expertise_insights_domain_status_idx": {- "name": "expertise_insights_domain_status_idx",+ "user_favorites_personal_target_unique": {+ "name": "user_favorites_personal_target_unique","columns": [{- "expression": "domain_id",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "status",+ "expression": "type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "target_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,+ "where": "\"user_favorites\".\"workspace_id\" IS NULL","concurrently": false,"method": "btree","with": {}},- "expertise_insights_user_status_idx": {- "name": "expertise_insights_user_status_idx",+ "user_favorites_workspace_target_unique": {+ "name": "user_favorites_workspace_target_unique","columns": [{"expression": "user_id",@@ -17225,7 +21261,35 @@"nulls": "last"},{- "expression": "status",+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "target_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"user_favorites\".\"workspace_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_favorites_user_id_idx": {+ "name": "user_favorites_user_id_idx",+ "columns": [+ {+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"@@ -17236,8 +21300,8 @@"method": "btree","with": {}},- "expertise_insights_workspace_idx": {- "name": "expertise_insights_workspace_idx",+ "user_favorites_workspace_id_idx": {+ "name": "user_favorites_workspace_id_idx","columns": [{"expression": "workspace_id",@@ -17253,41 +21317,23 @@}},"foreignKeys": {- "expertise_insights_domain_id_expertise_domains_id_fk": {- "name": "expertise_insights_domain_id_expertise_domains_id_fk",- "tableFrom": "expertise_insights",- "tableTo": "expertise_domains",- "columnsFrom": ["domain_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "expertise_insights_user_id_users_id_fk": {- "name": "expertise_insights_user_id_users_id_fk",- "tableFrom": "expertise_insights",+ "user_favorites_user_id_users_id_fk": {+ "name": "user_favorites_user_id_users_id_fk",+ "tableFrom": "user_favorites","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "expertise_insights_workspace_id_workspaces_id_fk": {- "name": "expertise_insights_workspace_id_workspaces_id_fk",- "tableFrom": "expertise_insights",+ "user_favorites_workspace_id_workspaces_id_fk": {+ "name": "user_favorites_workspace_id_workspaces_id_fk",+ "tableFrom": "user_favorites","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"- },- "expertise_insights_generated_by_operation_id_agent_operations_id_fk": {- "name": "expertise_insights_generated_by_operation_id_agent_operations_id_fk",- "tableFrom": "expertise_insights",- "tableTo": "agent_operations",- "columnsFrom": ["generated_by_operation_id"],- "columnsTo": ["id"],- "onDelete": "set null",- "onUpdate": "no action"}},"compositePrimaryKeys": {},@@ -17296,104 +21342,294 @@"checkConstraints": {},"isRLSEnabled": false},- "public.expertise_lesson_revisions": {- "name": "expertise_lesson_revisions",+ "public.documents": {+ "name": "documents","schema": "","columns": {"id": {"name": "id",- "type": "uuid",+ "type": "varchar(255)","primaryKey": true,- "notNull": true,- "default": "gen_random_uuid()"+ "notNull": true},- "lesson_id": {- "name": "lesson_id",- "type": "uuid",+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "file_type": {+ "name": "file_type",+ "type": "varchar(255)","primaryKey": false,"notNull": true},- "revision": {- "name": "revision",+ "filename": {+ "name": "filename",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "total_char_count": {+ "name": "total_char_count","type": "integer","primaryKey": false,"notNull": true},- "sections": {- "name": "sections",+ "total_line_count": {+ "name": "total_line_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "pages": {+ "name": "pages","type": "jsonb","primaryKey": false,+ "notNull": false+ },+ "source_type": {+ "name": "source_type",+ "type": "text",+ "primaryKey": false,"notNull": true},- "feedback": {- "name": "feedback",+ "source": {+ "name": "source",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "file_id": {+ "name": "file_id","type": "text","primaryKey": false,"notNull": false},- "changed_by": {- "name": "changed_by",+ "knowledge_base_id": {+ "name": "knowledge_base_id","type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "kind": {- "name": "kind",+ "parent_id": {+ "name": "parent_id",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,- "notNull": true,- "default": "'user-feedback'"+ "notNull": true},- "prev_title": {- "name": "prev_title",+ "client_id": {+ "name": "client_id","type": "text","primaryKey": false,"notNull": false},- "evidence": {- "name": "evidence",+ "editor_data": {+ "name": "editor_data","type": "jsonb","primaryKey": false,"notNull": false},- "changed_by_user_id": {- "name": "changed_by_user_id",+ "slug": {+ "name": "slug",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "text",+ "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",+ "primaryKey": false,+ "notNull": false+ },+ "is_deleted": {+ "name": "is_deleted",+ "type": "boolean",+ "primaryKey": false,"notNull": false},- "source_run_id": {- "name": "source_run_id",- "type": "uuid",- "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": {+ "documents_source_idx": {+ "name": "documents_source_idx",+ "columns": [+ {+ "expression": "source",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "documents_file_type_idx": {+ "name": "documents_file_type_idx",+ "columns": [+ {+ "expression": "file_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "documents_source_type_idx": {+ "name": "documents_source_type_idx",+ "columns": [+ {+ "expression": "source_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "documents_user_id_idx": {+ "name": "documents_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "documents_file_id_idx": {+ "name": "documents_file_id_idx",+ "columns": [+ {+ "expression": "file_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "documents_parent_id_idx": {+ "name": "documents_parent_id_idx",+ "columns": [+ {+ "expression": "parent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}},- "operation_id": {- "name": "operation_id",- "type": "text",- "primaryKey": false,- "notNull": false+ "documents_knowledge_base_id_idx": {+ "name": "documents_knowledge_base_id_idx",+ "columns": [+ {+ "expression": "knowledge_base_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}},- "created_at": {- "name": "created_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": true,- "default": "now()"- }- },- "indexes": {- "expertise_lesson_revisions_lesson_revision_unique": {- "name": "expertise_lesson_revisions_lesson_revision_unique",+ "documents_client_id_user_id_unique": {+ "name": "documents_client_id_user_id_unique","columns": [{- "expression": "lesson_id",+ "expression": "client_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "revision",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"@@ -17404,11 +21640,60 @@"method": "btree","with": {}},- "expertise_lesson_revisions_lesson_idx": {- "name": "expertise_lesson_revisions_lesson_idx",+ "documents_slug_user_id_unique": {+ "name": "documents_slug_user_id_unique","columns": [{- "expression": "lesson_id",+ "expression": "slug",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"documents\".\"workspace_id\" IS NULL AND \"documents\".\"slug\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "documents_workspace_id_idx": {+ "name": "documents_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "documents_workspace_visibility_idx": {+ "name": "documents_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"@@ -17418,35 +21703,75 @@"concurrently": false,"method": "btree","with": {}+ },+ "documents_slug_workspace_id_unique": {+ "name": "documents_slug_workspace_id_unique",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "slug",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"documents\".\"workspace_id\" is not null",+ "concurrently": false,+ "method": "btree",+ "with": {}}},"foreignKeys": {- "expertise_lesson_revisions_lesson_id_expertise_lessons_id_fk": {- "name": "expertise_lesson_revisions_lesson_id_expertise_lessons_id_fk",- "tableFrom": "expertise_lesson_revisions",- "tableTo": "expertise_lessons",- "columnsFrom": ["lesson_id"],+ "documents_file_id_files_id_fk": {+ "name": "documents_file_id_files_id_fk",+ "tableFrom": "documents",+ "tableTo": "files",+ "columnsFrom": ["file_id"],"columnsTo": ["id"],- "onDelete": "cascade",+ "onDelete": "set null","onUpdate": "no action"},- "expertise_lesson_revisions_changed_by_user_id_users_id_fk": {- "name": "expertise_lesson_revisions_changed_by_user_id_users_id_fk",- "tableFrom": "expertise_lesson_revisions",- "tableTo": "users",- "columnsFrom": ["changed_by_user_id"],+ "documents_knowledge_base_id_knowledge_bases_id_fk": {+ "name": "documents_knowledge_base_id_knowledge_bases_id_fk",+ "tableFrom": "documents",+ "tableTo": "knowledge_bases",+ "columnsFrom": ["knowledge_base_id"],"columnsTo": ["id"],"onDelete": "set null","onUpdate": "no action"},- "expertise_lesson_revisions_operation_id_agent_operations_id_fk": {- "name": "expertise_lesson_revisions_operation_id_agent_operations_id_fk",- "tableFrom": "expertise_lesson_revisions",- "tableTo": "agent_operations",- "columnsFrom": ["operation_id"],+ "documents_parent_id_documents_id_fk": {+ "name": "documents_parent_id_documents_id_fk",+ "tableFrom": "documents",+ "tableTo": "documents",+ "columnsFrom": ["parent_id"],"columnsTo": ["id"],"onDelete": "set null","onUpdate": "no action"+ },+ "documents_user_id_users_id_fk": {+ "name": "documents_user_id_users_id_fk",+ "tableFrom": "documents",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "documents_workspace_id_workspaces_id_fk": {+ "name": "documents_workspace_id_workspaces_id_fk",+ "tableFrom": "documents",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"}},"compositePrimaryKeys": {},@@ -17455,8 +21780,8 @@"checkConstraints": {},"isRLSEnabled": false},- "public.expertise_lessons": {- "name": "expertise_lessons",+ "public.file_uploads": {+ "name": "file_uploads","schema": "","columns": {"id": {@@ -17466,84 +21791,30 @@"notNull": true,"default": "gen_random_uuid()"},- "domain_id": {- "name": "domain_id",- "type": "varchar(255)",- "primaryKey": false,- "notNull": true- },- "created_by_user_id": {- "name": "created_by_user_id",+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,- "notNull": false- },- "code": {- "name": "code",- "type": "varchar(20)",- "primaryKey": false,"notNull": true},- "polarity": {- "name": "polarity",+ "workspace_id": {+ "name": "workspace_id","type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "title": {- "name": "title",+ "pathname": {+ "name": "pathname","type": "text","primaryKey": false,"notNull": true},- "sections": {- "name": "sections",- "type": "jsonb",+ "size": {+ "name": "size",+ "type": "integer","primaryKey": false,"notNull": true},- "layer": {- "name": "layer",- "type": "varchar(255)",- "primaryKey": false,- "notNull": false- },- "tags": {- "name": "tags",- "type": "text[]",- "primaryKey": false,- "notNull": false- },- "reason_kind": {- "name": "reason_kind",- "type": "text",- "primaryKey": false,- "notNull": false- },- "reason_source": {- "name": "reason_source",- "type": "text",- "primaryKey": false,- "notNull": false- },- "canon_anchor": {- "name": "canon_anchor",- "type": "text",- "primaryKey": false,- "notNull": false- },- "origin_run_id": {- "name": "origin_run_id",- "type": "uuid",- "primaryKey": false,- "notNull": false- },- "origin_hit_id": {- "name": "origin_hit_id",- "type": "uuid",- "primaryKey": false,- "notNull": false- },"status": {"name": "status","type": "text",@@ -17551,126 +21822,35 @@"notNull": true,"default": "'active'"},- "rejected_reason": {- "name": "rejected_reason",+ "multipart_upload_id": {+ "name": "multipart_upload_id","type": "text","primaryKey": false,"notNull": false},- "salvaged_from_id": {- "name": "salvaged_from_id",- "type": "uuid",- "primaryKey": false,- "notNull": false- },- "retired_at": {- "name": "retired_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": false- },- "sort_order": {- "name": "sort_order",+ "multipart_part_size": {+ "name": "multipart_part_size","type": "integer","primaryKey": false,"notNull": false},- "enforcement": {- "name": "enforcement",- "type": "text",- "primaryKey": false,- "notNull": false- },- "direction": {- "name": "direction",- "type": "text",- "primaryKey": false,- "notNull": false- },- "compilability": {- "name": "compilability",- "type": "text",- "primaryKey": false,- "notNull": true,- "default": "'compilable'"- },- "backtest": {- "name": "backtest",- "type": "jsonb",- "primaryKey": false,- "notNull": false- },- "compiled_criterion_id": {- "name": "compiled_criterion_id",- "type": "uuid",- "primaryKey": false,- "notNull": false- },- "hit_count": {- "name": "hit_count",- "type": "integer",- "primaryKey": false,- "notNull": true,- "default": 0- },- "hit_run_count": {- "name": "hit_run_count",- "type": "integer",- "primaryKey": false,- "notNull": true,- "default": 0- },- "false_positive_count": {- "name": "false_positive_count",- "type": "integer",- "primaryKey": false,- "notNull": true,- "default": 0- },- "last_hit_at": {- "name": "last_hit_at",+ "completed_at": {+ "name": "completed_at","type": "timestamp with time zone","primaryKey": false,"notNull": false},- "last_hit_run_id": {- "name": "last_hit_run_id",- "type": "uuid",- "primaryKey": false,- "notNull": false- },- "generalized_from_ids": {- "name": "generalized_from_ids",- "type": "jsonb",- "primaryKey": false,- "notNull": false- },- "specificity": {- "name": "specificity",+ "file_id": {+ "name": "file_id","type": "text","primaryKey": false,"notNull": false},- "example_count": {- "name": "example_count",- "type": "integer",- "primaryKey": false,- "notNull": true,- "default": 0- },- "current_revision": {- "name": "current_revision",- "type": "integer",- "primaryKey": false,- "notNull": true,- "default": 1- },- "accessed_at": {- "name": "accessed_at",+ "expires_at": {+ "name": "expires_at","type": "timestamp with time zone","primaryKey": false,- "notNull": true,- "default": "now()"+ "notNull": true},"created_at": {"name": "created_at",@@ -17688,36 +21868,57 @@}},"indexes": {- "expertise_lessons_domain_code_unique": {- "name": "expertise_lessons_domain_code_unique",+ "file_uploads_user_scope_status_idx": {+ "name": "file_uploads_user_scope_status_idx","columns": [{- "expression": "domain_id",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "code",+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "expertise_lessons_domain_status_hits_idx": {- "name": "expertise_lessons_domain_status_hits_idx",+ "file_uploads_workspace_status_idx": {+ "name": "file_uploads_workspace_status_idx","columns": [{- "expression": "domain_id",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"},+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "file_uploads_status_expires_at_idx": {+ "name": "file_uploads_status_expires_at_idx",+ "columns": [{"expression": "status","isExpression": false,@@ -17725,7 +21926,7 @@"nulls": "last"},{- "expression": "hit_count",+ "expression": "expires_at","isExpression": false,"asc": true,"nulls": "last"@@ -17736,17 +21937,23 @@"method": "btree","with": {}},- "expertise_lessons_domain_layer_idx": {- "name": "expertise_lessons_domain_layer_idx",+ "file_uploads_status_updated_at_id_idx": {+ "name": "file_uploads_status_updated_at_id_idx","columns": [{- "expression": "domain_id",+ "expression": "status","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "layer",+ "expression": "updated_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "id","isExpression": false,"asc": true,"nulls": "last"@@ -17757,154 +21964,137 @@"method": "btree","with": {}},- "expertise_lessons_compiled_criterion_idx": {- "name": "expertise_lessons_compiled_criterion_idx",+ "file_uploads_live_pathname_unique": {+ "name": "file_uploads_live_pathname_unique","columns": [{- "expression": "compiled_criterion_id",+ "expression": "pathname","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,+ "where": "\"file_uploads\".\"status\" IN ('active', 'cleaning')","concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "expertise_lessons_domain_id_expertise_domains_id_fk": {- "name": "expertise_lessons_domain_id_expertise_domains_id_fk",- "tableFrom": "expertise_lessons",- "tableTo": "expertise_domains",- "columnsFrom": ["domain_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "expertise_lessons_created_by_user_id_users_id_fk": {- "name": "expertise_lessons_created_by_user_id_users_id_fk",- "tableFrom": "expertise_lessons",+ "file_uploads_user_id_users_id_fk": {+ "name": "file_uploads_user_id_users_id_fk",+ "tableFrom": "file_uploads","tableTo": "users",- "columnsFrom": ["created_by_user_id"],+ "columnsFrom": ["user_id"],"columnsTo": ["id"],- "onDelete": "set null",+ "onDelete": "cascade","onUpdate": "no action"},- "expertise_lessons_salvaged_from_id_expertise_lessons_id_fk": {- "name": "expertise_lessons_salvaged_from_id_expertise_lessons_id_fk",- "tableFrom": "expertise_lessons",- "tableTo": "expertise_lessons",- "columnsFrom": ["salvaged_from_id"],+ "file_uploads_workspace_id_workspaces_id_fk": {+ "name": "file_uploads_workspace_id_workspaces_id_fk",+ "tableFrom": "file_uploads",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],"columnsTo": ["id"],- "onDelete": "set null",+ "onDelete": "cascade","onUpdate": "no action"},- "expertise_lessons_compiled_criterion_id_verify_criteria_id_fk": {- "name": "expertise_lessons_compiled_criterion_id_verify_criteria_id_fk",- "tableFrom": "expertise_lessons",- "tableTo": "verify_criteria",- "columnsFrom": ["compiled_criterion_id"],+ "file_uploads_file_id_files_id_fk": {+ "name": "file_uploads_file_id_files_id_fk",+ "tableFrom": "file_uploads",+ "tableTo": "files",+ "columnsFrom": ["file_id"],"columnsTo": ["id"],"onDelete": "set null","onUpdate": "no action"}},"compositePrimaryKeys": {},- "uniqueConstraints": {- "expertise_lessons_id_domain_unique": {- "name": "expertise_lessons_id_domain_unique",- "nullsNotDistinct": false,- "columns": ["id", "domain_id"]- }- },+ "uniqueConstraints": {},"policies": {},"checkConstraints": {},"isRLSEnabled": false},- "public.expertise_runs": {- "name": "expertise_runs",+ "public.files": {+ "name": "files","schema": "","columns": {"id": {"name": "id",- "type": "uuid",+ "type": "text","primaryKey": true,- "notNull": true,- "default": "gen_random_uuid()"+ "notNull": true},- "domain_id": {- "name": "domain_id",- "type": "varchar(255)",+ "user_id": {+ "name": "user_id",+ "type": "text","primaryKey": false,"notNull": true},- "run_index": {- "name": "run_index",- "type": "integer",+ "file_type": {+ "name": "file_type",+ "type": "varchar(255)","primaryKey": false,"notNull": true},- "is_seed_run": {- "name": "is_seed_run",- "type": "boolean",+ "file_hash": {+ "name": "file_hash",+ "type": "varchar(64)","primaryKey": false,- "notNull": true,- "default": false+ "notNull": false},- "actor_type": {- "name": "actor_type",+ "name": {+ "name": "name","type": "text","primaryKey": false,"notNull": true},- "actor_id": {- "name": "actor_id",- "type": "text",+ "size": {+ "name": "size",+ "type": "integer","primaryKey": false,"notNull": true},- "subject_type": {- "name": "subject_type",+ "url": {+ "name": "url","type": "text","primaryKey": false,"notNull": true},- "subject_id": {- "name": "subject_id",+ "source": {+ "name": "source","type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "window_start": {- "name": "window_start",- "type": "timestamp with time zone",+ "parent_id": {+ "name": "parent_id",+ "type": "varchar(255)","primaryKey": false,"notNull": false},- "window_end": {- "name": "window_end",- "type": "timestamp with time zone",+ "client_id": {+ "name": "client_id",+ "type": "text","primaryKey": false,"notNull": false},- "reflection_key": {- "name": "reflection_key",- "type": "varchar(255)",+ "metadata": {+ "name": "metadata",+ "type": "jsonb","primaryKey": false,"notNull": false},- "had_human_in_loop": {- "name": "had_human_in_loop",- "type": "boolean",+ "chunk_task_id": {+ "name": "chunk_task_id",+ "type": "uuid","primaryKey": false,- "notNull": true,- "default": false+ "notNull": false},- "user_id": {- "name": "user_id",- "type": "text",+ "embedding_task_id": {+ "name": "embedding_task_id",+ "type": "uuid","primaryKey": false,"notNull": false},@@ -17914,37 +22104,22 @@"primaryKey": false,"notNull": false},- "instance_count": {- "name": "instance_count",- "type": "integer",- "primaryKey": false,- "notNull": true,- "default": 0- },- "refine_count": {- "name": "refine_count",- "type": "integer",- "primaryKey": false,- "notNull": true,- "default": 0- },- "new_count": {- "name": "new_count",- "type": "integer",+ "visibility": {+ "name": "visibility",+ "type": "text","primaryKey": false,"notNull": true,- "default": 0+ "default": "'public'"},- "started_at": {- "name": "started_at",+ "deleted_at": {+ "name": "deleted_at","type": "timestamp with time zone","primaryKey": false,- "notNull": true,- "default": "now()"+ "notNull": false},- "completed_at": {- "name": "completed_at",- "type": "timestamp with time zone",+ "is_deleted": {+ "name": "is_deleted",+ "type": "boolean","primaryKey": false,"notNull": false},@@ -17971,60 +22146,71 @@}},"indexes": {- "expertise_runs_domain_run_index_unique": {- "name": "expertise_runs_domain_run_index_unique",+ "file_hash_idx": {+ "name": "file_hash_idx","columns": [{- "expression": "domain_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "run_index",+ "expression": "file_hash","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "expertise_runs_domain_reflection_key_unique": {- "name": "expertise_runs_domain_reflection_key_unique",+ "files_user_id_idx": {+ "name": "files_user_id_idx","columns": [{- "expression": "domain_id",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "files_parent_id_idx": {+ "name": "files_parent_id_idx",+ "columns": [{- "expression": "reflection_key",+ "expression": "parent_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,- "where": "\"expertise_runs\".\"reflection_key\" is not null",+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "expertise_runs_domain_started_idx": {- "name": "expertise_runs_domain_started_idx",+ "files_chunk_task_id_idx": {+ "name": "files_chunk_task_id_idx","columns": [{- "expression": "domain_id",+ "expression": "chunk_task_id","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "files_embedding_task_id_idx": {+ "name": "files_embedding_task_id_idx",+ "columns": [{- "expression": "started_at",+ "expression": "embedding_task_id","isExpression": false,"asc": true,"nulls": "last"@@ -18035,17 +22221,32 @@"method": "btree","with": {}},- "expertise_runs_actor_idx": {- "name": "expertise_runs_actor_idx",+ "files_client_id_user_id_unique": {+ "name": "files_client_id_user_id_unique","columns": [{- "expression": "actor_type",+ "expression": "client_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "actor_id",+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "files_workspace_id_idx": {+ "name": "files_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"@@ -18056,17 +22257,23 @@"method": "btree","with": {}},- "expertise_runs_subject_idx": {- "name": "expertise_runs_subject_idx",+ "files_workspace_visibility_idx": {+ "name": "files_workspace_visibility_idx","columns": [{- "expression": "subject_type",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "subject_id",+ "expression": "visibility",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"@@ -18079,27 +22286,54 @@}},"foreignKeys": {- "expertise_runs_domain_id_expertise_domains_id_fk": {- "name": "expertise_runs_domain_id_expertise_domains_id_fk",- "tableFrom": "expertise_runs",- "tableTo": "expertise_domains",- "columnsFrom": ["domain_id"],+ "files_user_id_users_id_fk": {+ "name": "files_user_id_users_id_fk",+ "tableFrom": "files",+ "tableTo": "users",+ "columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "expertise_runs_user_id_users_id_fk": {- "name": "expertise_runs_user_id_users_id_fk",- "tableFrom": "expertise_runs",- "tableTo": "users",- "columnsFrom": ["user_id"],+ "files_file_hash_global_files_hash_id_fk": {+ "name": "files_file_hash_global_files_hash_id_fk",+ "tableFrom": "files",+ "tableTo": "global_files",+ "columnsFrom": ["file_hash"],+ "columnsTo": ["hash_id"],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "files_parent_id_documents_id_fk": {+ "name": "files_parent_id_documents_id_fk",+ "tableFrom": "files",+ "tableTo": "documents",+ "columnsFrom": ["parent_id"],"columnsTo": ["id"],"onDelete": "set null","onUpdate": "no action"},- "expertise_runs_workspace_id_workspaces_id_fk": {- "name": "expertise_runs_workspace_id_workspaces_id_fk",- "tableFrom": "expertise_runs",+ "files_chunk_task_id_async_tasks_id_fk": {+ "name": "files_chunk_task_id_async_tasks_id_fk",+ "tableFrom": "files",+ "tableTo": "async_tasks",+ "columnsFrom": ["chunk_task_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "files_embedding_task_id_async_tasks_id_fk": {+ "name": "files_embedding_task_id_async_tasks_id_fk",+ "tableFrom": "files",+ "tableTo": "async_tasks",+ "columnsFrom": ["embedding_task_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "files_workspace_id_workspaces_id_fk": {+ "name": "files_workspace_id_workspaces_id_fk",+ "tableFrom": "files","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],@@ -18108,167 +22342,172 @@}},"compositePrimaryKeys": {},- "uniqueConstraints": {- "expertise_runs_id_domain_unique": {- "name": "expertise_runs_id_domain_unique",- "nullsNotDistinct": false,- "columns": ["id", "domain_id"]- }- },+ "uniqueConstraints": {},"policies": {},"checkConstraints": {},"isRLSEnabled": false},- "public.user_favorites": {- "name": "user_favorites",+ "public.global_files": {+ "name": "global_files","schema": "","columns": {- "id": {- "name": "id",- "type": "uuid",+ "hash_id": {+ "name": "hash_id",+ "type": "varchar(64)","primaryKey": true,- "notNull": true,- "default": "gen_random_uuid()"+ "notNull": true},- "user_id": {- "name": "user_id",- "type": "text",+ "file_type": {+ "name": "file_type",+ "type": "varchar(255)","primaryKey": false,"notNull": true},- "workspace_id": {- "name": "workspace_id",+ "size": {+ "name": "size",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "url": {+ "name": "url","type": "text","primaryKey": false,+ "notNull": true+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,"notNull": false},- "type": {- "name": "type",+ "creator": {+ "name": "creator","type": "text","primaryKey": false,"notNull": true},- "target_id": {- "name": "target_id",+ "created_at": {+ "name": "created_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()"+ }+ },+ "indexes": {+ "global_files_creator_idx": {+ "name": "global_files_creator_idx",+ "columns": [+ {+ "expression": "creator",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "global_files_creator_users_id_fk": {+ "name": "global_files_creator_users_id_fk",+ "tableFrom": "global_files",+ "tableTo": "users",+ "columnsFrom": ["creator"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.knowledge_base_files": {+ "name": "knowledge_base_files",+ "schema": "",+ "columns": {+ "knowledge_base_id": {+ "name": "knowledge_base_id","type": "text","primaryKey": false,"notNull": true},- "path": {- "name": "path",+ "file_id": {+ "name": "file_id","type": "text","primaryKey": false,"notNull": true},- "title": {- "name": "title",+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,"notNull": true},- "icon": {- "name": "icon",+ "workspace_id": {+ "name": "workspace_id","type": "text","primaryKey": false,"notNull": false},- "sort_order": {- "name": "sort_order",- "type": "integer",- "primaryKey": 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": {- "user_favorites_personal_target_unique": {- "name": "user_favorites_personal_target_unique",+ "knowledge_base_files_kb_id_idx": {+ "name": "knowledge_base_files_kb_id_idx","columns": [{- "expression": "user_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "type",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "target_id",+ "expression": "knowledge_base_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,- "where": "\"user_favorites\".\"workspace_id\" IS NULL",+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "user_favorites_workspace_target_unique": {- "name": "user_favorites_workspace_target_unique",+ "knowledge_base_files_user_id_idx": {+ "name": "knowledge_base_files_user_id_idx","columns": [{"expression": "user_id","isExpression": false,"asc": true,"nulls": "last"- },- {- "expression": "workspace_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "type",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "target_id",- "isExpression": false,- "asc": true,- "nulls": "last"}],- "isUnique": true,- "where": "\"user_favorites\".\"workspace_id\" IS NOT NULL",+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "user_favorites_user_id_idx": {- "name": "user_favorites_user_id_idx",+ "knowledge_base_files_file_id_idx": {+ "name": "knowledge_base_files_file_id_idx","columns": [{- "expression": "user_id",+ "expression": "file_id","isExpression": false,"asc": true,"nulls": "last"@@ -18279,8 +22518,8 @@"method": "btree","with": {}},- "user_favorites_workspace_id_idx": {- "name": "user_favorites_workspace_id_idx",+ "knowledge_base_files_workspace_id_idx": {+ "name": "knowledge_base_files_workspace_id_idx","columns": [{"expression": "workspace_id",@@ -18296,122 +22535,85 @@}},"foreignKeys": {- "user_favorites_user_id_users_id_fk": {- "name": "user_favorites_user_id_users_id_fk",- "tableFrom": "user_favorites",- "tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "user_favorites_workspace_id_workspaces_id_fk": {- "name": "user_favorites_workspace_id_workspaces_id_fk",- "tableFrom": "user_favorites",- "tableTo": "workspaces",- "columnsFrom": ["workspace_id"],+ "knowledge_base_files_knowledge_base_id_knowledge_bases_id_fk": {+ "name": "knowledge_base_files_knowledge_base_id_knowledge_bases_id_fk",+ "tableFrom": "knowledge_base_files",+ "tableTo": "knowledge_bases",+ "columnsFrom": ["knowledge_base_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"- }- },- "compositePrimaryKeys": {},- "uniqueConstraints": {},- "policies": {},- "checkConstraints": {},- "isRLSEnabled": false- },- "public.documents": {- "name": "documents",- "schema": "",- "columns": {- "id": {- "name": "id",- "type": "varchar(255)",- "primaryKey": true,- "notNull": true- },- "title": {- "name": "title",- "type": "text",- "primaryKey": false,- "notNull": false- },- "description": {- "name": "description",- "type": "text",- "primaryKey": false,- "notNull": false- },- "content": {- "name": "content",- "type": "text",- "primaryKey": false,- "notNull": false- },- "file_type": {- "name": "file_type",- "type": "varchar(255)",- "primaryKey": false,- "notNull": true- },- "filename": {- "name": "filename",- "type": "text",- "primaryKey": false,- "notNull": false- },- "total_char_count": {- "name": "total_char_count",- "type": "integer",- "primaryKey": false,- "notNull": true- },- "total_line_count": {- "name": "total_line_count",- "type": "integer",- "primaryKey": false,- "notNull": true},- "metadata": {- "name": "metadata",- "type": "jsonb",- "primaryKey": false,- "notNull": false+ "knowledge_base_files_file_id_files_id_fk": {+ "name": "knowledge_base_files_file_id_files_id_fk",+ "tableFrom": "knowledge_base_files",+ "tableTo": "files",+ "columnsFrom": ["file_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"},- "pages": {- "name": "pages",- "type": "jsonb",- "primaryKey": false,- "notNull": false+ "knowledge_base_files_user_id_users_id_fk": {+ "name": "knowledge_base_files_user_id_users_id_fk",+ "tableFrom": "knowledge_base_files",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"},- "source_type": {- "name": "source_type",+ "knowledge_base_files_workspace_id_workspaces_id_fk": {+ "name": "knowledge_base_files_workspace_id_workspaces_id_fk",+ "tableFrom": "knowledge_base_files",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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"]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.knowledge_bases": {+ "name": "knowledge_bases",+ "schema": "",+ "columns": {+ "id": {+ "name": "id","type": "text",- "primaryKey": false,+ "primaryKey": true,"notNull": true},- "source": {- "name": "source",+ "name": {+ "name": "name","type": "text","primaryKey": false,"notNull": true},- "file_id": {- "name": "file_id",+ "description": {+ "name": "description","type": "text","primaryKey": false,"notNull": false},- "knowledge_base_id": {- "name": "knowledge_base_id",+ "avatar": {+ "name": "avatar","type": "text","primaryKey": false,"notNull": false},- "parent_id": {- "name": "parent_id",- "type": "varchar(255)",+ "type": {+ "name": "type",+ "type": "text","primaryKey": false,"notNull": false},@@ -18427,15 +22629,16 @@"primaryKey": false,"notNull": false},- "editor_data": {- "name": "editor_data",- "type": "jsonb",+ "is_public": {+ "name": "is_public",+ "type": "boolean","primaryKey": false,- "notNull": false+ "notNull": false,+ "default": false},- "slug": {- "name": "slug",- "type": "varchar(255)",+ "settings": {+ "name": "settings",+ "type": "jsonb","primaryKey": false,"notNull": false},@@ -18487,41 +22690,32 @@}},"indexes": {- "documents_source_idx": {- "name": "documents_source_idx",+ "knowledge_bases_client_id_user_id_unique": {+ "name": "knowledge_bases_client_id_user_id_unique","columns": [{- "expression": "source",+ "expression": "client_id","isExpression": false,"asc": true,"nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "documents_file_type_idx": {- "name": "documents_file_type_idx",- "columns": [+ },{- "expression": "file_type",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,"concurrently": false,"method": "btree","with": {}},- "documents_source_type_idx": {- "name": "documents_source_type_idx",+ "knowledge_bases_user_id_idx": {+ "name": "knowledge_bases_user_id_idx","columns": [{- "expression": "source_type",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"@@ -18532,11 +22726,11 @@"method": "btree","with": {}},- "documents_user_id_idx": {- "name": "documents_user_id_idx",+ "knowledge_bases_workspace_id_idx": {+ "name": "knowledge_bases_workspace_id_idx","columns": [{- "expression": "user_id",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"@@ -18547,11 +22741,23 @@"method": "btree","with": {}},- "documents_file_id_idx": {- "name": "documents_file_id_idx",+ "knowledge_bases_workspace_visibility_idx": {+ "name": "knowledge_bases_workspace_visibility_idx","columns": [{- "expression": "file_id",+ "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"@@ -18561,27 +22767,131 @@"concurrently": false,"method": "btree","with": {}+ }+ },+ "foreignKeys": {+ "knowledge_bases_user_id_users_id_fk": {+ "name": "knowledge_bases_user_id_users_id_fk",+ "tableFrom": "knowledge_bases",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"},- "documents_parent_id_idx": {- "name": "documents_parent_id_idx",+ "knowledge_bases_workspace_id_workspaces_id_fk": {+ "name": "knowledge_bases_workspace_id_workspaces_id_fk",+ "tableFrom": "knowledge_bases",+ "tableTo": "workspaces",+ "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": "parent_id",+ "expression": "file_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,"concurrently": false,"method": "btree","with": {}},- "documents_knowledge_base_id_idx": {- "name": "documents_knowledge_base_id_idx",+ "file_shares_user_id_idx": {+ "name": "file_shares_user_id_idx","columns": [{- "expression": "knowledge_base_id",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"@@ -18592,177 +22902,265 @@"method": "btree","with": {}},- "documents_client_id_user_id_unique": {- "name": "documents_client_id_user_id_unique",+ "file_shares_workspace_id_idx": {+ "name": "file_shares_workspace_id_idx","columns": [{- "expression": "client_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "user_id",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,+ "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"},- "documents_slug_user_id_unique": {- "name": "documents_slug_user_id_unique",+ "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"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.fts_search_sync_capture_version": {+ "name": "fts_search_sync_capture_version",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "version": {+ "name": "version",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.fts_search_sync_outbox": {+ "name": "fts_search_sync_outbox",+ "schema": "",+ "columns": {+ "attempts": {+ "name": "attempts",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "available_at": {+ "name": "available_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()"+ },+ "dead_at": {+ "name": "dead_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "document_id": {+ "name": "document_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "entity": {+ "name": "entity",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "last_error": {+ "name": "last_error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "locked_until": {+ "name": "locked_until",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "priority": {+ "name": "priority",+ "type": "smallint",+ "primaryKey": false,+ "notNull": true,+ "default": 10+ },+ "revision": {+ "name": "revision",+ "type": "bigint",+ "primaryKey": false,+ "notNull": true,+ "default": "nextval('fts_search_sync_revision_seq')"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "fts_search_sync_outbox_entity_document_id_unique": {+ "name": "fts_search_sync_outbox_entity_document_id_unique","columns": [{- "expression": "slug",+ "expression": "entity","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "user_id",+ "expression": "document_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": true,- "where": "\"documents\".\"workspace_id\" IS NULL AND \"documents\".\"slug\" IS NOT NULL",- "concurrently": false,- "method": "btree",- "with": {}- },- "documents_workspace_id_idx": {- "name": "documents_workspace_id_idx",- "columns": [- {- "expression": "workspace_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "documents_workspace_visibility_idx": {- "name": "documents_workspace_visibility_idx",+ "fts_search_sync_outbox_claim_idx": {+ "name": "fts_search_sync_outbox_claim_idx","columns": [{- "expression": "workspace_id",+ "expression": "priority","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "visibility",+ "expression": "available_at","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "user_id",+ "expression": "revision","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,+ "where": "\"fts_search_sync_outbox\".\"dead_at\" IS NULL","concurrently": false,"method": "btree","with": {}},- "documents_slug_workspace_id_unique": {- "name": "documents_slug_workspace_id_unique",+ "fts_search_sync_outbox_dead_idx": {+ "name": "fts_search_sync_outbox_dead_idx","columns": [{- "expression": "workspace_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "slug",+ "expression": "dead_at","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,- "where": "\"documents\".\"workspace_id\" is not null",+ "isUnique": false,+ "where": "\"fts_search_sync_outbox\".\"dead_at\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "fts_search_sync_outbox_lease_idx": {+ "name": "fts_search_sync_outbox_lease_idx",+ "columns": [+ {+ "expression": "locked_until",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"fts_search_sync_outbox\".\"dead_at\" IS NULL AND \"fts_search_sync_outbox\".\"locked_until\" IS NOT NULL","concurrently": false,"method": "btree","with": {}}},- "foreignKeys": {- "documents_file_id_files_id_fk": {- "name": "documents_file_id_files_id_fk",- "tableFrom": "documents",- "tableTo": "files",- "columnsFrom": ["file_id"],- "columnsTo": ["id"],- "onDelete": "set null",- "onUpdate": "no action"- },- "documents_knowledge_base_id_knowledge_bases_id_fk": {- "name": "documents_knowledge_base_id_knowledge_bases_id_fk",- "tableFrom": "documents",- "tableTo": "knowledge_bases",- "columnsFrom": ["knowledge_base_id"],- "columnsTo": ["id"],- "onDelete": "set null",- "onUpdate": "no action"- },- "documents_parent_id_documents_id_fk": {- "name": "documents_parent_id_documents_id_fk",- "tableFrom": "documents",- "tableTo": "documents",- "columnsFrom": ["parent_id"],- "columnsTo": ["id"],- "onDelete": "set null",- "onUpdate": "no action"- },- "documents_user_id_users_id_fk": {- "name": "documents_user_id_users_id_fk",- "tableFrom": "documents",- "tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "documents_workspace_id_workspaces_id_fk": {- "name": "documents_workspace_id_workspaces_id_fk",- "tableFrom": "documents",- "tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- }- },+ "foreignKeys": {},"compositePrimaryKeys": {},"uniqueConstraints": {},"policies": {},"checkConstraints": {},"isRLSEnabled": false},- "public.file_uploads": {- "name": "file_uploads",+ "public.generation_batches": {+ "name": "generation_batches","schema": "","columns": {"id": {"name": "id",- "type": "uuid",+ "type": "text","primaryKey": true,- "notNull": true,- "default": "gen_random_uuid()"+ "notNull": true},"user_id": {"name": "user_id",@@ -18776,54 +23174,72 @@"primaryKey": false,"notNull": false},- "pathname": {- "name": "pathname",+ "generation_topic_id": {+ "name": "generation_topic_id","type": "text","primaryKey": false,"notNull": true},- "size": {- "name": "size",- "type": "integer",+ "provider": {+ "name": "provider",+ "type": "text","primaryKey": false,"notNull": true},- "status": {- "name": "status",+ "model": {+ "name": "model","type": "text","primaryKey": false,- "notNull": true,- "default": "'active'"+ "notNull": true},- "multipart_upload_id": {- "name": "multipart_upload_id",+ "prompt": {+ "name": "prompt","type": "text","primaryKey": false,+ "notNull": true+ },+ "width": {+ "name": "width",+ "type": "integer",+ "primaryKey": false,"notNull": false},- "multipart_part_size": {- "name": "multipart_part_size",+ "height": {+ "name": "height","type": "integer","primaryKey": false,"notNull": false},- "completed_at": {- "name": "completed_at",+ "ratio": {+ "name": "ratio",+ "type": "varchar(64)",+ "primaryKey": false,+ "notNull": false+ },+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "deleted_at": {+ "name": "deleted_at","type": "timestamp with time zone","primaryKey": false,"notNull": false},- "file_id": {- "name": "file_id",- "type": "text",+ "is_deleted": {+ "name": "is_deleted",+ "type": "boolean","primaryKey": false,"notNull": false},- "expires_at": {- "name": "expires_at",+ "accessed_at": {+ "name": "accessed_at","type": "timestamp with time zone","primaryKey": false,- "notNull": true+ "notNull": true,+ "default": "now()"},"created_at": {"name": "created_at",@@ -18841,47 +23257,14 @@}},"indexes": {- "file_uploads_user_scope_status_idx": {- "name": "file_uploads_user_scope_status_idx",+ "generation_batches_user_id_idx": {+ "name": "generation_batches_user_id_idx","columns": [{"expression": "user_id","isExpression": false,"asc": true,"nulls": "last"- },- {- "expression": "workspace_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "status",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "file_uploads_workspace_status_idx": {- "name": "file_uploads_workspace_status_idx",- "columns": [- {- "expression": "workspace_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "status",- "isExpression": false,- "asc": true,- "nulls": "last"}],"isUnique": false,@@ -18889,17 +23272,11 @@"method": "btree","with": {}},- "file_uploads_status_expires_at_idx": {- "name": "file_uploads_status_expires_at_idx",+ "generation_batches_topic_id_idx": {+ "name": "generation_batches_topic_id_idx","columns": [{- "expression": "status",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "expires_at",+ "expression": "generation_topic_id","isExpression": false,"asc": true,"nulls": "last"@@ -18910,23 +23287,11 @@"method": "btree","with": {}},- "file_uploads_status_updated_at_id_idx": {- "name": "file_uploads_status_updated_at_id_idx",+ "generation_batches_workspace_id_idx": {+ "name": "generation_batches_workspace_id_idx","columns": [{- "expression": "status",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "updated_at",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "id",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"@@ -18936,50 +23301,34 @@"concurrently": false,"method": "btree","with": {}- },- "file_uploads_live_pathname_unique": {- "name": "file_uploads_live_pathname_unique",- "columns": [- {- "expression": "pathname",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": true,- "where": "\"file_uploads\".\"status\" IN ('active', 'cleaning')",- "concurrently": false,- "method": "btree",- "with": {}}},"foreignKeys": {- "file_uploads_user_id_users_id_fk": {- "name": "file_uploads_user_id_users_id_fk",- "tableFrom": "file_uploads",+ "generation_batches_user_id_users_id_fk": {+ "name": "generation_batches_user_id_users_id_fk",+ "tableFrom": "generation_batches","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "file_uploads_workspace_id_workspaces_id_fk": {- "name": "file_uploads_workspace_id_workspaces_id_fk",- "tableFrom": "file_uploads",+ "generation_batches_workspace_id_workspaces_id_fk": {+ "name": "generation_batches_workspace_id_workspaces_id_fk",+ "tableFrom": "generation_batches","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "file_uploads_file_id_files_id_fk": {- "name": "file_uploads_file_id_files_id_fk",- "tableFrom": "file_uploads",- "tableTo": "files",- "columnsFrom": ["file_id"],+ "generation_batches_generation_topic_id_generation_topics_id_fk": {+ "name": "generation_batches_generation_topic_id_generation_topics_id_fk",+ "tableFrom": "generation_batches",+ "tableTo": "generation_topics",+ "columnsFrom": ["generation_topic_id"],"columnsTo": ["id"],- "onDelete": "set null",+ "onDelete": "cascade","onUpdate": "no action"}},@@ -18989,8 +23338,8 @@"checkConstraints": {},"isRLSEnabled": false},- "public.files": {- "name": "files",+ "public.generation_topics": {+ "name": "generation_topics","schema": "","columns": {"id": {@@ -19005,77 +23354,30 @@"primaryKey": false,"notNull": true},- "file_type": {- "name": "file_type",- "type": "varchar(255)",- "primaryKey": false,- "notNull": true- },- "file_hash": {- "name": "file_hash",- "type": "varchar(64)",- "primaryKey": false,- "notNull": false- },- "name": {- "name": "name",- "type": "text",- "primaryKey": false,- "notNull": true- },- "size": {- "name": "size",- "type": "integer",- "primaryKey": false,- "notNull": true- },- "url": {- "name": "url",- "type": "text",- "primaryKey": false,- "notNull": true- },- "source": {- "name": "source",+ "workspace_id": {+ "name": "workspace_id","type": "text","primaryKey": false,"notNull": false},- "parent_id": {- "name": "parent_id",- "type": "varchar(255)",- "primaryKey": false,- "notNull": false- },- "client_id": {- "name": "client_id",+ "title": {+ "name": "title","type": "text","primaryKey": false,"notNull": false},- "metadata": {- "name": "metadata",- "type": "jsonb",- "primaryKey": false,- "notNull": false- },- "chunk_task_id": {- "name": "chunk_task_id",- "type": "uuid",- "primaryKey": false,- "notNull": false- },- "embedding_task_id": {- "name": "embedding_task_id",- "type": "uuid",+ "cover_url": {+ "name": "cover_url",+ "type": "text","primaryKey": false,"notNull": false},- "workspace_id": {- "name": "workspace_id",- "type": "text",+ "type": {+ "name": "type",+ "type": "varchar(32)","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "'image'"},"visibility": {"name": "visibility",@@ -19119,23 +23421,8 @@}},"indexes": {- "file_hash_idx": {- "name": "file_hash_idx",- "columns": [- {- "expression": "file_hash",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "files_user_id_idx": {- "name": "files_user_id_idx",+ "generation_topics_user_id_idx": {+ "name": "generation_topics_user_id_idx","columns": [{"expression": "user_id",@@ -19149,74 +23436,8 @@"method": "btree","with": {}},- "files_parent_id_idx": {- "name": "files_parent_id_idx",- "columns": [- {- "expression": "parent_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "files_chunk_task_id_idx": {- "name": "files_chunk_task_id_idx",- "columns": [- {- "expression": "chunk_task_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "files_embedding_task_id_idx": {- "name": "files_embedding_task_id_idx",- "columns": [- {- "expression": "embedding_task_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "files_client_id_user_id_unique": {- "name": "files_client_id_user_id_unique",- "columns": [- {- "expression": "client_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "user_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": true,- "concurrently": false,- "method": "btree",- "with": {}- },- "files_workspace_id_idx": {- "name": "files_workspace_id_idx",+ "generation_topics_workspace_id_idx": {+ "name": "generation_topics_workspace_id_idx","columns": [{"expression": "workspace_id",@@ -19230,8 +23451,8 @@"method": "btree","with": {}},- "files_workspace_visibility_idx": {- "name": "files_workspace_visibility_idx",+ "generation_topics_workspace_visibility_idx": {+ "name": "generation_topics_workspace_visibility_idx","columns": [{"expression": "workspace_id",@@ -19259,54 +23480,18 @@}},"foreignKeys": {- "files_user_id_users_id_fk": {- "name": "files_user_id_users_id_fk",- "tableFrom": "files",+ "generation_topics_user_id_users_id_fk": {+ "name": "generation_topics_user_id_users_id_fk",+ "tableFrom": "generation_topics","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "files_file_hash_global_files_hash_id_fk": {- "name": "files_file_hash_global_files_hash_id_fk",- "tableFrom": "files",- "tableTo": "global_files",- "columnsFrom": ["file_hash"],- "columnsTo": ["hash_id"],- "onDelete": "no action",- "onUpdate": "no action"- },- "files_parent_id_documents_id_fk": {- "name": "files_parent_id_documents_id_fk",- "tableFrom": "files",- "tableTo": "documents",- "columnsFrom": ["parent_id"],- "columnsTo": ["id"],- "onDelete": "set null",- "onUpdate": "no action"- },- "files_chunk_task_id_async_tasks_id_fk": {- "name": "files_chunk_task_id_async_tasks_id_fk",- "tableFrom": "files",- "tableTo": "async_tasks",- "columnsFrom": ["chunk_task_id"],- "columnsTo": ["id"],- "onDelete": "set null",- "onUpdate": "no action"- },- "files_embedding_task_id_async_tasks_id_fk": {- "name": "files_embedding_task_id_async_tasks_id_fk",- "tableFrom": "files",- "tableTo": "async_tasks",- "columnsFrom": ["embedding_task_id"],- "columnsTo": ["id"],- "onDelete": "set null",- "onUpdate": "no action"- },- "files_workspace_id_workspaces_id_fk": {- "name": "files_workspace_id_workspaces_id_fk",- "tableFrom": "files",+ "generation_topics_workspace_id_workspaces_id_fk": {+ "name": "generation_topics_workspace_id_workspaces_id_fk",+ "tableFrom": "generation_topics","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],@@ -19320,122 +23505,76 @@"checkConstraints": {},"isRLSEnabled": false},- "public.global_files": {- "name": "global_files",+ "public.generations": {+ "name": "generations","schema": "","columns": {- "hash_id": {- "name": "hash_id",- "type": "varchar(64)",+ "id": {+ "name": "id",+ "type": "text","primaryKey": true,"notNull": true},- "file_type": {- "name": "file_type",- "type": "varchar(255)",+ "user_id": {+ "name": "user_id",+ "type": "text","primaryKey": false,"notNull": true},- "size": {- "name": "size",- "type": "integer",+ "workspace_id": {+ "name": "workspace_id",+ "type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "url": {- "name": "url",- "type": "text",+ "generation_batch_id": {+ "name": "generation_batch_id",+ "type": "varchar(64)","primaryKey": false,"notNull": true},- "metadata": {- "name": "metadata",- "type": "jsonb",+ "async_task_id": {+ "name": "async_task_id",+ "type": "uuid","primaryKey": false,"notNull": false},- "creator": {- "name": "creator",+ "file_id": {+ "name": "file_id","type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "created_at": {- "name": "created_at",- "type": "timestamp with time zone",+ "seed": {+ "name": "seed",+ "type": "integer","primaryKey": false,- "notNull": true,- "default": "now()"+ "notNull": false},- "accessed_at": {- "name": "accessed_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": true,- "default": "now()"- }- },- "indexes": {- "global_files_creator_idx": {- "name": "global_files_creator_idx",- "columns": [- {- "expression": "creator",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- }- },- "foreignKeys": {- "global_files_creator_users_id_fk": {- "name": "global_files_creator_users_id_fk",- "tableFrom": "global_files",- "tableTo": "users",- "columnsFrom": ["creator"],- "columnsTo": ["id"],- "onDelete": "set null",- "onUpdate": "no action"- }- },- "compositePrimaryKeys": {},- "uniqueConstraints": {},- "policies": {},- "checkConstraints": {},- "isRLSEnabled": false- },- "public.knowledge_base_files": {- "name": "knowledge_base_files",- "schema": "",- "columns": {- "knowledge_base_id": {- "name": "knowledge_base_id",- "type": "text",+ "asset": {+ "name": "asset",+ "type": "jsonb","primaryKey": false,- "notNull": true+ "notNull": false},- "file_id": {- "name": "file_id",- "type": "text",+ "deleted_at": {+ "name": "deleted_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": true+ "notNull": false},- "user_id": {- "name": "user_id",- "type": "text",+ "is_deleted": {+ "name": "is_deleted",+ "type": "boolean","primaryKey": false,- "notNull": true+ "notNull": false},- "workspace_id": {- "name": "workspace_id",- "type": "text",+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "now()"},"created_at": {"name": "created_at",@@ -19443,14 +23582,21 @@"primaryKey": false,"notNull": true,"default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"}},"indexes": {- "knowledge_base_files_kb_id_idx": {- "name": "knowledge_base_files_kb_id_idx",+ "generations_user_id_idx": {+ "name": "generations_user_id_idx","columns": [{- "expression": "knowledge_base_id",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"@@ -19461,11 +23607,11 @@"method": "btree","with": {}},- "knowledge_base_files_user_id_idx": {- "name": "knowledge_base_files_user_id_idx",+ "generations_batch_id_idx": {+ "name": "generations_batch_id_idx","columns": [{- "expression": "user_id",+ "expression": "generation_batch_id","isExpression": false,"asc": true,"nulls": "last"@@ -19476,8 +23622,8 @@"method": "btree","with": {}},- "knowledge_base_files_file_id_idx": {- "name": "knowledge_base_files_file_id_idx",+ "generations_file_id_idx": {+ "name": "generations_file_id_idx","columns": [{"expression": "file_id",@@ -19491,8 +23637,8 @@"method": "btree","with": {}},- "knowledge_base_files_workspace_id_idx": {- "name": "knowledge_base_files_workspace_id_idx",+ "generations_workspace_id_idx": {+ "name": "generations_workspace_id_idx","columns": [{"expression": "workspace_id",@@ -19508,56 +23654,60 @@}},"foreignKeys": {- "knowledge_base_files_knowledge_base_id_knowledge_bases_id_fk": {- "name": "knowledge_base_files_knowledge_base_id_knowledge_bases_id_fk",- "tableFrom": "knowledge_base_files",- "tableTo": "knowledge_bases",- "columnsFrom": ["knowledge_base_id"],+ "generations_user_id_users_id_fk": {+ "name": "generations_user_id_users_id_fk",+ "tableFrom": "generations",+ "tableTo": "users",+ "columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "knowledge_base_files_file_id_files_id_fk": {- "name": "knowledge_base_files_file_id_files_id_fk",- "tableFrom": "knowledge_base_files",- "tableTo": "files",- "columnsFrom": ["file_id"],+ "generations_workspace_id_workspaces_id_fk": {+ "name": "generations_workspace_id_workspaces_id_fk",+ "tableFrom": "generations",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "knowledge_base_files_user_id_users_id_fk": {- "name": "knowledge_base_files_user_id_users_id_fk",- "tableFrom": "knowledge_base_files",- "tableTo": "users",- "columnsFrom": ["user_id"],+ "generations_generation_batch_id_generation_batches_id_fk": {+ "name": "generations_generation_batch_id_generation_batches_id_fk",+ "tableFrom": "generations",+ "tableTo": "generation_batches",+ "columnsFrom": ["generation_batch_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "knowledge_base_files_workspace_id_workspaces_id_fk": {- "name": "knowledge_base_files_workspace_id_workspaces_id_fk",- "tableFrom": "knowledge_base_files",- "tableTo": "workspaces",- "columnsFrom": ["workspace_id"],+ "generations_async_task_id_async_tasks_id_fk": {+ "name": "generations_async_task_id_async_tasks_id_fk",+ "tableFrom": "generations",+ "tableTo": "async_tasks",+ "columnsFrom": ["async_task_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "generations_file_id_files_id_fk": {+ "name": "generations_file_id_files_id_fk",+ "tableFrom": "generations",+ "tableTo": "files",+ "columnsFrom": ["file_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"}},- "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"]- }- },+ "compositePrimaryKeys": {},"uniqueConstraints": {},"policies": {},"checkConstraints": {},"isRLSEnabled": false},- "public.knowledge_bases": {- "name": "knowledge_bases",+ "public.goals": {+ "name": "goals","schema": "","columns": {"id": {@@ -19566,61 +23716,97 @@"primaryKey": true,"notNull": true},- "name": {- "name": "name",+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,"notNull": true},- "description": {- "name": "description",+ "workspace_id": {+ "name": "workspace_id","type": "text","primaryKey": false,"notNull": false},- "avatar": {- "name": "avatar",+ "agent_id": {+ "name": "agent_id","type": "text","primaryKey": false,"notNull": false},- "type": {- "name": "type",+ "project_id": {+ "name": "project_id","type": "text","primaryKey": false,"notNull": false},- "user_id": {- "name": "user_id",+ "title": {+ "name": "title","type": "text","primaryKey": false,"notNull": true},- "client_id": {- "name": "client_id",+ "requirement": {+ "name": "requirement","type": "text","primaryKey": false,"notNull": false},- "is_public": {- "name": "is_public",- "type": "boolean",+ "config": {+ "name": "config",+ "type": "jsonb","primaryKey": false,- "notNull": false,- "default": false+ "notNull": false},- "settings": {- "name": "settings",- "type": "jsonb",+ "max_rounds": {+ "name": "max_rounds",+ "type": "integer","primaryKey": false,"notNull": false},- "workspace_id": {- "name": "workspace_id",+ "max_total_cost": {+ "name": "max_total_cost",+ "type": "numeric(20, 6)",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'planning'"+ },+ "subject_type": {+ "name": "subject_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "subject_id": {+ "name": "subject_id","type": "text","primaryKey": false,"notNull": false},+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "completed_at": {+ "name": "completed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "archived_at": {+ "name": "archived_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },"visibility": {"name": "visibility","type": "text",@@ -19640,13 +23826,6 @@"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",@@ -19663,11 +23842,47 @@}},"indexes": {- "knowledge_bases_client_id_user_id_unique": {- "name": "knowledge_bases_client_id_user_id_unique",+ "goals_user_id_idx": {+ "name": "goals_user_id_idx","columns": [{- "expression": "client_id",+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "goals_workspace_id_idx": {+ "name": "goals_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "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"@@ -19679,16 +23894,16 @@"nulls": "last"}],- "isUnique": true,+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "knowledge_bases_user_id_idx": {- "name": "knowledge_bases_user_id_idx",+ "goals_agent_id_idx": {+ "name": "goals_agent_id_idx","columns": [{- "expression": "user_id",+ "expression": "agent_id","isExpression": false,"asc": true,"nulls": "last"@@ -19699,11 +23914,11 @@"method": "btree","with": {}},- "knowledge_bases_workspace_id_idx": {- "name": "knowledge_bases_workspace_id_idx",+ "goals_project_id_idx": {+ "name": "goals_project_id_idx","columns": [{- "expression": "workspace_id",+ "expression": "project_id","isExpression": false,"asc": true,"nulls": "last"@@ -19714,23 +23929,32 @@"method": "btree","with": {}},- "knowledge_bases_workspace_visibility_idx": {- "name": "knowledge_bases_workspace_visibility_idx",+ "goals_status_idx": {+ "name": "goals_status_idx","columns": [{- "expression": "workspace_id",+ "expression": "status","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "goals_subject_idx": {+ "name": "goals_subject_idx",+ "columns": [{- "expression": "visibility",+ "expression": "subject_type","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "user_id",+ "expression": "subject_id","isExpression": false,"asc": true,"nulls": "last"@@ -19743,23 +23967,41 @@}},"foreignKeys": {- "knowledge_bases_user_id_users_id_fk": {- "name": "knowledge_bases_user_id_users_id_fk",- "tableFrom": "knowledge_bases",+ "goals_user_id_users_id_fk": {+ "name": "goals_user_id_users_id_fk",+ "tableFrom": "goals","tableTo": "users","columnsFrom": ["user_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "knowledge_bases_workspace_id_workspaces_id_fk": {- "name": "knowledge_bases_workspace_id_workspaces_id_fk",- "tableFrom": "knowledge_bases",+ "goals_workspace_id_workspaces_id_fk": {+ "name": "goals_workspace_id_workspaces_id_fk",+ "tableFrom": "goals","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"+ },+ "goals_agent_id_agents_id_fk": {+ "name": "goals_agent_id_agents_id_fk",+ "tableFrom": "goals",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "goals_project_id_projects_id_fk": {+ "name": "goals_project_id_projects_id_fk",+ "tableFrom": "goals",+ "tableTo": "projects",+ "columnsFrom": ["project_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"}},"compositePrimaryKeys": {},@@ -19768,66 +24010,40 @@"checkConstraints": {},"isRLSEnabled": false},- "public.file_shares": {- "name": "file_shares",+ "public.goal_edges": {+ "name": "goal_edges","schema": "","columns": {"id": {"name": "id",- "type": "text",+ "type": "uuid","primaryKey": true,- "notNull": true+ "notNull": true,+ "default": "gen_random_uuid()"},- "file_id": {- "name": "file_id",+ "goal_id": {+ "name": "goal_id","type": "text","primaryKey": false,"notNull": true},- "user_id": {- "name": "user_id",- "type": "text",+ "source_node_id": {+ "name": "source_node_id",+ "type": "uuid","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",+ "target_node_id": {+ "name": "target_node_id",+ "type": "uuid","primaryKey": false,- "notNull": false+ "notNull": true},- "visibility": {- "name": "visibility",+ "kind": {+ "name": "kind","type": "text","primaryKey": false,- "notNull": true,- "default": "'private'"- },- "accessed_at": {- "name": "accessed_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": true,- "default": "now()"+ "notNull": true},"created_at": {"name": "created_at",@@ -19835,21 +24051,26 @@"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",+ "goal_edges_source_target_kind_unique": {+ "name": "goal_edges_source_target_kind_unique","columns": [{- "expression": "file_id",+ "expression": "source_node_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "target_node_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "kind","isExpression": false,"asc": true,"nulls": "last"@@ -19860,11 +24081,11 @@"method": "btree","with": {}},- "file_shares_user_id_idx": {- "name": "file_shares_user_id_idx",+ "goal_edges_goal_id_idx": {+ "name": "goal_edges_goal_id_idx","columns": [{- "expression": "user_id",+ "expression": "goal_id","isExpression": false,"asc": true,"nulls": "last"@@ -19875,11 +24096,11 @@"method": "btree","with": {}},- "file_shares_workspace_id_idx": {- "name": "file_shares_workspace_id_idx",+ "goal_edges_target_node_id_idx": {+ "name": "goal_edges_target_node_id_idx","columns": [{- "expression": "workspace_id",+ "expression": "target_node_id","isExpression": false,"asc": true,"nulls": "last"@@ -19892,30 +24113,30 @@}},"foreignKeys": {- "file_shares_file_id_files_id_fk": {- "name": "file_shares_file_id_files_id_fk",- "tableFrom": "file_shares",- "tableTo": "files",- "columnsFrom": ["file_id"],+ "goal_edges_goal_id_goals_id_fk": {+ "name": "goal_edges_goal_id_goals_id_fk",+ "tableFrom": "goal_edges",+ "tableTo": "goals",+ "columnsFrom": ["goal_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"],+ "goal_edges_goal_source_node_fk": {+ "name": "goal_edges_goal_source_node_fk",+ "tableFrom": "goal_edges",+ "tableTo": "goal_nodes",+ "columnsFrom": ["goal_id", "source_node_id"],+ "columnsTo": ["goal_id", "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"],+ "goal_edges_goal_target_node_fk": {+ "name": "goal_edges_goal_target_node_fk",+ "tableFrom": "goal_edges",+ "tableTo": "goal_nodes",+ "columnsFrom": ["goal_id", "target_node_id"],+ "columnsTo": ["goal_id", "id"],"onDelete": "cascade","onUpdate": "no action"}@@ -19923,112 +24144,81 @@"compositePrimaryKeys": {},"uniqueConstraints": {},"policies": {},- "checkConstraints": {},+ "checkConstraints": {+ "goal_edges_distinct_nodes": {+ "name": "goal_edges_distinct_nodes",+ "value": "\"goal_edges\".\"source_node_id\" <> \"goal_edges\".\"target_node_id\""+ }+ },"isRLSEnabled": false},- "public.fts_search_sync_capture_version": {- "name": "fts_search_sync_capture_version",+ "public.goal_events": {+ "name": "goal_events","schema": "","columns": {"id": {"name": "id",- "type": "text",+ "type": "uuid","primaryKey": true,- "notNull": true- },- "version": {- "name": "version",- "type": "integer",- "primaryKey": false,- "notNull": true- }- },- "indexes": {},- "foreignKeys": {},- "compositePrimaryKeys": {},- "uniqueConstraints": {},- "policies": {},- "checkConstraints": {},- "isRLSEnabled": false- },- "public.fts_search_sync_outbox": {- "name": "fts_search_sync_outbox",- "schema": "",- "columns": {- "attempts": {- "name": "attempts",- "type": "integer",- "primaryKey": false,"notNull": true,- "default": 0+ "default": "gen_random_uuid()"},- "available_at": {- "name": "available_at",- "type": "timestamp with time zone",+ "goal_id": {+ "name": "goal_id",+ "type": "text","primaryKey": false,- "notNull": true,- "default": "now()"+ "notNull": true},- "created_at": {- "name": "created_at",- "type": "timestamp with time zone",+ "event_type": {+ "name": "event_type",+ "type": "text","primaryKey": false,- "notNull": true,- "default": "now()"+ "notNull": true},- "dead_at": {- "name": "dead_at",- "type": "timestamp with time zone",+ "entity_type": {+ "name": "entity_type",+ "type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "document_id": {- "name": "document_id",+ "entity_id": {+ "name": "entity_id","type": "text","primaryKey": false,"notNull": true- },- "entity": {- "name": "entity",+ },+ "actor_type": {+ "name": "actor_type","type": "text","primaryKey": false,"notNull": true},- "id": {- "name": "id",- "type": "uuid",- "primaryKey": true,- "notNull": true,- "default": "gen_random_uuid()"- },- "last_error": {- "name": "last_error",+ "actor_id": {+ "name": "actor_id","type": "text","primaryKey": false,"notNull": false},- "locked_until": {- "name": "locked_until",- "type": "timestamp with time zone",+ "task_id": {+ "name": "task_id",+ "type": "text","primaryKey": false,"notNull": false},- "priority": {- "name": "priority",- "type": "smallint",+ "operation_id": {+ "name": "operation_id",+ "type": "text","primaryKey": false,- "notNull": true,- "default": 10+ "notNull": false},- "revision": {- "name": "revision",- "type": "bigint",+ "reason": {+ "name": "reason",+ "type": "text","primaryKey": false,- "notNull": true,- "default": "nextval('fts_search_sync_revision_seq')"+ "notNull": false},- "updated_at": {- "name": "updated_at",+ "created_at": {+ "name": "created_at","type": "timestamp with time zone","primaryKey": false,"notNull": true,@@ -20036,174 +24226,198 @@}},"indexes": {- "fts_search_sync_outbox_entity_document_id_unique": {- "name": "fts_search_sync_outbox_entity_document_id_unique",+ "goal_events_goal_id_created_at_idx": {+ "name": "goal_events_goal_id_created_at_idx","columns": [{- "expression": "entity",+ "expression": "goal_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "document_id",+ "expression": "created_at","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "fts_search_sync_outbox_claim_idx": {- "name": "fts_search_sync_outbox_claim_idx",+ "goal_events_entity_idx": {+ "name": "goal_events_entity_idx","columns": [{- "expression": "priority",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "available_at",+ "expression": "entity_type","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "revision",+ "expression": "entity_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,- "where": "\"fts_search_sync_outbox\".\"dead_at\" IS NULL","concurrently": false,"method": "btree","with": {}},- "fts_search_sync_outbox_dead_idx": {- "name": "fts_search_sync_outbox_dead_idx",+ "goal_events_task_id_idx": {+ "name": "goal_events_task_id_idx","columns": [{- "expression": "dead_at",+ "expression": "task_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,- "where": "\"fts_search_sync_outbox\".\"dead_at\" IS NOT NULL","concurrently": false,"method": "btree","with": {}},- "fts_search_sync_outbox_lease_idx": {- "name": "fts_search_sync_outbox_lease_idx",+ "goal_events_operation_id_idx": {+ "name": "goal_events_operation_id_idx","columns": [{- "expression": "locked_until",+ "expression": "operation_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,- "where": "\"fts_search_sync_outbox\".\"dead_at\" IS NULL AND \"fts_search_sync_outbox\".\"locked_until\" IS NOT NULL","concurrently": false,"method": "btree","with": {}}},- "foreignKeys": {},+ "foreignKeys": {+ "goal_events_goal_id_goals_id_fk": {+ "name": "goal_events_goal_id_goals_id_fk",+ "tableFrom": "goal_events",+ "tableTo": "goals",+ "columnsFrom": ["goal_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "goal_events_task_id_tasks_id_fk": {+ "name": "goal_events_task_id_tasks_id_fk",+ "tableFrom": "goal_events",+ "tableTo": "tasks",+ "columnsFrom": ["task_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },"compositePrimaryKeys": {},"uniqueConstraints": {},"policies": {},"checkConstraints": {},"isRLSEnabled": false},- "public.generation_batches": {- "name": "generation_batches",+ "public.goal_node_decisions": {+ "name": "goal_node_decisions","schema": "","columns": {"id": {"name": "id",- "type": "text",+ "type": "uuid","primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "node_id": {+ "name": "node_id",+ "type": "uuid",+ "primaryKey": false,"notNull": true},- "user_id": {- "name": "user_id",+ "authority": {+ "name": "authority","type": "text","primaryKey": false,"notNull": true},- "workspace_id": {- "name": "workspace_id",+ "status": {+ "name": "status","type": "text","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "'pending'"},- "generation_topic_id": {- "name": "generation_topic_id",+ "question": {+ "name": "question","type": "text","primaryKey": false,"notNull": true},- "provider": {- "name": "provider",+ "options": {+ "name": "options",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "recommended_option_id": {+ "name": "recommended_option_id","type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "model": {- "name": "model",+ "requested_user_id": {+ "name": "requested_user_id","type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "prompt": {- "name": "prompt",+ "requested_project_role": {+ "name": "requested_project_role","type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "width": {- "name": "width",- "type": "integer",+ "resolved_option_id": {+ "name": "resolved_option_id",+ "type": "text","primaryKey": false,"notNull": false},- "height": {- "name": "height",- "type": "integer",+ "resolution": {+ "name": "resolution",+ "type": "text","primaryKey": false,"notNull": false},- "ratio": {- "name": "ratio",- "type": "varchar(64)",+ "resolved_by_user_id": {+ "name": "resolved_by_user_id",+ "type": "text","primaryKey": false,"notNull": false},- "config": {- "name": "config",- "type": "jsonb",+ "resolved_by_agent_id": {+ "name": "resolved_by_agent_id",+ "type": "text","primaryKey": false,"notNull": false},- "deleted_at": {- "name": "deleted_at",+ "resolved_at": {+ "name": "resolved_at","type": "timestamp with time zone","primaryKey": false,"notNull": false},- "is_deleted": {- "name": "is_deleted",- "type": "boolean",+ "canceled_at": {+ "name": "canceled_at",+ "type": "timestamp with time zone","primaryKey": false,"notNull": false},@@ -20230,11 +24444,26 @@}},"indexes": {- "generation_batches_user_id_idx": {- "name": "generation_batches_user_id_idx",+ "goal_node_decisions_node_id_unique": {+ "name": "goal_node_decisions_node_id_unique","columns": [{- "expression": "user_id",+ "expression": "node_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "goal_node_decisions_status_idx": {+ "name": "goal_node_decisions_status_idx",+ "columns": [+ {+ "expression": "status","isExpression": false,"asc": true,"nulls": "last"@@ -20245,11 +24474,11 @@"method": "btree","with": {}},- "generation_batches_topic_id_idx": {- "name": "generation_batches_topic_id_idx",+ "goal_node_decisions_resolved_by_user_id_idx": {+ "name": "goal_node_decisions_resolved_by_user_id_idx","columns": [{- "expression": "generation_topic_id",+ "expression": "resolved_by_user_id","isExpression": false,"asc": true,"nulls": "last"@@ -20260,11 +24489,17 @@"method": "btree","with": {}},- "generation_batches_workspace_id_idx": {- "name": "generation_batches_workspace_id_idx",+ "goal_node_decisions_requested_user_id_status_idx": {+ "name": "goal_node_decisions_requested_user_id_status_idx","columns": [{- "expression": "workspace_id",+ "expression": "requested_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status","isExpression": false,"asc": true,"nulls": "last"@@ -20277,29 +24512,145 @@}},"foreignKeys": {- "generation_batches_user_id_users_id_fk": {- "name": "generation_batches_user_id_users_id_fk",- "tableFrom": "generation_batches",- "tableTo": "users",- "columnsFrom": ["user_id"],+ "goal_node_decisions_node_id_goal_nodes_id_fk": {+ "name": "goal_node_decisions_node_id_goal_nodes_id_fk",+ "tableFrom": "goal_node_decisions",+ "tableTo": "goal_nodes",+ "columnsFrom": ["node_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "generation_batches_workspace_id_workspaces_id_fk": {- "name": "generation_batches_workspace_id_workspaces_id_fk",- "tableFrom": "generation_batches",- "tableTo": "workspaces",- "columnsFrom": ["workspace_id"],+ "goal_node_decisions_requested_user_id_users_id_fk": {+ "name": "goal_node_decisions_requested_user_id_users_id_fk",+ "tableFrom": "goal_node_decisions",+ "tableTo": "users",+ "columnsFrom": ["requested_user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "goal_node_decisions_resolved_by_user_id_users_id_fk": {+ "name": "goal_node_decisions_resolved_by_user_id_users_id_fk",+ "tableFrom": "goal_node_decisions",+ "tableTo": "users",+ "columnsFrom": ["resolved_by_user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "goal_node_decisions_resolved_by_agent_id_agents_id_fk": {+ "name": "goal_node_decisions_resolved_by_agent_id_agents_id_fk",+ "tableFrom": "goal_node_decisions",+ "tableTo": "agents",+ "columnsFrom": ["resolved_by_agent_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.goal_node_work_versions": {+ "name": "goal_node_work_versions",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "node_id": {+ "name": "node_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "work_version_id": {+ "name": "work_version_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "relation": {+ "name": "relation",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "goal_node_work_versions_node_version_relation_unique": {+ "name": "goal_node_work_versions_node_version_relation_unique",+ "columns": [+ {+ "expression": "node_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "work_version_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "relation",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "goal_node_work_versions_work_version_id_idx": {+ "name": "goal_node_work_versions_work_version_id_idx",+ "columns": [+ {+ "expression": "work_version_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "goal_node_work_versions_node_id_goal_nodes_id_fk": {+ "name": "goal_node_work_versions_node_id_goal_nodes_id_fk",+ "tableFrom": "goal_node_work_versions",+ "tableTo": "goal_nodes",+ "columnsFrom": ["node_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "generation_batches_generation_topic_id_generation_topics_id_fk": {- "name": "generation_batches_generation_topic_id_generation_topics_id_fk",- "tableFrom": "generation_batches",- "tableTo": "generation_topics",- "columnsFrom": ["generation_topic_id"],+ "goal_node_work_versions_work_version_id_work_versions_id_fk": {+ "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"],"onDelete": "cascade","onUpdate": "no action"@@ -20311,63 +24662,82 @@"checkConstraints": {},"isRLSEnabled": false},- "public.generation_topics": {- "name": "generation_topics",+ "public.goal_nodes": {+ "name": "goal_nodes","schema": "","columns": {"id": {"name": "id",- "type": "text",+ "type": "uuid","primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "goal_id": {+ "name": "goal_id",+ "type": "text",+ "primaryKey": false,"notNull": true},- "user_id": {- "name": "user_id",+ "kind": {+ "name": "kind","type": "text","primaryKey": false,"notNull": true},- "workspace_id": {- "name": "workspace_id",+ "status": {+ "name": "status","type": "text","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "'proposed'"},"title": {"name": "title","type": "text","primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,"notNull": false},- "cover_url": {- "name": "cover_url",+ "task_id": {+ "name": "task_id","type": "text","primaryKey": false,"notNull": false},- "type": {- "name": "type",- "type": "varchar(32)",+ "priority": {+ "name": "priority",+ "type": "integer","primaryKey": false,"notNull": true,- "default": "'image'"+ "default": 0},- "visibility": {- "name": "visibility",+ "confidence": {+ "name": "confidence",+ "type": "numeric(4, 3)",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id","type": "text","primaryKey": false,- "notNull": true,- "default": "'public'"+ "notNull": false},- "deleted_at": {- "name": "deleted_at",- "type": "timestamp with time zone",+ "created_by_agent_id": {+ "name": "created_by_agent_id",+ "type": "text","primaryKey": false,"notNull": false},- "is_deleted": {- "name": "is_deleted",- "type": "boolean",+ "resolved_at": {+ "name": "resolved_at",+ "type": "timestamp with time zone","primaryKey": false,"notNull": false},@@ -20394,11 +24764,17 @@}},"indexes": {- "generation_topics_user_id_idx": {- "name": "generation_topics_user_id_idx",+ "goal_nodes_goal_id_status_idx": {+ "name": "goal_nodes_goal_id_status_idx","columns": [{- "expression": "user_id",+ "expression": "goal_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status","isExpression": false,"asc": true,"nulls": "last"@@ -20409,11 +24785,11 @@"method": "btree","with": {}},- "generation_topics_workspace_id_idx": {- "name": "generation_topics_workspace_id_idx",+ "goal_nodes_created_by_user_id_idx": {+ "name": "goal_nodes_created_by_user_id_idx","columns": [{- "expression": "workspace_id",+ "expression": "created_by_user_id","isExpression": false,"asc": true,"nulls": "last"@@ -20424,62 +24800,101 @@"method": "btree","with": {}},- "generation_topics_workspace_visibility_idx": {- "name": "generation_topics_workspace_visibility_idx",+ "goal_nodes_goal_id_kind_idx": {+ "name": "goal_nodes_goal_id_kind_idx","columns": [{- "expression": "workspace_id",+ "expression": "goal_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "visibility",+ "expression": "kind","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "goal_nodes_task_id_unique": {+ "name": "goal_nodes_task_id_unique",+ "columns": [{- "expression": "user_id",+ "expression": "task_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,+ "where": "\"goal_nodes\".\"task_id\" is not null","concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "generation_topics_user_id_users_id_fk": {- "name": "generation_topics_user_id_users_id_fk",- "tableFrom": "generation_topics",- "tableTo": "users",- "columnsFrom": ["user_id"],+ "goal_nodes_goal_id_goals_id_fk": {+ "name": "goal_nodes_goal_id_goals_id_fk",+ "tableFrom": "goal_nodes",+ "tableTo": "goals",+ "columnsFrom": ["goal_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "generation_topics_workspace_id_workspaces_id_fk": {- "name": "generation_topics_workspace_id_workspaces_id_fk",- "tableFrom": "generation_topics",- "tableTo": "workspaces",- "columnsFrom": ["workspace_id"],+ "goal_nodes_task_id_tasks_id_fk": {+ "name": "goal_nodes_task_id_tasks_id_fk",+ "tableFrom": "goal_nodes",+ "tableTo": "tasks",+ "columnsFrom": ["task_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "goal_nodes_created_by_user_id_users_id_fk": {+ "name": "goal_nodes_created_by_user_id_users_id_fk",+ "tableFrom": "goal_nodes",+ "tableTo": "users",+ "columnsFrom": ["created_by_user_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "goal_nodes_created_by_agent_id_agents_id_fk": {+ "name": "goal_nodes_created_by_agent_id_agents_id_fk",+ "tableFrom": "goal_nodes",+ "tableTo": "agents",+ "columnsFrom": ["created_by_agent_id"],"columnsTo": ["id"],- "onDelete": "cascade",+ "onDelete": "set null","onUpdate": "no action"}},"compositePrimaryKeys": {},- "uniqueConstraints": {},+ "uniqueConstraints": {+ "goal_nodes_goal_id_id_unique": {+ "name": "goal_nodes_goal_id_id_unique",+ "nullsNotDistinct": false,+ "columns": ["goal_id", "id"]+ }+ },"policies": {},- "checkConstraints": {},+ "checkConstraints": {+ "goal_nodes_confidence_range": {+ "name": "goal_nodes_confidence_range",+ "value": "\"goal_nodes\".\"confidence\" IS NULL OR (\"goal_nodes\".\"confidence\" >= 0 AND \"goal_nodes\".\"confidence\" <= 1)"+ }+ },"isRLSEnabled": false},- "public.generations": {- "name": "generations",+ "public.goal_shares": {+ "name": "goal_shares","schema": "","columns": {"id": {@@ -20488,59 +24903,49 @@"primaryKey": true,"notNull": true},- "user_id": {- "name": "user_id",+ "goal_id": {+ "name": "goal_id","type": "text","primaryKey": false,"notNull": true},- "workspace_id": {- "name": "workspace_id",+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,- "notNull": false- },- "generation_batch_id": {- "name": "generation_batch_id",- "type": "varchar(64)",- "primaryKey": false,"notNull": true},- "async_task_id": {- "name": "async_task_id",- "type": "uuid",- "primaryKey": false,- "notNull": false- },- "file_id": {- "name": "file_id",+ "workspace_id": {+ "name": "workspace_id","type": "text","primaryKey": false,"notNull": false},- "seed": {- "name": "seed",+ "page_view_count": {+ "name": "page_view_count","type": "integer","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": 0},- "asset": {- "name": "asset",+ "config": {+ "name": "config","type": "jsonb","primaryKey": false,"notNull": false},- "deleted_at": {- "name": "deleted_at",- "type": "timestamp with time zone",+ "metadata": {+ "name": "metadata",+ "type": "jsonb","primaryKey": false,"notNull": false},- "is_deleted": {- "name": "is_deleted",- "type": "boolean",+ "visibility": {+ "name": "visibility",+ "type": "text","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "'private'"},"accessed_at": {"name": "accessed_at",@@ -20565,41 +24970,26 @@}},"indexes": {- "generations_user_id_idx": {- "name": "generations_user_id_idx",- "columns": [- {- "expression": "user_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "generations_batch_id_idx": {- "name": "generations_batch_id_idx",+ "goal_shares_goal_id_unique": {+ "name": "goal_shares_goal_id_unique","columns": [{- "expression": "generation_batch_id",+ "expression": "goal_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,"concurrently": false,"method": "btree","with": {}},- "generations_file_id_idx": {- "name": "generations_file_id_idx",+ "goal_shares_user_id_idx": {+ "name": "goal_shares_user_id_idx","columns": [{- "expression": "file_id",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"@@ -20610,8 +25000,8 @@"method": "btree","with": {}},- "generations_workspace_id_idx": {- "name": "generations_workspace_id_idx",+ "goal_shares_workspace_id_idx": {+ "name": "goal_shares_workspace_id_idx","columns": [{"expression": "workspace_id",@@ -20627,47 +25017,29 @@}},"foreignKeys": {- "generations_user_id_users_id_fk": {- "name": "generations_user_id_users_id_fk",- "tableFrom": "generations",- "tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "generations_workspace_id_workspaces_id_fk": {- "name": "generations_workspace_id_workspaces_id_fk",- "tableFrom": "generations",- "tableTo": "workspaces",- "columnsFrom": ["workspace_id"],+ "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"},- "generations_generation_batch_id_generation_batches_id_fk": {- "name": "generations_generation_batch_id_generation_batches_id_fk",- "tableFrom": "generations",- "tableTo": "generation_batches",- "columnsFrom": ["generation_batch_id"],+ "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"},- "generations_async_task_id_async_tasks_id_fk": {- "name": "generations_async_task_id_async_tasks_id_fk",- "tableFrom": "generations",- "tableTo": "async_tasks",- "columnsFrom": ["async_task_id"],- "columnsTo": ["id"],- "onDelete": "set null",- "onUpdate": "no action"- },- "generations_file_id_files_id_fk": {- "name": "generations_file_id_files_id_fk",- "tableFrom": "generations",- "tableTo": "files",- "columnsFrom": ["file_id"],+ "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"@@ -20679,125 +25051,98 @@"checkConstraints": {},"isRLSEnabled": false},- "public.goals": {- "name": "goals",+ "public.goal_subscriptions": {+ "name": "goal_subscriptions","schema": "","columns": {"id": {"name": "id",- "type": "text",+ "type": "uuid","primaryKey": true,- "notNull": true+ "notNull": true,+ "default": "gen_random_uuid()"},- "user_id": {- "name": "user_id",+ "goal_id": {+ "name": "goal_id","type": "text","primaryKey": false,"notNull": true},- "workspace_id": {- "name": "workspace_id",- "type": "text",- "primaryKey": false,- "notNull": false- },- "agent_id": {- "name": "agent_id",- "type": "text",+ "widget_id": {+ "name": "widget_id",+ "type": "uuid","primaryKey": false,- "notNull": false+ "notNull": true},- "project_id": {- "name": "project_id",+ "metric_id": {+ "name": "metric_id","type": "text","primaryKey": false,"notNull": false},- "title": {- "name": "title",+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,"notNull": true},- "requirement": {- "name": "requirement",+ "workspace_id": {+ "name": "workspace_id","type": "text","primaryKey": false,"notNull": false},- "config": {- "name": "config",- "type": "jsonb",- "primaryKey": false,- "notNull": false- },- "max_rounds": {- "name": "max_rounds",- "type": "integer",- "primaryKey": false,- "notNull": false- },- "max_total_cost": {- "name": "max_total_cost",- "type": "numeric(20, 6)",- "primaryKey": false,- "notNull": false- },- "status": {- "name": "status",- "type": "text",+ "enabled": {+ "name": "enabled",+ "type": "boolean","primaryKey": false,"notNull": true,- "default": "'planning'"+ "default": false},- "subject_type": {- "name": "subject_type",- "type": "text",+ "confirmed_version_id": {+ "name": "confirmed_version_id",+ "type": "uuid","primaryKey": false,- "notNull": false+ "notNull": true},- "subject_id": {- "name": "subject_id",- "type": "text",+ "binding_revision": {+ "name": "binding_revision",+ "type": "integer","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": 1},- "started_at": {- "name": "started_at",- "type": "timestamp with time zone",+ "binding": {+ "name": "binding",+ "type": "jsonb","primaryKey": false,- "notNull": false+ "notNull": true},- "completed_at": {- "name": "completed_at",- "type": "timestamp with time zone",+ "wake_condition": {+ "name": "wake_condition",+ "type": "jsonb","primaryKey": false,- "notNull": false+ "notNull": true},- "archived_at": {- "name": "archived_at",- "type": "timestamp with time zone",+ "freshness_policy": {+ "name": "freshness_policy",+ "type": "jsonb","primaryKey": false,- "notNull": false+ "notNull": true},- "visibility": {- "name": "visibility",- "type": "text",+ "cursor": {+ "name": "cursor",+ "type": "jsonb","primaryKey": false,"notNull": true,- "default": "'public'"+ "default": "'{}'::jsonb"},- "deleted_at": {- "name": "deleted_at",+ "accessed_at": {+ "name": "accessed_at","type": "timestamp with time zone","primaryKey": false,- "notNull": false- },- "is_deleted": {- "name": "is_deleted",- "type": "boolean",- "primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "now()"},"created_at": {"name": "created_at",@@ -20815,47 +25160,67 @@}},"indexes": {- "goals_user_id_idx": {- "name": "goals_user_id_idx",+ "goal_subscriptions_goal_widget_metric_unique": {+ "name": "goal_subscriptions_goal_widget_metric_unique","columns": [{- "expression": "user_id",+ "expression": "goal_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "widget_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "metric_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,+ "where": "\"goal_subscriptions\".\"metric_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}},- "goals_workspace_id_idx": {- "name": "goals_workspace_id_idx",+ "goal_subscriptions_goal_widget_result_unique": {+ "name": "goal_subscriptions_goal_widget_result_unique","columns": [{- "expression": "workspace_id",+ "expression": "goal_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "widget_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,+ "where": "\"goal_subscriptions\".\"metric_id\" IS NULL","concurrently": false,"method": "btree","with": {}},- "goals_workspace_visibility_idx": {- "name": "goals_workspace_visibility_idx",+ "goal_subscriptions_widget_enabled_idx": {+ "name": "goal_subscriptions_widget_enabled_idx","columns": [{- "expression": "workspace_id",+ "expression": "widget_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "visibility",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"@@ -20868,66 +25233,44 @@}],"isUnique": false,+ "where": "\"goal_subscriptions\".\"enabled\" = true","concurrently": false,"method": "btree","with": {}},- "goals_agent_id_idx": {- "name": "goals_agent_id_idx",- "columns": [- {- "expression": "agent_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "goals_project_id_idx": {- "name": "goals_project_id_idx",+ "goal_subscriptions_personal_idx": {+ "name": "goal_subscriptions_personal_idx","columns": [{- "expression": "project_id",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "goals_status_idx": {- "name": "goals_status_idx",- "columns": [+ },{- "expression": "status",+ "expression": "goal_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,+ "where": "\"goal_subscriptions\".\"workspace_id\" IS NULL","concurrently": false,"method": "btree","with": {}},- "goals_subject_idx": {- "name": "goals_subject_idx",+ "goal_subscriptions_workspace_idx": {+ "name": "goal_subscriptions_workspace_idx","columns": [{- "expression": "subject_type",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "subject_id",+ "expression": "goal_id","isExpression": false,"asc": true,"nulls": "last"@@ -20937,128 +25280,27 @@"concurrently": false,"method": "btree","with": {}- }- },- "foreignKeys": {- "goals_user_id_users_id_fk": {- "name": "goals_user_id_users_id_fk",- "tableFrom": "goals",- "tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "goals_workspace_id_workspaces_id_fk": {- "name": "goals_workspace_id_workspaces_id_fk",- "tableFrom": "goals",- "tableTo": "workspaces",- "columnsFrom": ["workspace_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "goals_agent_id_agents_id_fk": {- "name": "goals_agent_id_agents_id_fk",- "tableFrom": "goals",- "tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],- "onDelete": "set null",- "onUpdate": "no action"- },- "goals_project_id_projects_id_fk": {- "name": "goals_project_id_projects_id_fk",- "tableFrom": "goals",- "tableTo": "projects",- "columnsFrom": ["project_id"],- "columnsTo": ["id"],- "onDelete": "set null",- "onUpdate": "no action"- }- },- "compositePrimaryKeys": {},- "uniqueConstraints": {},- "policies": {},- "checkConstraints": {},- "isRLSEnabled": false- },- "public.goal_edges": {- "name": "goal_edges",- "schema": "",- "columns": {- "id": {- "name": "id",- "type": "uuid",- "primaryKey": true,- "notNull": true,- "default": "gen_random_uuid()"- },- "goal_id": {- "name": "goal_id",- "type": "text",- "primaryKey": false,- "notNull": true- },- "source_node_id": {- "name": "source_node_id",- "type": "uuid",- "primaryKey": false,- "notNull": true- },- "target_node_id": {- "name": "target_node_id",- "type": "uuid",- "primaryKey": false,- "notNull": true- },- "kind": {- "name": "kind",- "type": "text",- "primaryKey": false,- "notNull": true},- "created_at": {- "name": "created_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": true,- "default": "now()"- }- },- "indexes": {- "goal_edges_source_target_kind_unique": {- "name": "goal_edges_source_target_kind_unique",+ "goal_subscriptions_metric_id_idx": {+ "name": "goal_subscriptions_metric_id_idx","columns": [{- "expression": "source_node_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "target_node_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "kind",+ "expression": "metric_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "goal_edges_goal_id_idx": {- "name": "goal_edges_goal_id_idx",+ "goal_subscriptions_confirmed_version_id_idx": {+ "name": "goal_subscriptions_confirmed_version_id_idx","columns": [{- "expression": "goal_id",+ "expression": "confirmed_version_id","isExpression": false,"asc": true,"nulls": "last"@@ -21069,47 +25311,81 @@"method": "btree","with": {}},- "goal_edges_target_node_id_idx": {- "name": "goal_edges_target_node_id_idx",+ "goal_subscriptions_reconcile_idx": {+ "name": "goal_subscriptions_reconcile_idx","columns": [{- "expression": "target_node_id",+ "expression": "updated_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,+ "where": "\"goal_subscriptions\".\"enabled\" = true","concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "goal_edges_goal_id_goals_id_fk": {- "name": "goal_edges_goal_id_goals_id_fk",- "tableFrom": "goal_edges",+ "goal_subscriptions_goal_id_goals_id_fk": {+ "name": "goal_subscriptions_goal_id_goals_id_fk",+ "tableFrom": "goal_subscriptions","tableTo": "goals","columnsFrom": ["goal_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "goal_edges_goal_source_node_fk": {- "name": "goal_edges_goal_source_node_fk",- "tableFrom": "goal_edges",- "tableTo": "goal_nodes",- "columnsFrom": ["goal_id", "source_node_id"],- "columnsTo": ["goal_id", "id"],+ "goal_subscriptions_widget_id_widgets_id_fk": {+ "name": "goal_subscriptions_widget_id_widgets_id_fk",+ "tableFrom": "goal_subscriptions",+ "tableTo": "widgets",+ "columnsFrom": ["widget_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "goal_subscriptions_metric_id_metrics_id_fk": {+ "name": "goal_subscriptions_metric_id_metrics_id_fk",+ "tableFrom": "goal_subscriptions",+ "tableTo": "metrics",+ "columnsFrom": ["metric_id"],+ "columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "goal_edges_goal_target_node_fk": {- "name": "goal_edges_goal_target_node_fk",- "tableFrom": "goal_edges",- "tableTo": "goal_nodes",- "columnsFrom": ["goal_id", "target_node_id"],- "columnsTo": ["goal_id", "id"],+ "goal_subscriptions_user_id_users_id_fk": {+ "name": "goal_subscriptions_user_id_users_id_fk",+ "tableFrom": "goal_subscriptions",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "goal_subscriptions_workspace_id_workspaces_id_fk": {+ "name": "goal_subscriptions_workspace_id_workspaces_id_fk",+ "tableFrom": "goal_subscriptions",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "goal_subscriptions_confirmed_version_id_widget_versions_id_fk": {+ "name": "goal_subscriptions_confirmed_version_id_widget_versions_id_fk",+ "tableFrom": "goal_subscriptions",+ "tableTo": "widget_versions",+ "columnsFrom": ["confirmed_version_id"],+ "columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"}@@ -21118,75 +25394,128 @@"uniqueConstraints": {},"policies": {},"checkConstraints": {- "goal_edges_distinct_nodes": {- "name": "goal_edges_distinct_nodes",- "value": "\"goal_edges\".\"source_node_id\" <> \"goal_edges\".\"target_node_id\""+ "goal_subscriptions_binding_revision_positive": {+ "name": "goal_subscriptions_binding_revision_positive",+ "value": "\"goal_subscriptions\".\"binding_revision\" > 0"}},"isRLSEnabled": false},- "public.goal_events": {- "name": "goal_events",+ "public.goal_traces": {+ "name": "goal_traces","schema": "","columns": {- "id": {- "name": "id",- "type": "uuid",- "primaryKey": true,- "notNull": true,- "default": "gen_random_uuid()"- },"goal_id": {"name": "goal_id","type": "text",- "primaryKey": false,+ "primaryKey": true,"notNull": true},- "event_type": {- "name": "event_type",+ "trace_s3_key": {+ "name": "trace_s3_key","type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "entity_type": {- "name": "entity_type",- "type": "text",+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": true+ "notNull": false},- "entity_id": {- "name": "entity_id",- "type": "text",+ "completed_at": {+ "name": "completed_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": true+ "notNull": false},- "actor_type": {- "name": "actor_type",+ "final_status": {+ "name": "final_status","type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "actor_id": {- "name": "actor_id",- "type": "text",+ "advances_total": {+ "name": "advances_total",+ "type": "integer","primaryKey": false,"notNull": false},- "task_id": {- "name": "task_id",- "type": "text",+ "ticks_total": {+ "name": "ticks_total",+ "type": "integer","primaryKey": false,"notNull": false},- "operation_id": {- "name": "operation_id",- "type": "text",+ "advances_by_trigger": {+ "name": "advances_by_trigger",+ "type": "jsonb","primaryKey": false,"notNull": false},- "reason": {- "name": "reason",- "type": "text",+ "advances_by_outcome": {+ "name": "advances_by_outcome",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "ticks_by_branch": {+ "name": "ticks_by_branch",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "total_cost": {+ "name": "total_cost",+ "type": "numeric(20, 6)",+ "primaryKey": false,+ "notNull": false+ },+ "work_operations": {+ "name": "work_operations",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "nodes_total": {+ "name": "nodes_total",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "work_resolved": {+ "name": "work_resolved",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "work_retired": {+ "name": "work_retired",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "findings_total": {+ "name": "findings_total",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "gates_opened": {+ "name": "gates_opened",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "gates_resolved": {+ "name": "gates_resolved",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "human_waiting_ms": {+ "name": "human_waiting_ms",+ "type": "integer","primaryKey": false,"notNull": false},@@ -21196,56 +25525,21 @@"primaryKey": false,"notNull": true,"default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"}},"indexes": {- "goal_events_goal_id_created_at_idx": {- "name": "goal_events_goal_id_created_at_idx",- "columns": [- {- "expression": "goal_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "created_at",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "goal_events_entity_idx": {- "name": "goal_events_entity_idx",- "columns": [- {- "expression": "entity_type",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "entity_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "goal_events_task_id_idx": {- "name": "goal_events_task_id_idx",+ "goal_traces_started_at_idx": {+ "name": "goal_traces_started_at_idx","columns": [{- "expression": "task_id",+ "expression": "started_at","isExpression": false,"asc": true,"nulls": "last"@@ -21256,11 +25550,11 @@"method": "btree","with": {}},- "goal_events_operation_id_idx": {- "name": "goal_events_operation_id_idx",+ "goal_traces_final_status_idx": {+ "name": "goal_traces_final_status_idx","columns": [{- "expression": "operation_id",+ "expression": "final_status","isExpression": false,"asc": true,"nulls": "last"@@ -21273,23 +25567,14 @@}},"foreignKeys": {- "goal_events_goal_id_goals_id_fk": {- "name": "goal_events_goal_id_goals_id_fk",- "tableFrom": "goal_events",+ "goal_traces_goal_id_goals_id_fk": {+ "name": "goal_traces_goal_id_goals_id_fk",+ "tableFrom": "goal_traces","tableTo": "goals","columnsFrom": ["goal_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"- },- "goal_events_task_id_tasks_id_fk": {- "name": "goal_events_task_id_tasks_id_fk",- "tableFrom": "goal_events",- "tableTo": "tasks",- "columnsFrom": ["task_id"],- "columnsTo": ["id"],- "onDelete": "set null",- "onUpdate": "no action"}},"compositePrimaryKeys": {},@@ -21298,8 +25583,8 @@"checkConstraints": {},"isRLSEnabled": false},- "public.goal_node_decisions": {- "name": "goal_node_decisions",+ "public.inbound_webhooks": {+ "name": "inbound_webhooks","schema": "","columns": {"id": {@@ -21309,18 +25594,30 @@"notNull": true,"default": "gen_random_uuid()"},- "node_id": {- "name": "node_id",- "type": "uuid",+ "user_id": {+ "name": "user_id",+ "type": "text","primaryKey": false,"notNull": true},- "authority": {- "name": "authority",+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "kind": {+ "name": "kind","type": "text","primaryKey": false,"notNull": true},+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },"status": {"name": "status","type": "text",@@ -21328,71 +25625,99 @@"notNull": true,"default": "'pending'"},- "question": {- "name": "question",+ "agent_id": {+ "name": "agent_id","type": "text","primaryKey": false,"notNull": true},- "options": {- "name": "options",- "type": "jsonb",+ "topic_id": {+ "name": "topic_id",+ "type": "text","primaryKey": false,"notNull": false},- "recommended_option_id": {- "name": "recommended_option_id",+ "instructions": {+ "name": "instructions","type": "text","primaryKey": false,"notNull": false},- "requested_user_id": {- "name": "requested_user_id",+ "secret": {+ "name": "secret","type": "text","primaryKey": false,"notNull": false},- "requested_project_role": {- "name": "requested_project_role",- "type": "text",+ "verification": {+ "name": "verification",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "state": {+ "name": "state",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "connector_id": {+ "name": "connector_id",+ "type": "uuid","primaryKey": false,"notNull": false},- "resolved_option_id": {- "name": "resolved_option_id",+ "dedupe_key": {+ "name": "dedupe_key","type": "text","primaryKey": false,"notNull": false},- "resolution": {- "name": "resolution",- "type": "text",+ "next_maintenance_at": {+ "name": "next_maintenance_at",+ "type": "timestamp with time zone","primaryKey": false,"notNull": false},- "resolved_by_user_id": {- "name": "resolved_by_user_id",- "type": "text",+ "maintenance_failures": {+ "name": "maintenance_failures",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "last_delivery_at": {+ "name": "last_delivery_at",+ "type": "timestamp with time zone","primaryKey": false,"notNull": false},- "resolved_by_agent_id": {- "name": "resolved_by_agent_id",+ "last_error": {+ "name": "last_error","type": "text","primaryKey": false,"notNull": false},- "resolved_at": {- "name": "resolved_at",- "type": "timestamp with time zone",+ "wake_count": {+ "name": "wake_count",+ "type": "integer","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": 0},- "canceled_at": {- "name": "canceled_at",+ "wake_window_started_at": {+ "name": "wake_window_started_at","type": "timestamp with time zone","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "now()"},"accessed_at": {"name": "accessed_at",@@ -21417,41 +25742,55 @@}},"indexes": {- "goal_node_decisions_node_id_unique": {- "name": "goal_node_decisions_node_id_unique",+ "inbound_webhooks_user_kind_dedupe_unique": {+ "name": "inbound_webhooks_user_kind_dedupe_unique","columns": [{- "expression": "node_id",+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "dedupe_key","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": true,+ "where": "\"inbound_webhooks\".\"dedupe_key\" IS NOT NULL","concurrently": false,"method": "btree","with": {}},- "goal_node_decisions_status_idx": {- "name": "goal_node_decisions_status_idx",+ "inbound_webhooks_next_maintenance_idx": {+ "name": "inbound_webhooks_next_maintenance_idx","columns": [{- "expression": "status",+ "expression": "next_maintenance_at","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,+ "where": "\"inbound_webhooks\".\"next_maintenance_at\" IS NOT NULL","concurrently": false,"method": "btree","with": {}},- "goal_node_decisions_resolved_by_user_id_idx": {- "name": "goal_node_decisions_resolved_by_user_id_idx",+ "inbound_webhooks_user_idx": {+ "name": "inbound_webhooks_user_idx","columns": [{- "expression": "resolved_by_user_id",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"@@ -21462,17 +25801,11 @@"method": "btree","with": {}},- "goal_node_decisions_requested_user_id_status_idx": {- "name": "goal_node_decisions_requested_user_id_status_idx",+ "inbound_webhooks_workspace_idx": {+ "name": "inbound_webhooks_workspace_idx","columns": [{- "expression": "requested_user_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "status",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"@@ -21482,122 +25815,42 @@"concurrently": false,"method": "btree","with": {}- }- },- "foreignKeys": {- "goal_node_decisions_node_id_goal_nodes_id_fk": {- "name": "goal_node_decisions_node_id_goal_nodes_id_fk",- "tableFrom": "goal_node_decisions",- "tableTo": "goal_nodes",- "columnsFrom": ["node_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "goal_node_decisions_requested_user_id_users_id_fk": {- "name": "goal_node_decisions_requested_user_id_users_id_fk",- "tableFrom": "goal_node_decisions",- "tableTo": "users",- "columnsFrom": ["requested_user_id"],- "columnsTo": ["id"],- "onDelete": "set null",- "onUpdate": "no action"- },- "goal_node_decisions_resolved_by_user_id_users_id_fk": {- "name": "goal_node_decisions_resolved_by_user_id_users_id_fk",- "tableFrom": "goal_node_decisions",- "tableTo": "users",- "columnsFrom": ["resolved_by_user_id"],- "columnsTo": ["id"],- "onDelete": "set null",- "onUpdate": "no action"- },- "goal_node_decisions_resolved_by_agent_id_agents_id_fk": {- "name": "goal_node_decisions_resolved_by_agent_id_agents_id_fk",- "tableFrom": "goal_node_decisions",- "tableTo": "agents",- "columnsFrom": ["resolved_by_agent_id"],- "columnsTo": ["id"],- "onDelete": "set null",- "onUpdate": "no action"- }- },- "compositePrimaryKeys": {},- "uniqueConstraints": {},- "policies": {},- "checkConstraints": {},- "isRLSEnabled": false- },- "public.goal_node_work_versions": {- "name": "goal_node_work_versions",- "schema": "",- "columns": {- "id": {- "name": "id",- "type": "uuid",- "primaryKey": true,- "notNull": true,- "default": "gen_random_uuid()"- },- "node_id": {- "name": "node_id",- "type": "uuid",- "primaryKey": false,- "notNull": true- },- "work_version_id": {- "name": "work_version_id",- "type": "uuid",- "primaryKey": false,- "notNull": true- },- "relation": {- "name": "relation",- "type": "text",- "primaryKey": false,- "notNull": true},- "created_at": {- "name": "created_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": true,- "default": "now()"- }- },- "indexes": {- "goal_node_work_versions_node_version_relation_unique": {- "name": "goal_node_work_versions_node_version_relation_unique",+ "inbound_webhooks_topic_idx": {+ "name": "inbound_webhooks_topic_idx","columns": [{- "expression": "node_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "work_version_id",+ "expression": "topic_id","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "inbound_webhooks_agent_idx": {+ "name": "inbound_webhooks_agent_idx",+ "columns": [{- "expression": "relation",+ "expression": "agent_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "goal_node_work_versions_work_version_id_idx": {- "name": "goal_node_work_versions_work_version_id_idx",+ "inbound_webhooks_connector_idx": {+ "name": "inbound_webhooks_connector_idx","columns": [{- "expression": "work_version_id",+ "expression": "connector_id","isExpression": false,"asc": true,"nulls": "last"@@ -21610,20 +25863,47 @@}},"foreignKeys": {- "goal_node_work_versions_node_id_goal_nodes_id_fk": {- "name": "goal_node_work_versions_node_id_goal_nodes_id_fk",- "tableFrom": "goal_node_work_versions",- "tableTo": "goal_nodes",- "columnsFrom": ["node_id"],+ "inbound_webhooks_user_id_users_id_fk": {+ "name": "inbound_webhooks_user_id_users_id_fk",+ "tableFrom": "inbound_webhooks",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "inbound_webhooks_workspace_id_workspaces_id_fk": {+ "name": "inbound_webhooks_workspace_id_workspaces_id_fk",+ "tableFrom": "inbound_webhooks",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "inbound_webhooks_agent_id_agents_id_fk": {+ "name": "inbound_webhooks_agent_id_agents_id_fk",+ "tableFrom": "inbound_webhooks",+ "tableTo": "agents",+ "columnsFrom": ["agent_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "goal_node_work_versions_work_version_id_work_versions_id_fk": {- "name": "goal_node_work_versions_work_version_id_work_versions_id_fk",- "tableFrom": "goal_node_work_versions",- "tableTo": "work_versions",- "columnsFrom": ["work_version_id"],+ "inbound_webhooks_topic_id_topics_id_fk": {+ "name": "inbound_webhooks_topic_id_topics_id_fk",+ "tableFrom": "inbound_webhooks",+ "tableTo": "topics",+ "columnsFrom": ["topic_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "inbound_webhooks_connector_id_user_connectors_id_fk": {+ "name": "inbound_webhooks_connector_id_user_connectors_id_fk",+ "tableFrom": "inbound_webhooks",+ "tableTo": "user_connectors",+ "columnsFrom": ["connector_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"@@ -21635,8 +25915,8 @@"checkConstraints": {},"isRLSEnabled": false},- "public.goal_nodes": {- "name": "goal_nodes",+ "public.linear_connections": {+ "name": "linear_connections","schema": "","columns": {"id": {@@ -21646,74 +25926,73 @@"notNull": true,"default": "gen_random_uuid()"},- "goal_id": {- "name": "goal_id",- "type": "text",- "primaryKey": false,- "notNull": true- },- "kind": {- "name": "kind",+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,"notNull": true},- "status": {- "name": "status",+ "workspace_id": {+ "name": "workspace_id","type": "text","primaryKey": false,- "notNull": true,- "default": "'proposed'"+ "notNull": false},- "title": {- "name": "title",- "type": "text",+ "organization_id": {+ "name": "organization_id",+ "type": "varchar(255)","primaryKey": false,"notNull": true},- "description": {- "name": "description",- "type": "text",+ "organization_name": {+ "name": "organization_name",+ "type": "varchar(255)","primaryKey": false,- "notNull": false+ "notNull": true},- "task_id": {- "name": "task_id",- "type": "text",+ "organization_url_key": {+ "name": "organization_url_key",+ "type": "varchar(255)","primaryKey": false,- "notNull": false+ "notNull": true},- "priority": {- "name": "priority",- "type": "integer",+ "actor_external_id": {+ "name": "actor_external_id",+ "type": "varchar(255)","primaryKey": false,- "notNull": true,- "default": 0+ "notNull": true},- "confidence": {- "name": "confidence",- "type": "numeric(4, 3)",+ "actor_name": {+ "name": "actor_name",+ "type": "varchar(255)","primaryKey": false,- "notNull": false+ "notNull": true},- "created_by_user_id": {- "name": "created_by_user_id",+ "credentials": {+ "name": "credentials","type": "text","primaryKey": false,"notNull": false},- "created_by_agent_id": {- "name": "created_by_agent_id",- "type": "text",+ "token_expires_at": {+ "name": "token_expires_at",+ "type": "timestamp with time zone","primaryKey": false,"notNull": false},- "resolved_at": {- "name": "resolved_at",+ "revoked_at": {+ "name": "revoked_at","type": "timestamp with time zone","primaryKey": false,"notNull": false},+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },"accessed_at": {"name": "accessed_at","type": "timestamp with time zone",@@ -21737,53 +26016,61 @@}},"indexes": {- "goal_nodes_goal_id_status_idx": {- "name": "goal_nodes_goal_id_status_idx",+ "linear_connections_org_personal_unique": {+ "name": "linear_connections_org_personal_unique","columns": [{- "expression": "goal_id",+ "expression": "organization_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "status",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,+ "where": "\"linear_connections\".\"workspace_id\" is null","concurrently": false,"method": "btree","with": {}},- "goal_nodes_created_by_user_id_idx": {- "name": "goal_nodes_created_by_user_id_idx",+ "linear_connections_org_workspace_unique": {+ "name": "linear_connections_org_workspace_unique","columns": [{- "expression": "created_by_user_id",+ "expression": "organization_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,+ "where": "\"linear_connections\".\"workspace_id\" is not null","concurrently": false,"method": "btree","with": {}},- "goal_nodes_goal_id_kind_idx": {- "name": "goal_nodes_goal_id_kind_idx",+ "linear_connections_user_id_idx": {+ "name": "linear_connections_user_id_idx","columns": [{- "expression": "goal_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "kind",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"@@ -21794,94 +26081,71 @@"method": "btree","with": {}},- "goal_nodes_task_id_unique": {- "name": "goal_nodes_task_id_unique",+ "linear_connections_workspace_id_idx": {+ "name": "linear_connections_workspace_id_idx","columns": [{- "expression": "task_id",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,- "where": "\"goal_nodes\".\"task_id\" is not null",+ "isUnique": false,"concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "goal_nodes_goal_id_goals_id_fk": {- "name": "goal_nodes_goal_id_goals_id_fk",- "tableFrom": "goal_nodes",- "tableTo": "goals",- "columnsFrom": ["goal_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "goal_nodes_task_id_tasks_id_fk": {- "name": "goal_nodes_task_id_tasks_id_fk",- "tableFrom": "goal_nodes",- "tableTo": "tasks",- "columnsFrom": ["task_id"],- "columnsTo": ["id"],- "onDelete": "set null",- "onUpdate": "no action"- },- "goal_nodes_created_by_user_id_users_id_fk": {- "name": "goal_nodes_created_by_user_id_users_id_fk",- "tableFrom": "goal_nodes",+ "linear_connections_user_id_users_id_fk": {+ "name": "linear_connections_user_id_users_id_fk",+ "tableFrom": "linear_connections","tableTo": "users",- "columnsFrom": ["created_by_user_id"],+ "columnsFrom": ["user_id"],"columnsTo": ["id"],- "onDelete": "set null",+ "onDelete": "cascade","onUpdate": "no action"},- "goal_nodes_created_by_agent_id_agents_id_fk": {- "name": "goal_nodes_created_by_agent_id_agents_id_fk",- "tableFrom": "goal_nodes",- "tableTo": "agents",- "columnsFrom": ["created_by_agent_id"],+ "linear_connections_workspace_id_workspaces_id_fk": {+ "name": "linear_connections_workspace_id_workspaces_id_fk",+ "tableFrom": "linear_connections",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],"columnsTo": ["id"],- "onDelete": "set null",+ "onDelete": "cascade","onUpdate": "no action"}},"compositePrimaryKeys": {},- "uniqueConstraints": {- "goal_nodes_goal_id_id_unique": {- "name": "goal_nodes_goal_id_id_unique",- "nullsNotDistinct": false,- "columns": ["goal_id", "id"]- }- },+ "uniqueConstraints": {},"policies": {},- "checkConstraints": {- "goal_nodes_confidence_range": {- "name": "goal_nodes_confidence_range",- "value": "\"goal_nodes\".\"confidence\" IS NULL OR (\"goal_nodes\".\"confidence\" >= 0 AND \"goal_nodes\".\"confidence\" <= 1)"- }- },+ "checkConstraints": {},"isRLSEnabled": false},- "public.goal_shares": {- "name": "goal_shares",+ "public.linear_sync_rules": {+ "name": "linear_sync_rules","schema": "","columns": {"id": {"name": "id",- "type": "text",+ "type": "uuid","primaryKey": true,- "notNull": true+ "notNull": true,+ "default": "gen_random_uuid()"},- "goal_id": {- "name": "goal_id",+ "project_id": {+ "name": "project_id","type": "text","primaryKey": false,"notNull": true},+ "connection_id": {+ "name": "connection_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },"user_id": {"name": "user_id","type": "text",@@ -21894,31 +26158,47 @@"primaryKey": false,"notNull": false},- "page_view_count": {- "name": "page_view_count",- "type": "integer",+ "team_id": {+ "name": "team_id",+ "type": "varchar(255)","primaryKey": false,- "notNull": true,- "default": 0+ "notNull": true},- "config": {- "name": "config",- "type": "jsonb",+ "team_name": {+ "name": "team_name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "linear_project_id": {+ "name": "linear_project_id",+ "type": "varchar(255)","primaryKey": false,"notNull": false},- "metadata": {- "name": "metadata",+ "linear_project_name": {+ "name": "linear_project_name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": false+ },+ "state_types": {+ "name": "state_types","type": "jsonb","primaryKey": false,+ "notNull": true+ },+ "last_run_at": {+ "name": "last_run_at",+ "type": "timestamp with time zone",+ "primaryKey": false,"notNull": false},- "visibility": {- "name": "visibility",- "type": "text",+ "last_result": {+ "name": "last_result",+ "type": "jsonb","primaryKey": false,- "notNull": true,- "default": "'private'"+ "notNull": false},"accessed_at": {"name": "accessed_at",@@ -21943,23 +26223,38 @@}},"indexes": {- "goal_shares_goal_id_unique": {- "name": "goal_shares_goal_id_unique",+ "linear_sync_rules_project_id_idx": {+ "name": "linear_sync_rules_project_id_idx","columns": [{- "expression": "goal_id",+ "expression": "project_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "goal_shares_user_id_idx": {- "name": "goal_shares_user_id_idx",+ "linear_sync_rules_connection_id_idx": {+ "name": "linear_sync_rules_connection_id_idx",+ "columns": [+ {+ "expression": "connection_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "linear_sync_rules_user_id_idx": {+ "name": "linear_sync_rules_user_id_idx","columns": [{"expression": "user_id",@@ -21973,8 +26268,8 @@"method": "btree","with": {}},- "goal_shares_workspace_id_idx": {- "name": "goal_shares_workspace_id_idx",+ "linear_sync_rules_workspace_id_idx": {+ "name": "linear_sync_rules_workspace_id_idx","columns": [{"expression": "workspace_id",@@ -21990,27 +26285,36 @@}},"foreignKeys": {- "goal_shares_goal_id_goals_id_fk": {- "name": "goal_shares_goal_id_goals_id_fk",- "tableFrom": "goal_shares",- "tableTo": "goals",- "columnsFrom": ["goal_id"],+ "linear_sync_rules_project_id_projects_id_fk": {+ "name": "linear_sync_rules_project_id_projects_id_fk",+ "tableFrom": "linear_sync_rules",+ "tableTo": "projects",+ "columnsFrom": ["project_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",+ "linear_sync_rules_connection_id_linear_connections_id_fk": {+ "name": "linear_sync_rules_connection_id_linear_connections_id_fk",+ "tableFrom": "linear_sync_rules",+ "tableTo": "linear_connections",+ "columnsFrom": ["connection_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "linear_sync_rules_user_id_users_id_fk": {+ "name": "linear_sync_rules_user_id_users_id_fk",+ "tableFrom": "linear_sync_rules","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",+ "linear_sync_rules_workspace_id_workspaces_id_fk": {+ "name": "linear_sync_rules_workspace_id_workspaces_id_fk",+ "tableFrom": "linear_sync_rules","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],@@ -22024,8 +26328,8 @@"checkConstraints": {},"isRLSEnabled": false},- "public.goal_subscriptions": {- "name": "goal_subscriptions",+ "public.llm_generation_tracing": {+ "name": "llm_generation_tracing","schema": "","columns": {"id": {@@ -22035,20 +26339,26 @@"notNull": true,"default": "gen_random_uuid()"},- "goal_id": {- "name": "goal_id",+ "scenario": {+ "name": "scenario","type": "text","primaryKey": false,"notNull": true},- "widget_id": {- "name": "widget_id",- "type": "uuid",+ "prompt_version": {+ "name": "prompt_version",+ "type": "text","primaryKey": false,"notNull": true},- "metric_id": {- "name": "metric_id",+ "prompt_hash": {+ "name": "prompt_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "schema_name": {+ "name": "schema_name","type": "text","primaryKey": false,"notNull": false@@ -22059,63 +26369,163 @@"primaryKey": false,"notNull": true},+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "topic_id": {+ "name": "topic_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },"workspace_id": {"name": "workspace_id","type": "text","primaryKey": false,"notNull": false},- "enabled": {- "name": "enabled",+ "trigger": {+ "name": "trigger",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "parent_tracing_id": {+ "name": "parent_tracing_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "model": {+ "name": "model",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "success": {+ "name": "success",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true+ },+ "error_code": {+ "name": "error_code",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "error_detail": {+ "name": "error_detail",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "validation_failed": {+ "name": "validation_failed","type": "boolean","primaryKey": false,"notNull": true,"default": false},- "confirmed_version_id": {- "name": "confirmed_version_id",- "type": "uuid",+ "input_hash": {+ "name": "input_hash",+ "type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "binding_revision": {- "name": "binding_revision",+ "input_hint": {+ "name": "input_hint",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "latency_ms": {+ "name": "latency_ms","type": "integer","primaryKey": false,- "notNull": true,- "default": 1+ "notNull": false},- "binding": {- "name": "binding",- "type": "jsonb",+ "input_tokens": {+ "name": "input_tokens",+ "type": "integer","primaryKey": false,- "notNull": true+ "notNull": false},- "wake_condition": {- "name": "wake_condition",- "type": "jsonb",+ "output_tokens": {+ "name": "output_tokens",+ "type": "integer","primaryKey": false,- "notNull": true+ "notNull": false},- "freshness_policy": {- "name": "freshness_policy",- "type": "jsonb",+ "cost_usd": {+ "name": "cost_usd",+ "type": "numeric(12, 8)","primaryKey": false,- "notNull": true+ "notNull": false},- "cursor": {- "name": "cursor",+ "storage_key": {+ "name": "storage_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "feedback_signal": {+ "name": "feedback_signal",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "feedback_score": {+ "name": "feedback_score",+ "type": "numeric(3, 2)",+ "primaryKey": false,+ "notNull": false+ },+ "feedback_source": {+ "name": "feedback_source",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "feedback_data": {+ "name": "feedback_data","type": "jsonb","primaryKey": false,- "notNull": true,- "default": "'{}'::jsonb"+ "notNull": false},- "accessed_at": {- "name": "accessed_at",+ "feedback_updated_at": {+ "name": "feedback_updated_at","type": "timestamp with time zone","primaryKey": false,- "notNull": true,- "default": "now()"+ "notNull": false+ },+ "trace_id": {+ "name": "trace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "span_id": {+ "name": "span_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'{}'::jsonb"},"created_at": {"name": "created_at",@@ -22123,127 +26533,134 @@"primaryKey": false,"notNull": true,"default": "now()"- },- "updated_at": {- "name": "updated_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": true,- "default": "now()"}},"indexes": {- "goal_subscriptions_goal_widget_metric_unique": {- "name": "goal_subscriptions_goal_widget_metric_unique",+ "llm_generation_tracing_scenario_idx": {+ "name": "llm_generation_tracing_scenario_idx","columns": [{- "expression": "goal_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "widget_id",+ "expression": "scenario","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "llm_generation_tracing_prompt_version_idx": {+ "name": "llm_generation_tracing_prompt_version_idx",+ "columns": [{- "expression": "metric_id",+ "expression": "prompt_version","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,- "where": "\"goal_subscriptions\".\"metric_id\" IS NOT NULL",+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "goal_subscriptions_goal_widget_result_unique": {- "name": "goal_subscriptions_goal_widget_result_unique",+ "llm_generation_tracing_user_id_idx": {+ "name": "llm_generation_tracing_user_id_idx","columns": [{- "expression": "goal_id",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "llm_generation_tracing_agent_id_idx": {+ "name": "llm_generation_tracing_agent_id_idx",+ "columns": [{- "expression": "widget_id",+ "expression": "agent_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,- "where": "\"goal_subscriptions\".\"metric_id\" IS NULL",+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "goal_subscriptions_widget_enabled_idx": {- "name": "goal_subscriptions_widget_enabled_idx",+ "llm_generation_tracing_topic_id_idx": {+ "name": "llm_generation_tracing_topic_id_idx","columns": [{- "expression": "widget_id",+ "expression": "topic_id","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "llm_generation_tracing_workspace_id_idx": {+ "name": "llm_generation_tracing_workspace_id_idx",+ "columns": [{"expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"- },- {- "expression": "user_id",- "isExpression": false,- "asc": true,- "nulls": "last"}],"isUnique": false,- "where": "\"goal_subscriptions\".\"enabled\" = true","concurrently": false,"method": "btree","with": {}},- "goal_subscriptions_personal_idx": {- "name": "goal_subscriptions_personal_idx",+ "llm_generation_tracing_provider_idx": {+ "name": "llm_generation_tracing_provider_idx","columns": [{- "expression": "user_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "goal_id",+ "expression": "provider","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,- "where": "\"goal_subscriptions\".\"workspace_id\" IS NULL","concurrently": false,"method": "btree","with": {}},- "goal_subscriptions_workspace_idx": {- "name": "goal_subscriptions_workspace_idx",+ "llm_generation_tracing_model_idx": {+ "name": "llm_generation_tracing_model_idx","columns": [{- "expression": "workspace_id",+ "expression": "model","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "llm_generation_tracing_success_idx": {+ "name": "llm_generation_tracing_success_idx",+ "columns": [{- "expression": "goal_id",+ "expression": "success","isExpression": false,"asc": true,"nulls": "last"@@ -22254,11 +26671,11 @@"method": "btree","with": {}},- "goal_subscriptions_metric_id_idx": {- "name": "goal_subscriptions_metric_id_idx",+ "llm_generation_tracing_error_code_idx": {+ "name": "llm_generation_tracing_error_code_idx","columns": [{- "expression": "metric_id",+ "expression": "error_code","isExpression": false,"asc": true,"nulls": "last"@@ -22269,11 +26686,11 @@"method": "btree","with": {}},- "goal_subscriptions_confirmed_version_id_idx": {- "name": "goal_subscriptions_confirmed_version_id_idx",+ "llm_generation_tracing_validation_failed_idx": {+ "name": "llm_generation_tracing_validation_failed_idx","columns": [{- "expression": "confirmed_version_id",+ "expression": "validation_failed","isExpression": false,"asc": true,"nulls": "last"@@ -22284,213 +26701,123 @@"method": "btree","with": {}},- "goal_subscriptions_reconcile_idx": {- "name": "goal_subscriptions_reconcile_idx",+ "llm_generation_tracing_feedback_signal_idx": {+ "name": "llm_generation_tracing_feedback_signal_idx","columns": [{- "expression": "updated_at",+ "expression": "feedback_signal","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "llm_generation_tracing_created_at_idx": {+ "name": "llm_generation_tracing_created_at_idx",+ "columns": [{- "expression": "id",+ "expression": "created_at","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,- "where": "\"goal_subscriptions\".\"enabled\" = true","concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "goal_subscriptions_goal_id_goals_id_fk": {- "name": "goal_subscriptions_goal_id_goals_id_fk",- "tableFrom": "goal_subscriptions",- "tableTo": "goals",- "columnsFrom": ["goal_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "goal_subscriptions_widget_id_widgets_id_fk": {- "name": "goal_subscriptions_widget_id_widgets_id_fk",- "tableFrom": "goal_subscriptions",- "tableTo": "widgets",- "columnsFrom": ["widget_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "goal_subscriptions_metric_id_metrics_id_fk": {- "name": "goal_subscriptions_metric_id_metrics_id_fk",- "tableFrom": "goal_subscriptions",- "tableTo": "metrics",- "columnsFrom": ["metric_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "goal_subscriptions_user_id_users_id_fk": {- "name": "goal_subscriptions_user_id_users_id_fk",- "tableFrom": "goal_subscriptions",- "tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "goal_subscriptions_workspace_id_workspaces_id_fk": {- "name": "goal_subscriptions_workspace_id_workspaces_id_fk",- "tableFrom": "goal_subscriptions",+ "llm_generation_tracing_workspace_id_workspaces_id_fk": {+ "name": "llm_generation_tracing_workspace_id_workspaces_id_fk",+ "tableFrom": "llm_generation_tracing","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"- },- "goal_subscriptions_confirmed_version_id_widget_versions_id_fk": {- "name": "goal_subscriptions_confirmed_version_id_widget_versions_id_fk",- "tableFrom": "goal_subscriptions",- "tableTo": "widget_versions",- "columnsFrom": ["confirmed_version_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"}},"compositePrimaryKeys": {},"uniqueConstraints": {},"policies": {},- "checkConstraints": {- "goal_subscriptions_binding_revision_positive": {- "name": "goal_subscriptions_binding_revision_positive",- "value": "\"goal_subscriptions\".\"binding_revision\" > 0"- }- },+ "checkConstraints": {},"isRLSEnabled": false},- "public.goal_traces": {- "name": "goal_traces",+ "public.meeting_minutes": {+ "name": "meeting_minutes","schema": "","columns": {- "goal_id": {- "name": "goal_id",- "type": "text",+ "id": {+ "name": "id",+ "type": "uuid","primaryKey": true,- "notNull": true- },- "trace_s3_key": {- "name": "trace_s3_key",- "type": "text",- "primaryKey": false,- "notNull": false- },- "started_at": {- "name": "started_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "gen_random_uuid()"},- "completed_at": {- "name": "completed_at",- "type": "timestamp with time zone",+ "meeting_id": {+ "name": "meeting_id",+ "type": "uuid","primaryKey": false,- "notNull": false+ "notNull": true},- "final_status": {- "name": "final_status",+ "summary": {+ "name": "summary","type": "text","primaryKey": false,"notNull": false},- "advances_total": {- "name": "advances_total",- "type": "integer",- "primaryKey": false,- "notNull": false- },- "ticks_total": {- "name": "ticks_total",- "type": "integer",- "primaryKey": false,- "notNull": false- },- "advances_by_trigger": {- "name": "advances_by_trigger",+ "chapters": {+ "name": "chapters","type": "jsonb","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "'[]'::jsonb"},- "advances_by_outcome": {- "name": "advances_by_outcome",+ "decisions": {+ "name": "decisions","type": "jsonb","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "'[]'::jsonb"},- "ticks_by_branch": {- "name": "ticks_by_branch",+ "action_items": {+ "name": "action_items","type": "jsonb","primaryKey": false,- "notNull": false- },- "total_cost": {- "name": "total_cost",- "type": "numeric(20, 6)",- "primaryKey": false,- "notNull": false- },- "work_operations": {- "name": "work_operations",- "type": "integer",- "primaryKey": false,- "notNull": false- },- "nodes_total": {- "name": "nodes_total",- "type": "integer",- "primaryKey": false,- "notNull": false- },- "work_resolved": {- "name": "work_resolved",- "type": "integer",- "primaryKey": false,- "notNull": false- },- "work_retired": {- "name": "work_retired",- "type": "integer",- "primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "'[]'::jsonb"},- "findings_total": {- "name": "findings_total",- "type": "integer",+ "keywords": {+ "name": "keywords",+ "type": "jsonb","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "'[]'::jsonb"},- "gates_opened": {- "name": "gates_opened",- "type": "integer",+ "document_id": {+ "name": "document_id",+ "type": "text","primaryKey": false,"notNull": false},- "gates_resolved": {- "name": "gates_resolved",- "type": "integer",+ "model": {+ "name": "model",+ "type": "text","primaryKey": false,"notNull": false},- "human_waiting_ms": {- "name": "human_waiting_ms",- "type": "integer",+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "now()"},"created_at": {"name": "created_at",@@ -22508,26 +26835,26 @@}},"indexes": {- "goal_traces_started_at_idx": {- "name": "goal_traces_started_at_idx",+ "meeting_minutes_meeting_id_unique": {+ "name": "meeting_minutes_meeting_id_unique","columns": [{- "expression": "started_at",+ "expression": "meeting_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,"concurrently": false,"method": "btree","with": {}},- "goal_traces_final_status_idx": {- "name": "goal_traces_final_status_idx",+ "meeting_minutes_document_id_idx": {+ "name": "meeting_minutes_document_id_idx","columns": [{- "expression": "final_status",+ "expression": "document_id","isExpression": false,"asc": true,"nulls": "last"@@ -22540,14 +26867,23 @@}},"foreignKeys": {- "goal_traces_goal_id_goals_id_fk": {- "name": "goal_traces_goal_id_goals_id_fk",- "tableFrom": "goal_traces",- "tableTo": "goals",- "columnsFrom": ["goal_id"],+ "meeting_minutes_meeting_id_meetings_id_fk": {+ "name": "meeting_minutes_meeting_id_meetings_id_fk",+ "tableFrom": "meeting_minutes",+ "tableTo": "meetings",+ "columnsFrom": ["meeting_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"+ },+ "meeting_minutes_document_id_documents_id_fk": {+ "name": "meeting_minutes_document_id_documents_id_fk",+ "tableFrom": "meeting_minutes",+ "tableTo": "documents",+ "columnsFrom": ["document_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"}},"compositePrimaryKeys": {},@@ -22556,8 +26892,8 @@"checkConstraints": {},"isRLSEnabled": false},- "public.linear_connections": {- "name": "linear_connections",+ "public.meeting_segments": {+ "name": "meeting_segments","schema": "","columns": {"id": {@@ -22567,72 +26903,47 @@"notNull": true,"default": "gen_random_uuid()"},- "user_id": {- "name": "user_id",- "type": "text",+ "meeting_id": {+ "name": "meeting_id",+ "type": "uuid","primaryKey": false,"notNull": true},- "workspace_id": {- "name": "workspace_id",- "type": "text",+ "speaker_id": {+ "name": "speaker_id",+ "type": "uuid","primaryKey": false,"notNull": false},- "organization_id": {- "name": "organization_id",- "type": "varchar(255)",- "primaryKey": false,- "notNull": true- },- "organization_name": {- "name": "organization_name",- "type": "varchar(255)",+ "source": {+ "name": "source",+ "type": "text","primaryKey": false,"notNull": true},- "organization_url_key": {- "name": "organization_url_key",- "type": "varchar(255)",+ "seq": {+ "name": "seq",+ "type": "integer","primaryKey": false,"notNull": true},- "actor_external_id": {- "name": "actor_external_id",- "type": "varchar(255)",+ "start_ms": {+ "name": "start_ms",+ "type": "integer","primaryKey": false,"notNull": true},- "actor_name": {- "name": "actor_name",- "type": "varchar(255)",+ "end_ms": {+ "name": "end_ms",+ "type": "integer","primaryKey": false,"notNull": true},- "credentials": {- "name": "credentials",+ "text": {+ "name": "text","type": "text","primaryKey": false,- "notNull": false- },- "token_expires_at": {- "name": "token_expires_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": false- },- "revoked_at": {- "name": "revoked_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": false- },- "metadata": {- "name": "metadata",- "type": "jsonb",- "primaryKey": false,- "notNull": true,- "default": "'{}'::jsonb"+ "notNull": true},"accessed_at": {"name": "accessed_at",@@ -22657,61 +26968,50 @@}},"indexes": {- "linear_connections_org_personal_unique": {- "name": "linear_connections_org_personal_unique",+ "meeting_segments_meeting_id_source_seq_unique": {+ "name": "meeting_segments_meeting_id_source_seq_unique","columns": [{- "expression": "organization_id",+ "expression": "meeting_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "user_id",+ "expression": "source",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "seq","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": true,- "where": "\"linear_connections\".\"workspace_id\" is null","concurrently": false,"method": "btree","with": {}},- "linear_connections_org_workspace_unique": {- "name": "linear_connections_org_workspace_unique",+ "meeting_segments_meeting_id_source_start_ms_idx": {+ "name": "meeting_segments_meeting_id_source_start_ms_idx","columns": [{- "expression": "organization_id",+ "expression": "meeting_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "user_id",+ "expression": "source","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "workspace_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": true,- "where": "\"linear_connections\".\"workspace_id\" is not null",- "concurrently": false,- "method": "btree",- "with": {}- },- "linear_connections_user_id_idx": {- "name": "linear_connections_user_id_idx",- "columns": [- {- "expression": "user_id",+ "expression": "start_ms","isExpression": false,"asc": true,"nulls": "last"@@ -22722,11 +27022,11 @@"method": "btree","with": {}},- "linear_connections_workspace_id_idx": {- "name": "linear_connections_workspace_id_idx",+ "meeting_segments_speaker_id_idx": {+ "name": "meeting_segments_speaker_id_idx","columns": [{- "expression": "workspace_id",+ "expression": "speaker_id","isExpression": false,"asc": true,"nulls": "last"@@ -22739,22 +27039,22 @@}},"foreignKeys": {- "linear_connections_user_id_users_id_fk": {- "name": "linear_connections_user_id_users_id_fk",- "tableFrom": "linear_connections",- "tableTo": "users",- "columnsFrom": ["user_id"],+ "meeting_segments_meeting_id_meetings_id_fk": {+ "name": "meeting_segments_meeting_id_meetings_id_fk",+ "tableFrom": "meeting_segments",+ "tableTo": "meetings",+ "columnsFrom": ["meeting_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"},- "linear_connections_workspace_id_workspaces_id_fk": {- "name": "linear_connections_workspace_id_workspaces_id_fk",- "tableFrom": "linear_connections",- "tableTo": "workspaces",- "columnsFrom": ["workspace_id"],+ "meeting_segments_speaker_id_meeting_speakers_id_fk": {+ "name": "meeting_segments_speaker_id_meeting_speakers_id_fk",+ "tableFrom": "meeting_segments",+ "tableTo": "meeting_speakers",+ "columnsFrom": ["speaker_id"],"columnsTo": ["id"],- "onDelete": "cascade",+ "onDelete": "set null","onUpdate": "no action"}},@@ -22764,8 +27064,8 @@"checkConstraints": {},"isRLSEnabled": false},- "public.linear_sync_rules": {- "name": "linear_sync_rules",+ "public.meeting_speakers": {+ "name": "meeting_speakers","schema": "","columns": {"id": {@@ -22775,72 +27075,24 @@"notNull": true,"default": "gen_random_uuid()"},- "project_id": {- "name": "project_id",- "type": "text",- "primaryKey": false,- "notNull": true- },- "connection_id": {- "name": "connection_id",+ "meeting_id": {+ "name": "meeting_id","type": "uuid","primaryKey": false,"notNull": true},- "user_id": {- "name": "user_id",+ "label": {+ "name": "label","type": "text","primaryKey": false,"notNull": true},- "workspace_id": {- "name": "workspace_id",+ "display_name": {+ "name": "display_name","type": "text","primaryKey": false,"notNull": false},- "team_id": {- "name": "team_id",- "type": "varchar(255)",- "primaryKey": false,- "notNull": true- },- "team_name": {- "name": "team_name",- "type": "varchar(255)",- "primaryKey": false,- "notNull": true- },- "linear_project_id": {- "name": "linear_project_id",- "type": "varchar(255)",- "primaryKey": false,- "notNull": false- },- "linear_project_name": {- "name": "linear_project_name",- "type": "varchar(255)",- "primaryKey": false,- "notNull": false- },- "state_types": {- "name": "state_types",- "type": "jsonb",- "primaryKey": false,- "notNull": true- },- "last_run_at": {- "name": "last_run_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": false- },- "last_result": {- "name": "last_result",- "type": "jsonb",- "primaryKey": false,- "notNull": false- },"accessed_at": {"name": "accessed_at","type": "timestamp with time zone",@@ -22864,100 +27116,34 @@}},"indexes": {- "linear_sync_rules_project_id_idx": {- "name": "linear_sync_rules_project_id_idx",+ "meeting_speakers_meeting_id_label_unique": {+ "name": "meeting_speakers_meeting_id_label_unique","columns": [{- "expression": "project_id",+ "expression": "meeting_id","isExpression": false,"asc": true,"nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "linear_sync_rules_connection_id_idx": {- "name": "linear_sync_rules_connection_id_idx",- "columns": [- {- "expression": "connection_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "linear_sync_rules_user_id_idx": {- "name": "linear_sync_rules_user_id_idx",- "columns": [- {- "expression": "user_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "linear_sync_rules_workspace_id_idx": {- "name": "linear_sync_rules_workspace_id_idx",- "columns": [+ },{- "expression": "workspace_id",+ "expression": "label","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,"concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "linear_sync_rules_project_id_projects_id_fk": {- "name": "linear_sync_rules_project_id_projects_id_fk",- "tableFrom": "linear_sync_rules",- "tableTo": "projects",- "columnsFrom": ["project_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "linear_sync_rules_connection_id_linear_connections_id_fk": {- "name": "linear_sync_rules_connection_id_linear_connections_id_fk",- "tableFrom": "linear_sync_rules",- "tableTo": "linear_connections",- "columnsFrom": ["connection_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "linear_sync_rules_user_id_users_id_fk": {- "name": "linear_sync_rules_user_id_users_id_fk",- "tableFrom": "linear_sync_rules",- "tableTo": "users",- "columnsFrom": ["user_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- },- "linear_sync_rules_workspace_id_workspaces_id_fk": {- "name": "linear_sync_rules_workspace_id_workspaces_id_fk",- "tableFrom": "linear_sync_rules",- "tableTo": "workspaces",- "columnsFrom": ["workspace_id"],+ "meeting_speakers_meeting_id_meetings_id_fk": {+ "name": "meeting_speakers_meeting_id_meetings_id_fk",+ "tableFrom": "meeting_speakers",+ "tableTo": "meetings",+ "columnsFrom": ["meeting_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"@@ -22969,8 +27155,8 @@"checkConstraints": {},"isRLSEnabled": false},- "public.llm_generation_tracing": {- "name": "llm_generation_tracing",+ "public.meetings": {+ "name": "meetings","schema": "","columns": {"id": {@@ -22980,193 +27166,106 @@"notNull": true,"default": "gen_random_uuid()"},- "scenario": {- "name": "scenario",- "type": "text",- "primaryKey": false,- "notNull": true- },- "prompt_version": {- "name": "prompt_version",- "type": "text",- "primaryKey": false,- "notNull": true- },- "prompt_hash": {- "name": "prompt_hash",- "type": "text",- "primaryKey": false,- "notNull": true- },- "schema_name": {- "name": "schema_name",- "type": "text",- "primaryKey": false,- "notNull": false- },"user_id": {"name": "user_id","type": "text","primaryKey": false,"notNull": true},- "agent_id": {- "name": "agent_id",- "type": "text",- "primaryKey": false,- "notNull": false- },- "topic_id": {- "name": "topic_id",- "type": "text",- "primaryKey": false,- "notNull": false- },"workspace_id": {"name": "workspace_id","type": "text","primaryKey": false,"notNull": false},- "trigger": {- "name": "trigger",+ "title": {+ "name": "title","type": "text","primaryKey": false,- "notNull": false- },- "parent_tracing_id": {- "name": "parent_tracing_id",- "type": "uuid",- "primaryKey": false,- "notNull": false+ "notNull": true},- "provider": {- "name": "provider",+ "status": {+ "name": "status","type": "text","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "'recording'"},- "model": {- "name": "model",+ "platform": {+ "name": "platform","type": "text","primaryKey": false,- "notNull": false- },- "success": {- "name": "success",- "type": "boolean",- "primaryKey": false,"notNull": true},- "error_code": {- "name": "error_code",- "type": "text",- "primaryKey": false,- "notNull": false- },- "error_detail": {- "name": "error_detail",+ "realtime_provider": {+ "name": "realtime_provider","type": "text","primaryKey": false,- "notNull": false- },- "validation_failed": {- "name": "validation_failed",- "type": "boolean",- "primaryKey": false,- "notNull": true,- "default": false+ "notNull": true},- "input_hash": {- "name": "input_hash",+ "refine_provider": {+ "name": "refine_provider","type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "input_hint": {- "name": "input_hint",+ "language": {+ "name": "language","type": "text","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "'auto'"},- "latency_ms": {- "name": "latency_ms",- "type": "integer",+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "now()"},- "input_tokens": {- "name": "input_tokens",- "type": "integer",+ "ended_at": {+ "name": "ended_at",+ "type": "timestamp with time zone","primaryKey": false,"notNull": false},- "output_tokens": {- "name": "output_tokens",+ "duration_ms": {+ "name": "duration_ms","type": "integer","primaryKey": false,"notNull": false},- "cost_usd": {- "name": "cost_usd",- "type": "numeric(12, 8)",- "primaryKey": false,- "notNull": false- },- "storage_key": {- "name": "storage_key",- "type": "text",- "primaryKey": false,- "notNull": false- },- "feedback_signal": {- "name": "feedback_signal",+ "audio_file_id": {+ "name": "audio_file_id","type": "text","primaryKey": false,"notNull": false},- "feedback_score": {- "name": "feedback_score",- "type": "numeric(3, 2)",- "primaryKey": false,- "notNull": false- },- "feedback_source": {- "name": "feedback_source",+ "local_audio_path": {+ "name": "local_audio_path","type": "text","primaryKey": false,"notNull": false},- "feedback_data": {- "name": "feedback_data",+ "error": {+ "name": "error","type": "jsonb","primaryKey": false,"notNull": false},- "feedback_updated_at": {- "name": "feedback_updated_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": false- },- "trace_id": {- "name": "trace_id",- "type": "text",- "primaryKey": false,- "notNull": false- },- "span_id": {- "name": "span_id",+ "visibility": {+ "name": "visibility","type": "text","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "'private'"},- "metadata": {- "name": "metadata",- "type": "jsonb",+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": false,- "default": "'{}'::jsonb"+ "notNull": true,+ "default": "now()"},"created_at": {"name": "created_at",@@ -23174,149 +27273,33 @@"primaryKey": false,"notNull": true,"default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"}},"indexes": {- "llm_generation_tracing_scenario_idx": {- "name": "llm_generation_tracing_scenario_idx",- "columns": [- {- "expression": "scenario",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "llm_generation_tracing_prompt_version_idx": {- "name": "llm_generation_tracing_prompt_version_idx",- "columns": [- {- "expression": "prompt_version",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "llm_generation_tracing_user_id_idx": {- "name": "llm_generation_tracing_user_id_idx",+ "meetings_user_id_workspace_id_created_at_idx": {+ "name": "meetings_user_id_workspace_id_created_at_idx","columns": [{"expression": "user_id","isExpression": false,"asc": true,"nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "llm_generation_tracing_agent_id_idx": {- "name": "llm_generation_tracing_agent_id_idx",- "columns": [- {- "expression": "agent_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "llm_generation_tracing_topic_id_idx": {- "name": "llm_generation_tracing_topic_id_idx",- "columns": [- {- "expression": "topic_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "llm_generation_tracing_workspace_id_idx": {- "name": "llm_generation_tracing_workspace_id_idx",- "columns": [+ },{"expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "llm_generation_tracing_provider_idx": {- "name": "llm_generation_tracing_provider_idx",- "columns": [- {- "expression": "provider",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "llm_generation_tracing_model_idx": {- "name": "llm_generation_tracing_model_idx",- "columns": [- {- "expression": "model",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "llm_generation_tracing_success_idx": {- "name": "llm_generation_tracing_success_idx",- "columns": [- {- "expression": "success",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "llm_generation_tracing_error_code_idx": {- "name": "llm_generation_tracing_error_code_idx",- "columns": [+ },{- "expression": "error_code",+ "expression": "created_at","isExpression": false,"asc": true,"nulls": "last"@@ -23327,26 +27310,17 @@"method": "btree","with": {}},- "llm_generation_tracing_validation_failed_idx": {- "name": "llm_generation_tracing_validation_failed_idx",+ "meetings_workspace_id_created_at_idx": {+ "name": "meetings_workspace_id_created_at_idx","columns": [{- "expression": "validation_failed",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- },- "llm_generation_tracing_feedback_signal_idx": {- "name": "llm_generation_tracing_feedback_signal_idx",- "columns": [+ },{- "expression": "feedback_signal",+ "expression": "created_at","isExpression": false,"asc": true,"nulls": "last"@@ -23357,11 +27331,11 @@"method": "btree","with": {}},- "llm_generation_tracing_created_at_idx": {- "name": "llm_generation_tracing_created_at_idx",+ "meetings_audio_file_id_idx": {+ "name": "meetings_audio_file_id_idx","columns": [{- "expression": "created_at",+ "expression": "audio_file_id","isExpression": false,"asc": true,"nulls": "last"@@ -23374,14 +27348,32 @@}},"foreignKeys": {- "llm_generation_tracing_workspace_id_workspaces_id_fk": {- "name": "llm_generation_tracing_workspace_id_workspaces_id_fk",- "tableFrom": "llm_generation_tracing",+ "meetings_user_id_users_id_fk": {+ "name": "meetings_user_id_users_id_fk",+ "tableFrom": "meetings",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "meetings_workspace_id_workspaces_id_fk": {+ "name": "meetings_workspace_id_workspaces_id_fk",+ "tableFrom": "meetings","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],"onDelete": "cascade","onUpdate": "no action"+ },+ "meetings_audio_file_id_files_id_fk": {+ "name": "meetings_audio_file_id_files_id_fk",+ "tableFrom": "meetings",+ "tableTo": "files",+ "columnsFrom": ["audio_file_id"],+ "columnsTo": ["id"],+ "onDelete": "set null",+ "onUpdate": "no action"}},"compositePrimaryKeys": {},@@ -47912,6 +51904,13 @@"primaryKey": false,"notNull": false},+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },"joined_at": {"name": "joined_at","type": "timestamp with time zone",diff --git a/packages/database/migrations/meta/_journal.json b/packages/database/migrations/meta/_journal.jsonindex 2b91f5ac1c2..4548938e425 100644--- a/packages/database/migrations/meta/_journal.json+++ b/packages/database/migrations/meta/_journal.json@@ -1519,6 +1519,13 @@"when": 1794814012290,"tag": "0216_inbound_webhooks","breakpoints": true+ },+ {+ "idx": 217,+ "version": "7",+ "when": 1794843685342,+ "tag": "0217_artboards",+ "breakpoints": true}],"version": "6"diff --git a/packages/database/src/schemas/artboard.ts b/packages/database/src/schemas/artboard.tsnew file mode 100644index 00000000000..b43f1eac814--- /dev/null+++ b/packages/database/src/schemas/artboard.ts@@ -0,0 +1,332 @@+import type {+ ArtboardBoardMetadata,+ ArtboardBoardType,+ ArtboardCommentAnchor,+ ArtboardCommentMetadata,+ ArtboardEdgeMetadata,+ ArtboardGroupKind,+ ArtboardGroupMetadata,+ ArtboardMetadata,+ ArtboardPageMetadata,+ ArtboardPhase,+ ArtboardRect,+ ArtboardRoundMetadata,+ ArtboardRoundStatus,+} from '@lobechat/types';+import { sql } from 'drizzle-orm';+import type { AnyPgColumn } from 'drizzle-orm/pg-core';+import {+ boolean,+ check,+ index,+ integer,+ jsonb,+ pgTable,+ text,+ uniqueIndex,+ uuid,+} from 'drizzle-orm/pg-core';++import { idGenerator } from '../utils/idGenerator';+import { timestamps, timestamptz } from './_helpers';+import { agents } from './agent';+import { files } from './file';+import { projects } from './project';+import { tasks } from './task';+import { topics } from './topic';+import { users } from './user';+import { acceptances } from './verify';+import { workVersions } from './work';+import { workspaces } from './workspace';++const ownerColumns = {+ userId: text('user_id')+ .references(() => users.id, { onDelete: 'cascade' })+ .notNull(),+ workspaceId: text('workspace_id').references(() => workspaces.id, { onDelete: 'cascade' }),+};++const artboardRef = () =>+ text('artboard_id')+ .references(() => artboards.id, { onDelete: 'cascade' })+ .notNull();++export const artboards = pgTable(+ 'artboards',+ {+ id: text('id')+ .primaryKey()+ .$defaultFn(() => idGenerator('artboards'))+ .notNull(),+ ...ownerColumns,+ topicId: text('topic_id').references(() => topics.id, { onDelete: 'set null' }),+ taskId: text('task_id').references(() => tasks.id, { onDelete: 'set null' }),+ projectId: text('project_id').references(() => projects.id, { onDelete: 'set null' }),+ acceptanceId: uuid('acceptance_id').references(() => acceptances.id, {+ onDelete: 'set null',+ }),+ title: text('title').notNull(),+ description: text('description'),+ content: text('content'),+ phase: text('phase').$type<ArtboardPhase>().notNull().default('discuss'),+ // Bumped only by canvas-structure writes; comments and choices leave it alone.+ revision: integer('revision').notNull().default(1),+ metadata: jsonb('metadata').$type<ArtboardMetadata>(),+ ...timestamps,+ },+ (t) => [+ index('artboards_user_id_idx').on(t.userId),+ index('artboards_workspace_id_idx')+ .on(t.workspaceId)+ .where(sql`${t.workspaceId} IS NOT NULL`),+ index('artboards_topic_id_idx')+ .on(t.topicId)+ .where(sql`${t.topicId} IS NOT NULL`),+ index('artboards_task_id_idx')+ .on(t.taskId)+ .where(sql`${t.taskId} IS NOT NULL`),+ index('artboards_project_id_idx').on(t.projectId),+ index('artboards_phase_idx').on(t.phase),+ index('artboards_created_at_idx').on(t.createdAt),+ index('artboards_updated_at_idx').on(t.updatedAt),+ ],+);++export const artboardPages = pgTable(+ 'artboard_pages',+ {+ id: text('id')+ .primaryKey()+ .$defaultFn(() => idGenerator('artboardPages'))+ .notNull(),+ artboardId: artboardRef(),+ ...ownerColumns,+ name: text('name').notNull(),+ sortOrder: integer('sort_order').notNull().default(0),+ metadata: jsonb('metadata').$type<ArtboardPageMetadata>(),+ ...timestamps,+ },+ (t) => [+ index('artboard_pages_artboard_id_idx').on(t.artboardId),+ index('artboard_pages_user_id_idx').on(t.userId),+ index('artboard_pages_workspace_id_idx')+ .on(t.workspaceId)+ .where(sql`${t.workspaceId} IS NOT NULL`),+ ],+);++export const artboardRounds = pgTable(+ 'artboard_rounds',+ {+ id: uuid('id').defaultRandom().primaryKey().notNull(),+ artboardId: artboardRef(),+ pageId: text('page_id')+ .references(() => artboardPages.id)+ .notNull(),+ ...ownerColumns,+ title: text('title').notNull(),+ status: text('status').$type<ArtboardRoundStatus>().notNull().default('open'),+ recommendedBoardId: uuid('recommended_board_id').references(+ (): AnyPgColumn => artboardBoards.id,+ { onDelete: 'set null' },+ ),+ // A draft while the round is open; it takes effect when the round is submitted.+ chosenBoardId: uuid('chosen_board_id').references((): AnyPgColumn => artboardBoards.id, {+ onDelete: 'set null',+ }),+ selectedBy: text('selected_by').references(() => users.id, { onDelete: 'set null' }),+ selectedAt: timestamptz('selected_at'),+ metadata: jsonb('metadata').$type<ArtboardRoundMetadata>(),+ ...timestamps,+ },+ (t) => [+ index('artboard_rounds_artboard_id_idx').on(t.artboardId),+ index('artboard_rounds_page_id_idx').on(t.pageId),+ index('artboard_rounds_user_id_idx').on(t.userId),+ index('artboard_rounds_workspace_id_idx')+ .on(t.workspaceId)+ .where(sql`${t.workspaceId} IS NOT NULL`),+ index('artboard_rounds_recommended_board_id_idx')+ .on(t.recommendedBoardId)+ .where(sql`${t.recommendedBoardId} IS NOT NULL`),+ index('artboard_rounds_chosen_board_id_idx')+ .on(t.chosenBoardId)+ .where(sql`${t.chosenBoardId} IS NOT NULL`),+ ],+);++export const artboardGroups = pgTable(+ 'artboard_groups',+ {+ id: text('id')+ .primaryKey()+ .$defaultFn(() => idGenerator('artboardGroups'))+ .notNull(),+ artboardId: artboardRef(),+ pageId: text('page_id')+ .references(() => artboardPages.id)+ .notNull(),+ ...ownerColumns,+ kind: text('kind').$type<ArtboardGroupKind>().notNull(),+ title: text('title').notNull(),+ description: text('description'),+ rect: jsonb('rect').$type<ArtboardRect>().notNull(),+ metadata: jsonb('metadata').$type<ArtboardGroupMetadata>(),+ ...timestamps,+ },+ (t) => [+ index('artboard_groups_artboard_id_idx').on(t.artboardId),+ index('artboard_groups_page_id_idx').on(t.pageId),+ index('artboard_groups_user_id_idx').on(t.userId),+ index('artboard_groups_workspace_id_idx')+ .on(t.workspaceId)+ .where(sql`${t.workspaceId} IS NOT NULL`),+ ],+);++export const artboardBoards = pgTable(+ 'artboard_boards',+ {+ id: uuid('id').defaultRandom().primaryKey().notNull(),+ artboardId: artboardRef(),+ pageId: text('page_id')+ .references(() => artboardPages.id)+ .notNull(),+ groupId: text('group_id').references(() => artboardGroups.id),+ roundId: uuid('round_id').references(() => artboardRounds.id, { onDelete: 'set null' }),+ ...ownerColumns,+ projectId: text('project_id').references(() => projects.id, { onDelete: 'set null' }),+ // No foreign key on purpose: publishing an acceptance flow deletes and reinserts its nodes+ // under the same ids, and any ON DELETE action would drop the link each time.+ acceptanceFlowNodeId: uuid('acceptance_flow_node_id'),+ type: text('type').$type<ArtboardBoardType>().notNull(),+ title: text('title').notNull(),+ description: text('description'),+ expected: text('expected'),+ rect: jsonb('rect').$type<ArtboardRect>().notNull(),+ sourceWorkVersionId: uuid('source_work_version_id').references(() => workVersions.id, {+ onDelete: 'set null',+ }),+ sourcePath: text('source_path'),+ sourceFileId: text('source_file_id').references(() => files.id, { onDelete: 'set null' }),+ metadata: jsonb('metadata').$type<ArtboardBoardMetadata>(),+ ...timestamps,+ },+ (t) => [+ check(+ 'artboard_boards_single_source_check',+ sql`num_nonnulls(${t.sourceWorkVersionId}, ${t.sourceFileId}) <= 1`,+ ),+ check(+ 'artboard_boards_decision_no_source_check',+ sql`${t.type} <> 'decision' OR num_nonnulls(${t.sourceWorkVersionId}, ${t.sourceFileId}, ${t.sourcePath}) = 0`,+ ),+ index('artboard_boards_artboard_id_idx').on(t.artboardId),+ index('artboard_boards_page_id_idx').on(t.pageId),+ index('artboard_boards_group_id_idx')+ .on(t.groupId)+ .where(sql`${t.groupId} IS NOT NULL`),+ index('artboard_boards_round_id_idx')+ .on(t.roundId)+ .where(sql`${t.roundId} IS NOT NULL`),+ index('artboard_boards_project_id_idx')+ .on(t.projectId)+ .where(sql`${t.projectId} IS NOT NULL`),+ uniqueIndex('artboard_boards_acceptance_flow_node_id_unique')+ .on(t.acceptanceFlowNodeId)+ .where(sql`${t.acceptanceFlowNodeId} IS NOT NULL`),+ index('artboard_boards_source_work_version_id_idx')+ .on(t.sourceWorkVersionId)+ .where(sql`${t.sourceWorkVersionId} IS NOT NULL`),+ index('artboard_boards_user_id_idx').on(t.userId),+ index('artboard_boards_workspace_id_idx')+ .on(t.workspaceId)+ .where(sql`${t.workspaceId} IS NOT NULL`),+ ],+);++export const artboardEdges = pgTable(+ 'artboard_edges',+ {+ id: uuid('id').defaultRandom().primaryKey().notNull(),+ artboardId: artboardRef(),+ sourceBoardId: uuid('source_board_id')+ .references(() => artboardBoards.id, { onDelete: 'cascade' })+ .notNull(),+ targetBoardId: uuid('target_board_id')+ .references(() => artboardBoards.id, { onDelete: 'cascade' })+ .notNull(),+ ...ownerColumns,+ // No foreign key, for the same reason as `artboard_boards.acceptance_flow_node_id`.+ acceptanceFlowEdgeId: uuid('acceptance_flow_edge_id'),+ label: text('label').notNull().default(''),+ condition: text('condition'),+ isDefault: boolean('is_default').notNull().default(false),+ sortOrder: integer('sort_order').notNull().default(0),+ metadata: jsonb('metadata').$type<ArtboardEdgeMetadata>(),+ ...timestamps,+ },+ (t) => [+ index('artboard_edges_artboard_id_idx').on(t.artboardId),+ index('artboard_edges_source_board_id_idx').on(t.sourceBoardId),+ uniqueIndex('artboard_edges_source_board_id_default_unique')+ .on(t.sourceBoardId)+ .where(sql`${t.isDefault} = true`),+ index('artboard_edges_target_board_id_idx').on(t.targetBoardId),+ uniqueIndex('artboard_edges_acceptance_flow_edge_id_unique')+ .on(t.acceptanceFlowEdgeId)+ .where(sql`${t.acceptanceFlowEdgeId} IS NOT NULL`),+ index('artboard_edges_user_id_idx').on(t.userId),+ index('artboard_edges_workspace_id_idx')+ .on(t.workspaceId)+ .where(sql`${t.workspaceId} IS NOT NULL`),+ ],+);++export const artboardComments = pgTable(+ 'artboard_comments',+ {+ id: uuid('id').defaultRandom().primaryKey().notNull(),+ artboardId: artboardRef(),+ // Every reply points at the thread root; roots are null.+ parentCommentId: uuid('parent_comment_id').references((): AnyPgColumn => artboardComments.id, {+ onDelete: 'cascade',+ }),+ // The account that wrote the row; `user_id` is always the artboard owner so one account+ // deletion cascades the whole artboard.+ authorUserId: text('author_user_id').references(() => users.id, { onDelete: 'set null' }),+ authorAgentId: text('author_agent_id').references(() => agents.id, { onDelete: 'set null' }),+ ...ownerColumns,+ pageId: text('page_id').references(() => artboardPages.id),+ groupId: text('group_id').references(() => artboardGroups.id, { onDelete: 'set null' }),+ boardId: uuid('board_id').references(() => artboardBoards.id, { onDelete: 'set null' }),+ content: text('content').notNull(),+ clientId: text('client_id').notNull(),+ anchor: jsonb('anchor').$type<ArtboardCommentAnchor>(),+ deliveredAt: timestamptz('delivered_at'),+ resolvedAt: timestamptz('resolved_at'),+ resolvedByUserId: text('resolved_by_user_id').references(() => users.id, {+ onDelete: 'set null',+ }),+ metadata: jsonb('metadata').$type<ArtboardCommentMetadata>(),+ ...timestamps,+ },+ (t) => [+ uniqueIndex('artboard_comments_artboard_id_author_user_id_client_id_unique').on(+ t.artboardId,+ t.authorUserId,+ t.clientId,+ ),+ index('artboard_comments_artboard_id_created_at_idx').on(t.artboardId, t.createdAt),+ index('artboard_comments_parent_comment_id_idx').on(t.parentCommentId),+ index('artboard_comments_board_id_idx').on(t.boardId),+ index('artboard_comments_user_id_idx').on(t.userId),+ index('artboard_comments_workspace_id_idx')+ .on(t.workspaceId)+ .where(sql`${t.workspaceId} IS NOT NULL`),+ index('artboard_comments_page_id_idx').on(t.pageId),+ index('artboard_comments_group_id_idx')+ .on(t.groupId)+ .where(sql`${t.groupId} IS NOT NULL`),+ ],+);diff --git a/packages/database/src/schemas/index.ts b/packages/database/src/schemas/index.tsindex ddc4333edbb..e90618e27c1 100644--- a/packages/database/src/schemas/index.ts+++ b/packages/database/src/schemas/index.ts@@ -19,6 +19,7 @@ export * from './agentShare';export * from './agentSkill';export * from './aiInfra';export * from './apiKey';+export * from './artboard';export * from './asyncTask';export * from './betterAuth';export * from './channel';diff --git a/packages/database/src/utils/idGenerator.ts b/packages/database/src/utils/idGenerator.tsindex bfa4639d94f..6d9564ed5f2 100644--- a/packages/database/src/utils/idGenerator.ts+++ b/packages/database/src/utils/idGenerator.ts@@ -14,6 +14,9 @@ const prefixes = {taskComments: 'cmt',tasks: 'task',agents: 'agt',+ artboardGroups: 'abg',+ artboardPages: 'abp',+ artboards: 'art',budget: 'bgt',channelThreads: 'cht',channels: 'chn',diff --git a/packages/types/src/artboard.ts b/packages/types/src/artboard.tsnew file mode 100644index 00000000000..a1f6327478a--- /dev/null+++ b/packages/types/src/artboard.ts@@ -0,0 +1,38 @@+export const ARTBOARD_PHASES = ['discuss', 'finalized'] as const;+export type ArtboardPhase = (typeof ARTBOARD_PHASES)[number];++export const ARTBOARD_GROUP_KINDS = ['journey', 'options', 'references', 'other'] as const;+export type ArtboardGroupKind = (typeof ARTBOARD_GROUP_KINDS)[number];++export const ARTBOARD_ROUND_STATUSES = ['open', 'submitted'] as const;+export type ArtboardRoundStatus = (typeof ARTBOARD_ROUND_STATUSES)[number];++export const ARTBOARD_BOARD_TYPES = ['html', 'image', 'video', 'decision'] as const;+export type ArtboardBoardType = (typeof ARTBOARD_BOARD_TYPES)[number];++export const ARTBOARD_DEFAULT_PAGE_NAME = 'Page 1';++// A group's rect is in page coordinates and its top-left is the origin for the boards inside it;+// a board outside any group is in page coordinates.+export interface ArtboardRect {+ h: number;+ w: number;+ x: number;+ y: number;+}++export type ArtboardCommentAnchor =+ | { type: 'canvas'; x: number; y: number }+ // offsetX / offsetY are fractions (0–1) of the hit element's width and height.+ | { nodePath: string; offsetX: number; offsetY: number; type: 'node' };++export interface ArtboardEdgeMetadata {}++export interface ArtboardMetadata {}+export interface ArtboardPageMetadata {}+export interface ArtboardRoundMetadata {+ batchId?: string;+}+export interface ArtboardGroupMetadata {}+export interface ArtboardBoardMetadata {}+export interface ArtboardCommentMetadata {}diff --git a/packages/types/src/index.ts b/packages/types/src/index.tsindex 597e4fd7143..d288ea37112 100644--- a/packages/types/src/index.ts+++ b/packages/types/src/index.ts@@ -96,6 +96,7 @@ export * from './acceptanceFlow';export * from './acceptanceReview';export * from './acceptanceReviewRound';export * from './agentRuntime';+export * from './artboard';export * from './connector';export * from './inboundWebhook';export * from './oauthApp';