🤯 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): let an environment belong to one project (#23383)
Rdmclin202305928f36b
diff --git a/docs/development/database-schema.dbml b/docs/development/database-schema.dbmlindex fa216273a5c..44d0b7d64ba 100644--- a/docs/development/database-schema.dbml+++ b/docs/development/database-schema.dbml@@ -2169,6 +2169,7 @@ table environments {id uuid [pk, not null, default: `gen_random_uuid()`]user_id text [not null]workspace_id text+ project_id textname varchar(255) [not null]description textenabled boolean [not null, default: true]@@ -2181,6 +2182,7 @@ table environments {indexes {user_id [name: 'environments_user_id_idx']workspace_id [name: 'environments_workspace_id_idx']+ project_id [name: 'environments_project_id_unique', unique](workspace_id, visibility, user_id) [name: 'environments_workspace_visibility_idx'](user_id, name) [name: 'environments_user_name_unique', unique](workspace_id, user_id, name) [name: 'environments_workspace_user_name_unique', unique]diff --git a/packages/database/migrations/0221_project_environment_owner.sql b/packages/database/migrations/0221_project_environment_owner.sqlnew file mode 100644index 00000000000..defc62a2e11--- /dev/null+++ b/packages/database/migrations/0221_project_environment_owner.sql@@ -0,0 +1,8 @@+DROP INDEX IF EXISTS "environments_user_name_unique";--> statement-breakpoint+DROP INDEX IF EXISTS "environments_workspace_user_name_unique";--> statement-breakpoint+ALTER TABLE "environments" ADD COLUMN IF NOT EXISTS "project_id" text;--> statement-breakpoint+ALTER TABLE "environments" DROP CONSTRAINT IF EXISTS "environments_project_id_projects_id_fk";--> statement-breakpoint+ALTER TABLE "environments" ADD CONSTRAINT "environments_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint+CREATE UNIQUE INDEX IF NOT EXISTS "environments_project_id_unique" ON "environments" USING btree ("project_id") WHERE "environments"."project_id" is not null;--> statement-breakpoint+CREATE UNIQUE INDEX IF NOT EXISTS "environments_user_name_unique" ON "environments" USING btree ("user_id","name") WHERE "environments"."workspace_id" IS NULL AND "environments"."project_id" IS NULL;--> statement-breakpoint+CREATE UNIQUE INDEX IF NOT EXISTS "environments_workspace_user_name_unique" ON "environments" USING btree ("workspace_id","user_id","name") WHERE "environments"."workspace_id" IS NOT NULL AND "environments"."project_id" IS NULL;\ No newline at end of filediff --git a/packages/database/migrations/meta/0211_snapshot.json b/packages/database/migrations/meta/0221_snapshot.jsonsimilarity index 92%rename from packages/database/migrations/meta/0211_snapshot.jsonrename to packages/database/migrations/meta/0221_snapshot.jsonindex 117782ce46a..d39b93f446f 100644--- a/packages/database/migrations/meta/0211_snapshot.json+++ b/packages/database/migrations/meta/0221_snapshot.json@@ -6,9 +6,9 @@},"dialect": "postgresql","enums": {},- "id": "45b20770-a9d5-4005-9171-07a02f3ec86d",+ "id": "4caccfb8-4b95-4149-b512-2d72e1ba77de","policies": {},- "prevId": "cde6aca7-5edb-4f76-9a5c-e9a8d7f3721e",+ "prevId": "77cad3c6-892d-4bc9-a657-a554d6ebb0a6","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": "",@@ -10453,8 +10927,8 @@"checkConstraints": {},"isRLSEnabled": false},- "public.async_tasks": {- "name": "async_tasks",+ "public.artboard_boards": {+ "name": "artboard_boards","schema": "","columns": {"id": {@@ -10464,27 +10938,27 @@"notNull": true,"default": "gen_random_uuid()"},- "type": {- "name": "type",+ "artboard_id": {+ "name": "artboard_id","type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "status": {- "name": "status",+ "page_id": {+ "name": "page_id","type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "error": {- "name": "error",- "type": "jsonb",+ "group_id": {+ "name": "group_id",+ "type": "text","primaryKey": false,"notNull": false},- "inference_id": {- "name": "inference_id",- "type": "text",+ "round_id": {+ "name": "round_id",+ "type": "uuid","primaryKey": false,"notNull": false},@@ -10500,24 +10974,71 @@"primaryKey": false,"notNull": false},- "duration": {- "name": "duration",- "type": "integer",+ "project_id": {+ "name": "project_id",+ "type": "text","primaryKey": false,"notNull": false},- "parent_id": {- "name": "parent_id",+ "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+ },+ "expected": {+ "name": "expected",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "rect": {+ "name": "rect",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "source_work_version_id": {+ "name": "source_work_version_id","type": "uuid","primaryKey": false,"notNull": false},+ "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": true,- "default": "'{}'"+ "notNull": false},"accessed_at": {"name": "accessed_at",@@ -10542,11 +11063,11 @@}},"indexes": {- "async_tasks_user_id_idx": {- "name": "async_tasks_user_id_idx",+ "artboard_boards_artboard_id_idx": {+ "name": "artboard_boards_artboard_id_idx","columns": [{- "expression": "user_id",+ "expression": "artboard_id","isExpression": false,"asc": true,"nulls": "last"@@ -10557,11 +11078,11 @@"method": "btree","with": {}},- "async_tasks_parent_id_idx": {- "name": "async_tasks_parent_id_idx",+ "artboard_boards_page_id_idx": {+ "name": "artboard_boards_page_id_idx","columns": [{- "expression": "parent_id",+ "expression": "page_id","isExpression": false,"asc": true,"nulls": "last"@@ -10572,59 +11093,103 @@"method": "btree","with": {}},- "async_tasks_type_status_idx": {- "name": "async_tasks_type_status_idx",+ "artboard_boards_group_id_idx": {+ "name": "artboard_boards_group_id_idx","columns": [{- "expression": "type",+ "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": "status",+ "expression": "round_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,+ "where": "\"artboard_boards\".\"round_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}},- "async_tasks_inference_id_idx": {- "name": "async_tasks_inference_id_idx",+ "artboard_boards_project_id_idx": {+ "name": "artboard_boards_project_id_idx","columns": [{- "expression": "inference_id",+ "expression": "project_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,+ "where": "\"artboard_boards\".\"project_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}},- "async_tasks_metadata_idx": {- "name": "async_tasks_metadata_idx",+ "artboard_boards_acceptance_flow_node_id_unique": {+ "name": "artboard_boards_acceptance_flow_node_id_unique","columns": [{- "expression": "metadata",+ "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": "gin",+ "method": "btree","with": {}},- "async_tasks_workspace_id_idx": {- "name": "async_tasks_workspace_id_idx",+ "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",@@ -10634,233 +11199,257 @@}],"isUnique": false,+ "where": "\"artboard_boards\".\"workspace_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_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"},- "async_tasks_workspace_id_workspaces_id_fk": {- "name": "async_tasks_workspace_id_workspaces_id_fk",- "tableFrom": "async_tasks",+ "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": {},+ "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.accounts": {- "name": "accounts",+ "public.artboard_comments": {+ "name": "artboard_comments","schema": "","columns": {- "access_token": {- "name": "access_token",- "type": "text",- "primaryKey": false,- "notNull": false- },- "access_token_expires_at": {- "name": "access_token_expires_at",- "type": "timestamp",- "primaryKey": false,- "notNull": false+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"},- "account_id": {- "name": "account_id",+ "artboard_id": {+ "name": "artboard_id","type": "text","primaryKey": false,"notNull": true},- "created_at": {- "name": "created_at",- "type": "timestamp",+ "parent_comment_id": {+ "name": "parent_comment_id",+ "type": "uuid","primaryKey": false,- "notNull": true,- "default": "now()"- },- "id": {- "name": "id",- "type": "text",- "primaryKey": true,- "notNull": true+ "notNull": false},- "id_token": {- "name": "id_token",+ "author_user_id": {+ "name": "author_user_id","type": "text","primaryKey": false,"notNull": false},- "password": {- "name": "password",+ "author_agent_id": {+ "name": "author_agent_id","type": "text","primaryKey": false,"notNull": false},- "provider_id": {- "name": "provider_id",+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,"notNull": true},- "refresh_token": {- "name": "refresh_token",+ "workspace_id": {+ "name": "workspace_id","type": "text","primaryKey": false,"notNull": false},- "refresh_token_expires_at": {- "name": "refresh_token_expires_at",- "type": "timestamp",+ "page_id": {+ "name": "page_id",+ "type": "text","primaryKey": false,"notNull": false},- "scope": {- "name": "scope",+ "group_id": {+ "name": "group_id","type": "text","primaryKey": false,"notNull": false},- "updated_at": {- "name": "updated_at",- "type": "timestamp",+ "board_id": {+ "name": "board_id",+ "type": "uuid","primaryKey": false,- "notNull": true+ "notNull": false},- "user_id": {- "name": "user_id",+ "content": {+ "name": "content","type": "text","primaryKey": false,"notNull": true- }- },- "indexes": {- "account_userId_idx": {- "name": "account_userId_idx",- "columns": [- {- "expression": "user_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "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",+ },+ "client_id": {+ "name": "client_id","type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "backedUp": {- "name": "backedUp",- "type": "boolean",+ "anchor": {+ "name": "anchor",+ "type": "jsonb","primaryKey": false,"notNull": false},- "counter": {- "name": "counter",- "type": "integer",+ "delivered_at": {+ "name": "delivered_at",+ "type": "timestamp with time zone","primaryKey": false,"notNull": false},- "createdAt": {- "name": "createdAt",- "type": "timestamp",- "primaryKey": false,- "notNull": false,- "default": "now()"- },- "credentialID": {- "name": "credentialID",- "type": "text",+ "resolved_at": {+ "name": "resolved_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": true+ "notNull": false},- "deviceType": {- "name": "deviceType",+ "resolved_by_user_id": {+ "name": "resolved_by_user_id","type": "text","primaryKey": false,"notNull": false},- "id": {- "name": "id",- "type": "text",- "primaryKey": true,- "notNull": true- },- "name": {- "name": "name",- "type": "text",+ "metadata": {+ "name": "metadata",+ "type": "jsonb","primaryKey": false,"notNull": false},- "publicKey": {- "name": "publicKey",- "type": "text",+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": true+ "notNull": true,+ "default": "now()"},- "transports": {- "name": "transports",- "type": "text",+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "now()"},- "userId": {- "name": "userId",- "type": "text",+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": true+ "notNull": true,+ "default": "now()"}},"indexes": {- "passkey_credential_id_unique": {- "name": "passkey_credential_id_unique",+ "artboard_comments_artboard_id_author_user_id_client_id_unique": {+ "name": "artboard_comments_artboard_id_author_user_id_client_id_unique","columns": [{- "expression": "credentialID",+ "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"@@ -10871,31 +11460,210 @@"method": "btree","with": {}},- "passkey_user_id_idx": {- "name": "passkey_user_id_idx",+ "artboard_comments_artboard_id_created_at_idx": {+ "name": "artboard_comments_artboard_id_created_at_idx","columns": [{- "expression": "userId",+ "expression": "artboard_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_comments_parent_comment_id_idx": {+ "name": "artboard_comments_parent_comment_id_idx",+ "columns": [+ {+ "expression": "parent_comment_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_comments_board_id_idx": {+ "name": "artboard_comments_board_id_idx",+ "columns": [+ {+ "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": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_comments_workspace_id_idx": {+ "name": "artboard_comments_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"artboard_comments\".\"workspace_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_comments_page_id_idx": {+ "name": "artboard_comments_page_id_idx",+ "columns": [+ {+ "expression": "page_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_comments_group_id_idx": {+ "name": "artboard_comments_group_id_idx",+ "columns": [+ {+ "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": {- "passkey_userId_users_id_fk": {- "name": "passkey_userId_users_id_fk",- "tableFrom": "passkey",+ "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": ["userId"],+ "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"+ },+ "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": {},@@ -10904,72 +11672,114 @@"checkConstraints": {},"isRLSEnabled": false},- "public.auth_sessions": {- "name": "auth_sessions",+ "public.artboard_edges": {+ "name": "artboard_edges","schema": "","columns": {- "created_at": {- "name": "created_at",- "type": "timestamp",- "primaryKey": false,- "notNull": true,- "default": "now()"+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "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",+ "source_board_id": {+ "name": "source_board_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "target_board_id": {+ "name": "target_board_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id","type": "text",- "primaryKey": true,+ "primaryKey": false,"notNull": true},- "impersonated_by": {- "name": "impersonated_by",+ "workspace_id": {+ "name": "workspace_id","type": "text","primaryKey": false,"notNull": false},- "ip_address": {- "name": "ip_address",- "type": "text",+ "acceptance_flow_edge_id": {+ "name": "acceptance_flow_edge_id",+ "type": "uuid","primaryKey": false,"notNull": false},- "token": {- "name": "token",+ "label": {+ "name": "label","type": "text","primaryKey": false,- "notNull": true+ "notNull": true,+ "default": "''"},- "updated_at": {- "name": "updated_at",- "type": "timestamp",+ "condition": {+ "name": "condition",+ "type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "user_agent": {- "name": "user_agent",- "type": "text",+ "is_default": {+ "name": "is_default",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "sort_order": {+ "name": "sort_order",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "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+ "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": {- "auth_session_userId_idx": {- "name": "auth_session_userId_idx",+ "artboard_edges_artboard_id_idx": {+ "name": "artboard_edges_artboard_id_idx","columns": [{- "expression": "user_id",+ "expression": "artboard_id","isExpression": false,"asc": true,"nulls": "last"@@ -10979,66 +11789,43 @@"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+ "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": {}},- "secret": {- "name": "secret",- "type": "text",- "primaryKey": false,- "notNull": true+ "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": {}},- "user_id": {- "name": "user_id",- "type": "text",- "primaryKey": false,- "notNull": true- }- },- "indexes": {- "two_factor_secret_idx": {- "name": "two_factor_secret_idx",+ "artboard_edges_target_board_id_idx": {+ "name": "artboard_edges_target_board_id_idx","columns": [{- "expression": "secret",+ "expression": "target_board_id","isExpression": false,"asc": true,"nulls": "last"@@ -11049,8 +11836,24 @@"method": "btree","with": {}},- "two_factor_user_id_idx": {- "name": "two_factor_user_id_idx",+ "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",@@ -11063,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": {- "two_factor_user_id_users_id_fk": {- "name": "two_factor_user_id_users_id_fk",- "tableFrom": "two_factor",+ "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": {},@@ -11082,108 +11937,252 @@"checkConstraints": {},"isRLSEnabled": false},- "public.verifications": {- "name": "verifications",+ "public.artboard_groups": {+ "name": "artboard_groups","schema": "","columns": {- "created_at": {- "name": "created_at",- "type": "timestamp",+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "artboard_id": {+ "name": "artboard_id",+ "type": "text","primaryKey": false,- "notNull": true,- "default": "now()"+ "notNull": true},- "expires_at": {- "name": "expires_at",- "type": "timestamp",+ "page_id": {+ "name": "page_id",+ "type": "text","primaryKey": false,"notNull": true},- "id": {- "name": "id",+ "user_id": {+ "name": "user_id","type": "text",- "primaryKey": true,+ "primaryKey": false,"notNull": true},- "identifier": {- "name": "identifier",+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "kind": {+ "name": "kind","type": "text","primaryKey": false,"notNull": true},- "updated_at": {- "name": "updated_at",- "type": "timestamp",+ "title": {+ "name": "title",+ "type": "text","primaryKey": false,- "notNull": true,- "default": "now()"+ "notNull": true},- "value": {- "name": "value",+ "description": {+ "name": "description","type": "text","primaryKey": false,+ "notNull": false+ },+ "rect": {+ "name": "rect",+ "type": "jsonb",+ "primaryKey": false,"notNull": true+ },+ "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": {- "verification_identifier_idx": {- "name": "verification_identifier_idx",+ "artboard_groups_artboard_id_idx": {+ "name": "artboard_groups_artboard_id_idx","columns": [{- "expression": "identifier",+ "expression": "artboard_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_groups_page_id_idx": {+ "name": "artboard_groups_page_id_idx",+ "columns": [+ {+ "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": {},+ "foreignKeys": {+ "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": ["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"+ }+ },"compositePrimaryKeys": {},"uniqueConstraints": {},"policies": {},"checkConstraints": {},"isRLSEnabled": false},- "public.channel_audit": {- "name": "channel_audit",+ "public.artboard_pages": {+ "name": "artboard_pages","schema": "","columns": {"id": {"name": "id",- "type": "uuid",+ "type": "text","primaryKey": true,- "notNull": true,- "default": "gen_random_uuid()"+ "notNull": true},- "channel_id": {- "name": "channel_id",+ "artboard_id": {+ "name": "artboard_id","type": "text","primaryKey": false,"notNull": true},- "event": {- "name": "event",+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,"notNull": true},- "target_id": {- "name": "target_id",+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name","type": "text","primaryKey": false,"notNull": true},- "details": {- "name": "details",+ "sort_order": {+ "name": "sort_order",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "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",@@ -11191,26 +12190,21 @@"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_pages_artboard_id_idx": {+ "name": "artboard_pages_artboard_id_idx","columns": [{- "expression": "channel_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "event",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "created_at",+ "expression": "artboard_id","isExpression": false,"asc": true,"nulls": "last"@@ -11221,40 +12215,62 @@"method": "btree","with": {}},- "channel_audit_target_event_idx": {- "name": "channel_audit_target_event_idx",+ "artboard_pages_user_id_idx": {+ "name": "artboard_pages_user_id_idx","columns": [{- "expression": "target_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "event",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"- },+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_pages_workspace_id_idx": {+ "name": "artboard_pages_workspace_id_idx",+ "columns": [{- "expression": "created_at",+ "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": {- "channel_audit_channel_id_channels_id_fk": {- "name": "channel_audit_channel_id_channels_id_fk",- "tableFrom": "channel_audit",- "tableTo": "channels",- "columnsFrom": ["channel_id"],+ "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"@@ -11266,8 +12282,8 @@"checkConstraints": {},"isRLSEnabled": false},- "public.channel_jobs": {- "name": "channel_jobs",+ "public.artboard_rounds": {+ "name": "artboard_rounds","schema": "","columns": {"id": {@@ -11277,33 +12293,33 @@"notNull": true,"default": "gen_random_uuid()"},- "channel_id": {- "name": "channel_id",+ "artboard_id": {+ "name": "artboard_id","type": "text","primaryKey": false,"notNull": true},- "member_id": {- "name": "member_id",- "type": "uuid",+ "page_id": {+ "name": "page_id",+ "type": "text","primaryKey": false,"notNull": true},- "message_id": {- "name": "message_id",- "type": "uuid",+ "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},- "requester_member_id": {- "name": "requester_member_id",- "type": "uuid",+ "title": {+ "name": "title",+ "type": "text","primaryKey": false,"notNull": true},@@ -11312,127 +12328,2386 @@"type": "text","primaryKey": false,"notNull": true,- "default": "'queued'"+ "default": "'open'"},- "blocked_reason": {- "name": "blocked_reason",- "type": "text",+ "recommended_board_id": {+ "name": "recommended_board_id",+ "type": "uuid","primaryKey": false,"notNull": false},- "blocked_code": {- "name": "blocked_code",+ "chosen_board_id": {+ "name": "chosen_board_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "selected_by": {+ "name": "selected_by","type": "text","primaryKey": false,"notNull": false},- "claimed_at": {- "name": "claimed_at",+ "selected_at": {+ "name": "selected_at","type": "timestamp with time zone","primaryKey": false,"notNull": false},- "topic_id": {- "name": "topic_id",- "type": "text",+ "metadata": {+ "name": "metadata",+ "type": "jsonb","primaryKey": false,"notNull": false},- "operation_id": {- "name": "operation_id",+ "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_rounds_artboard_id_idx": {+ "name": "artboard_rounds_artboard_id_idx",+ "columns": [+ {+ "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": "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": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboard_rounds_workspace_id_idx": {+ "name": "artboard_rounds_workspace_id_idx",+ "columns": [+ {+ "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": "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": "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": {+ "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": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.artboards": {+ "name": "artboards",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "topic_id": {+ "name": "topic_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "task_id": {+ "name": "task_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "project_id": {+ "name": "project_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "acceptance_id": {+ "name": "acceptance_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "phase": {+ "name": "phase",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'discuss'"+ },+ "revision": {+ "name": "revision",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 1+ },+ "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": {+ "artboards_user_id_idx": {+ "name": "artboards_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboards_workspace_id_idx": {+ "name": "artboards_workspace_id_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"artboards\".\"workspace_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboards_topic_id_idx": {+ "name": "artboards_topic_id_idx",+ "columns": [+ {+ "expression": "topic_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"artboards\".\"topic_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboards_task_id_idx": {+ "name": "artboards_task_id_idx",+ "columns": [+ {+ "expression": "task_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"artboards\".\"task_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboards_project_id_idx": {+ "name": "artboards_project_id_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboards_phase_idx": {+ "name": "artboards_phase_idx",+ "columns": [+ {+ "expression": "phase",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboards_created_at_idx": {+ "name": "artboards_created_at_idx",+ "columns": [+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "artboards_updated_at_idx": {+ "name": "artboards_updated_at_idx",+ "columns": [+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "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"+ },+ "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"+ },+ "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"+ },+ "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"+ },+ "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": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.async_tasks": {+ "name": "async_tasks",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "error": {+ "name": "error",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "inference_id": {+ "name": "inference_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+ },+ "duration": {+ "name": "duration",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "parent_id": {+ "name": "parent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'"+ },+ "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": {+ "async_tasks_user_id_idx": {+ "name": "async_tasks_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "async_tasks_parent_id_idx": {+ "name": "async_tasks_parent_id_idx",+ "columns": [+ {+ "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"+ },+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "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": {+ "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"+ },+ "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"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.accounts": {+ "name": "accounts",+ "schema": "",+ "columns": {+ "access_token": {+ "name": "access_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "access_token_expires_at": {+ "name": "access_token_expires_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "account_id": {+ "name": "account_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "id_token": {+ "name": "id_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "password": {+ "name": "password",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "provider_id": {+ "name": "provider_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "refresh_token": {+ "name": "refresh_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "refresh_token_expires_at": {+ "name": "refresh_token_expires_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "scope": {+ "name": "scope",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "account_userId_idx": {+ "name": "account_userId_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "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+ },+ "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": "credentialID",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "passkey_user_id_idx": {+ "name": "passkey_user_id_idx",+ "columns": [+ {+ "expression": "userId",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "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()"+ },+ "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": "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+ },+ "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": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "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": {},+ "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",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "event": {+ "name": "event",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "target_id": {+ "name": "target_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "details": {+ "name": "details",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "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_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_jobs": {+ "name": "channel_jobs",+ "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,+ "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_directory_idx": {+ "name": "channel_jobs_active_directory_idx",+ "columns": [+ {+ "expression": "device_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "working_directory",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"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+ },+ "section_id": {+ "name": "section_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "pinned": {+ "name": "pinned",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "hidden": {+ "name": "hidden",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "pinned_at": {+ "name": "pinned_at",+ "type": "timestamp with time zone",+ "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_section_id_idx": {+ "name": "channel_members_section_id_idx",+ "columns": [+ {+ "expression": "section_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"channel_members\".\"section_id\" IS NOT NULL",+ "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_section_id_channel_sections_id_fk": {+ "name": "channel_members_section_id_channel_sections_id_fk",+ "tableFrom": "channel_members",+ "tableTo": "channel_sections",+ "columnsFrom": ["section_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_section_id_owner_check": {+ "name": "channel_members_section_id_owner_check",+ "value": "\"channel_members\".\"section_id\" IS NULL OR \"channel_members\".\"actor_type\" = 'user'"+ },+ "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": false+ "notNull": true},- "wake": {- "name": "wake",- "type": "jsonb",+ "thread_id": {+ "name": "thread_id",+ "type": "text","primaryKey": false,"notNull": false},- "manifest": {- "name": "manifest",- "type": "jsonb",+ "sequence": {+ "name": "sequence",+ "type": "integer","primaryKey": false,- "notNull": false+ "notNull": true},- "execution_config": {- "name": "execution_config",- "type": "jsonb",+ "content": {+ "name": "content",+ "type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "device_id": {- "name": "device_id",- "type": "varchar(64)",+ "user_id": {+ "name": "user_id",+ "type": "text","primaryKey": false,"notNull": false},- "working_directory": {- "name": "working_directory",+ "agent_id": {+ "name": "agent_id","type": "text","primaryKey": false,"notNull": false},- "accepted_at": {- "name": "accepted_at",- "type": "timestamp with time zone",+ "mentions": {+ "name": "mentions",+ "type": "jsonb","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "'[]'::jsonb"},- "lease_owner": {- "name": "lease_owner",+ "request_key": {+ "name": "request_key","type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "lease_expires_at": {- "name": "lease_expires_at",- "type": "timestamp with time zone",+ "reply_to_id": {+ "name": "reply_to_id",+ "type": "uuid","primaryKey": false,"notNull": false},- "writer_held": {- "name": "writer_held",- "type": "boolean",+ "routing_status": {+ "name": "routing_status",+ "type": "text","primaryKey": false,- "notNull": true,- "default": false+ "notNull": true},- "isolated_at": {- "name": "isolated_at",- "type": "timestamp with time zone",+ "routing_source": {+ "name": "routing_source",+ "type": "text","primaryKey": false,"notNull": false},- "draft": {- "name": "draft",+ "routing_reason": {+ "name": "routing_reason","type": "text","primaryKey": false,"notNull": false},- "publication_revoked": {- "name": "publication_revoked",- "type": "boolean",+ "routing_attempt": {+ "name": "routing_attempt",+ "type": "integer","primaryKey": false,"notNull": true,- "default": false+ "default": 0},- "published_message_id": {- "name": "published_message_id",- "type": "uuid",+ "recipient_member_ids": {+ "name": "recipient_member_ids",+ "type": "jsonb","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "'[]'::jsonb"},- "created_at": {- "name": "created_at",- "type": "timestamp with time zone",+ "metadata": {+ "name": "metadata",+ "type": "jsonb","primaryKey": false,- "notNull": true,- "default": "now()"+ "notNull": false,+ "default": "'{}'::jsonb"},- "updated_at": {- "name": "updated_at",+ "created_at": {+ "name": "created_at","type": "timestamp with time zone","primaryKey": false,"notNull": true,@@ -11440,17 +14715,17 @@}},"indexes": {- "channel_jobs_delivery_unique": {- "name": "channel_jobs_delivery_unique",+ "channel_messages_sequence_unique": {+ "name": "channel_messages_sequence_unique","columns": [{- "expression": "message_id",+ "expression": "channel_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "member_id",+ "expression": "sequence","isExpression": false,"asc": true,"nulls": "last"@@ -11461,8 +14736,8 @@"method": "btree","with": {}},- "channel_jobs_channel_status_idx": {- "name": "channel_jobs_channel_status_idx",+ "channel_messages_request_key_unique": {+ "name": "channel_messages_request_key_unique","columns": [{"expression": "channel_id",@@ -11471,28 +14746,22 @@"nulls": "last"},{- "expression": "status",+ "expression": "request_key","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,"concurrently": false,"method": "btree","with": {}},- "channel_jobs_continuation_idx": {- "name": "channel_jobs_continuation_idx",+ "channel_messages_thread_sequence_idx": {+ "name": "channel_messages_thread_sequence_idx","columns": [{- "expression": "member_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "requester_member_id",+ "expression": "channel_id","isExpression": false,"asc": true,"nulls": "last"@@ -11504,28 +14773,7 @@"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",+ "expression": "sequence","isExpression": false,"asc": true,"nulls": "last"@@ -11536,146 +14784,88 @@"method": "btree","with": {}},- "channel_jobs_member_queue_idx": {- "name": "channel_jobs_member_queue_idx",+ "channel_messages_request_sequence_idx": {+ "name": "channel_messages_request_sequence_idx","columns": [{- "expression": "member_id",+ "expression": "channel_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "status",+ "expression": "thread_id","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",+ "expression": "sequence","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",+ "where": "\"channel_messages\".\"routing_status\" <> 'reply'","concurrently": false,"method": "btree","with": {}},- "channel_jobs_active_directory_unique": {- "name": "channel_jobs_active_directory_unique",+ "channel_messages_routing_pending_idx": {+ "name": "channel_messages_routing_pending_idx","columns": [{- "expression": "device_id",+ "expression": "channel_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "working_directory",+ "expression": "id","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,+ "where": "\"channel_messages\".\"routing_status\" = 'pending'","concurrently": false,"method": "btree","with": {}}},"foreignKeys": {- "channel_jobs_channel_id_channels_id_fk": {- "name": "channel_jobs_channel_id_channels_id_fk",- "tableFrom": "channel_jobs",+ "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_jobs_topic_id_topics_id_fk": {- "name": "channel_jobs_topic_id_topics_id_fk",- "tableFrom": "channel_jobs",- "tableTo": "topics",- "columnsFrom": ["topic_id"],+ "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_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"],+ "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_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",+ "channel_messages_thread_fk": {+ "name": "channel_messages_thread_fk",+ "tableFrom": "channel_messages","tableTo": "channel_threads","columnsFrom": ["channel_id", "thread_id"],"columnsTo": ["channel_id", "id"],@@ -11685,23 +14875,27 @@},"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",+ "channel_messages_scope_unique": {+ "name": "channel_messages_scope_unique","nullsNotDistinct": false,"columns": ["channel_id", "id"]}},"policies": {},- "checkConstraints": {},+ "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"+ }+ },"isRLSEnabled": false},- "public.channel_member_grants": {- "name": "channel_member_grants",+ "public.channel_sections": {+ "name": "channel_sections","schema": "","columns": {"id": {@@ -11711,66 +14905,142 @@"notNull": true,"default": "gen_random_uuid()"},- "channel_id": {- "name": "channel_id",+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,"notNull": true},- "member_id": {- "name": "member_id",- "type": "uuid",+ "workspace_id": {+ "name": "workspace_id",+ "type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "device_owner_id": {- "name": "device_owner_id",+ "name": {+ "name": "name","type": "text","primaryKey": false,"notNull": true},- "device_id": {- "name": "device_id",- "type": "varchar(64)",+ "sort": {+ "name": "sort",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "collapsed": {+ "name": "collapsed",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": 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_sections_user_id_workspace_id_idx": {+ "name": "channel_sections_user_id_workspace_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "channel_sections_user_id_users_id_fk": {+ "name": "channel_sections_user_id_users_id_fk",+ "tableFrom": "channel_sections",+ "tableTo": "users",+ "columnsFrom": ["user_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "channel_sections_workspace_id_workspaces_id_fk": {+ "name": "channel_sections_workspace_id_workspaces_id_fk",+ "tableFrom": "channel_sections",+ "tableTo": "workspaces",+ "columnsFrom": ["workspace_id"],+ "columnsTo": ["id"],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.channel_threads": {+ "name": "channel_threads",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,"notNull": true},- "working_directory": {- "name": "working_directory",+ "channel_id": {+ "name": "channel_id","type": "text","primaryKey": false,"notNull": true},- "requested_by_member_id": {- "name": "requested_by_member_id",+ "root_message_id": {+ "name": "root_message_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",+ "root_sequence": {+ "name": "root_sequence",+ "type": "integer","primaryKey": false,- "notNull": false+ "notNull": true},- "revoked_at": {- "name": "revoked_at",- "type": "timestamp with time zone",+ "follower_member_ids": {+ "name": "follower_member_ids",+ "type": "jsonb","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "'[]'::jsonb"},- "revoke_reason": {- "name": "revoke_reason",+ "status": {+ "name": "status","type": "text","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "'active'"},"metadata": {"name": "metadata",@@ -11779,15 +15049,20 @@"notNull": false,"default": "'{}'::jsonb"},- "created_at": {- "name": "created_at",+ "deleted_at": {+ "name": "deleted_at","type": "timestamp with time zone","primaryKey": false,- "notNull": true,- "default": "now()"+ "notNull": false},- "updated_at": {- "name": "updated_at",+ "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,@@ -11795,108 +15070,69 @@}},"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",+ "channel_threads_root_unique": {+ "name": "channel_threads_root_unique","columns": [{- "expression": "device_owner_id",+ "expression": "channel_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "status",+ "expression": "root_message_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,+ "where": "\"channel_threads\".\"is_deleted\" IS NOT TRUE","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",+ "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_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"],+ "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": {},+ "uniqueConstraints": {+ "channel_threads_scope_unique": {+ "name": "channel_threads_scope_unique",+ "nullsNotDistinct": false,+ "columns": ["channel_id", "id"]+ }+ },"policies": {},"checkConstraints": {},"isRLSEnabled": false- },- "public.channel_members": {- "name": "channel_members",+ },+ "public.channels": {+ "name": "channels","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,+ "primaryKey": true,"notNull": true},"user_id": {@@ -11905,15 +15141,15 @@"primaryKey": false,"notNull": false},- "role": {- "name": "role",+ "workspace_id": {+ "name": "workspace_id","type": "text","primaryKey": false,"notNull": false},- "last_read_sequence": {- "name": "last_read_sequence",- "type": "integer",+ "project_id": {+ "name": "project_id",+ "type": "text","primaryKey": false,"notNull": false},@@ -11923,18 +15159,44 @@"primaryKey": false,"notNull": false},- "name": {- "name": "name",+ "peer_user_id": {+ "name": "peer_user_id","type": "text","primaryKey": false,"notNull": false},- "description": {- "name": "description",+ "agent_pair_key": {+ "name": "agent_pair_key","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": "''"+ "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",@@ -11949,12 +15211,17 @@"notNull": false,"default": "'{}'::jsonb"},- "status": {- "name": "status",- "type": "text",+ "deleted_at": {+ "name": "deleted_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": true,- "default": "'active'"+ "notNull": false+ },+ "is_deleted": {+ "name": "is_deleted",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false},"created_at": {"name": "created_at",@@ -11972,11 +15239,26 @@}},"indexes": {- "channel_members_channel_user_unique": {- "name": "channel_members_channel_user_unique",+ "channels_user_id_idx": {+ "name": "channels_user_id_idx","columns": [{- "expression": "channel_id",+ "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"@@ -11986,151 +15268,75 @@"isExpression": false,"asc": true,"nulls": "last"+ },+ {+ "expression": "coalesce(\"workspace_id\", '')",+ "asc": true,+ "isExpression": true,+ "nulls": "last"}],"isUnique": true,- "where": "\"channel_members\".\"user_id\" IS NOT NULL",+ "where": "\"channels\".\"agent_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}},- "channel_members_user_id_idx": {- "name": "channel_members_user_id_idx",+ "channels_agent_pair_unique": {+ "name": "channels_agent_pair_unique","columns": [+ {+ "expression": "agent_pair_key",+ "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": false,+ "isUnique": true,+ "where": "\"channels\".\"agent_pair_key\" IS NOT NULL","concurrently": false,"method": "btree","with": {}},- "channel_members_agent_id_idx": {- "name": "channel_members_agent_id_idx",+ "channels_project_id_idx": {+ "name": "channels_project_id_idx","columns": [{- "expression": "agent_id",+ "expression": "project_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,+ "where": "\"channels\".\"project_id\" IS NOT NULL","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",+ "channels_workspace_visibility_idx": {+ "name": "channels_workspace_visibility_idx","columns": [{- "expression": "file_id",+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "visibility","isExpression": false,"asc": true,"nulls": "last"@@ -12143,141 +15349,177 @@}},"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"],+ "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"},- "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"],+ "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": {- "channel_message_files_message_file_unique": {- "name": "channel_message_files_message_file_unique",- "nullsNotDistinct": false,- "columns": ["message_id", "file_id"]+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "channels_direct_visibility_check": {+ "name": "channels_direct_visibility_check",+ "value": "\"channels\".\"agent_id\" IS NULL OR \"channels\".\"visibility\" = 'private'"}},- "policies": {},- "checkConstraints": {},"isRLSEnabled": false},- "public.channel_messages": {- "name": "channel_messages",+ "public.chat_groups": {+ "name": "chat_groups","schema": "","columns": {"id": {"name": "id",- "type": "uuid",+ "type": "text","primaryKey": true,- "notNull": true,- "default": "gen_random_uuid()"+ "notNull": true},- "channel_id": {- "name": "channel_id",+ "title": {+ "name": "title","type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "thread_id": {- "name": "thread_id",+ "description": {+ "name": "description","type": "text","primaryKey": false,"notNull": false},- "sequence": {- "name": "sequence",- "type": "integer",+ "avatar": {+ "name": "avatar",+ "type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "content": {- "name": "content",+ "background_color": {+ "name": "background_color","type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "user_id": {- "name": "user_id",+ "market_identifier": {+ "name": "market_identifier","type": "text","primaryKey": false,"notNull": false},- "agent_id": {- "name": "agent_id",+ "content": {+ "name": "content","type": "text","primaryKey": false,"notNull": false},- "mentions": {- "name": "mentions",+ "editor_data": {+ "name": "editor_data","type": "jsonb","primaryKey": false,- "notNull": true,- "default": "'[]'::jsonb"+ "notNull": false},- "request_key": {- "name": "request_key",- "type": "text",+ "config": {+ "name": "config",+ "type": "jsonb","primaryKey": false,- "notNull": true+ "notNull": false},- "reply_to_id": {- "name": "reply_to_id",- "type": "uuid",+ "client_id": {+ "name": "client_id",+ "type": "text","primaryKey": false,"notNull": false},- "routing_status": {- "name": "routing_status",+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,"notNull": true},- "routing_source": {- "name": "routing_source",+ "workspace_id": {+ "name": "workspace_id","type": "text","primaryKey": false,"notNull": false},- "routing_reason": {- "name": "routing_reason",+ "group_id": {+ "name": "group_id","type": "text","primaryKey": false,"notNull": false},- "routing_attempt": {- "name": "routing_attempt",- "type": "integer",+ "pinned": {+ "name": "pinned",+ "type": "boolean","primaryKey": false,- "notNull": true,- "default": 0+ "notNull": false,+ "default": 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",+ "deleted_at": {+ "name": "deleted_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": false,- "default": "'{}'::jsonb"+ "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",@@ -12285,20 +15527,27 @@"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",+ "chat_groups_client_id_user_id_unique": {+ "name": "chat_groups_client_id_user_id_unique","columns": [{- "expression": "channel_id",+ "expression": "client_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "sequence",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"@@ -12309,44 +15558,26 @@"method": "btree","with": {}},- "channel_messages_request_key_unique": {- "name": "channel_messages_request_key_unique",+ "chat_groups_user_id_idx": {+ "name": "chat_groups_user_id_idx","columns": [{- "expression": "channel_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "request_key",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": true,+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "channel_messages_thread_sequence_idx": {- "name": "channel_messages_thread_sequence_idx",+ "chat_groups_group_id_idx": {+ "name": "chat_groups_group_id_idx","columns": [{- "expression": "channel_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "thread_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "sequence",+ "expression": "group_id","isExpression": false,"asc": true,"nulls": "last"@@ -12357,180 +15588,139 @@"method": "btree","with": {}},- "channel_messages_request_sequence_idx": {- "name": "channel_messages_request_sequence_idx",+ "chat_groups_workspace_id_idx": {+ "name": "chat_groups_workspace_id_idx","columns": [{- "expression": "channel_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "thread_id",- "isExpression": false,- "asc": true,- "nulls": "last"- },- {- "expression": "sequence",+ "expression": "workspace_id","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",+ "chat_groups_workspace_visibility_idx": {+ "name": "chat_groups_workspace_visibility_idx","columns": [{- "expression": "channel_id",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "id",+ "expression": "visibility",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_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"],+ "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"},- "channel_messages_user_id_users_id_fk": {- "name": "channel_messages_user_id_users_id_fk",- "tableFrom": "channel_messages",- "tableTo": "users",- "columnsFrom": ["user_id"],+ "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": "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",- "tableTo": "agents",- "columnsFrom": ["agent_id"],+ "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"- },- "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"]- }- },+ "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.chat_groups_agents": {+ "name": "chat_groups_agents","schema": "","columns": {- "id": {- "name": "id",+ "chat_group_id": {+ "name": "chat_group_id","type": "text",- "primaryKey": true,+ "primaryKey": false,"notNull": true},- "channel_id": {- "name": "channel_id",+ "agent_id": {+ "name": "agent_id","type": "text","primaryKey": false,"notNull": true},- "root_message_id": {- "name": "root_message_id",- "type": "uuid",+ "user_id": {+ "name": "user_id",+ "type": "text","primaryKey": false,"notNull": true},- "root_sequence": {- "name": "root_sequence",- "type": "integer",+ "workspace_id": {+ "name": "workspace_id",+ "type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "follower_member_ids": {- "name": "follower_member_ids",- "type": "jsonb",+ "enabled": {+ "name": "enabled",+ "type": "boolean","primaryKey": false,- "notNull": true,- "default": "'[]'::jsonb"+ "notNull": false,+ "default": true},- "status": {- "name": "status",- "type": "text",+ "order": {+ "name": "order",+ "type": "integer","primaryKey": false,- "notNull": true,- "default": "'active'"+ "notNull": false,+ "default": 0},- "metadata": {- "name": "metadata",- "type": "jsonb",+ "role": {+ "name": "role",+ "type": "text","primaryKey": false,"notNull": false,- "default": "'{}'::jsonb"+ "default": "'participant'"},- "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",@@ -12538,79 +15728,118 @@"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",+ "chat_groups_agents_user_id_idx": {+ "name": "chat_groups_agents_user_id_idx","columns": [{- "expression": "channel_id",+ "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": "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"],+ "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"},- "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",+ "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": {},- "uniqueConstraints": {- "channel_threads_scope_unique": {- "name": "channel_threads_scope_unique",- "nullsNotDistinct": false,- "columns": ["channel_id", "id"]+ "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.channels": {- "name": "channels",+ "public.user_connector_tools": {+ "name": "user_connector_tools","schema": "","columns": {"id": {"name": "id",- "type": "text",+ "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": false+ "notNull": true},"workspace_id": {"name": "workspace_id",@@ -12618,69 +15847,85 @@"primaryKey": false,"notNull": false},- "project_id": {- "name": "project_id",- "type": "text",+ "tool_name": {+ "name": "tool_name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "display_name": {+ "name": "display_name",+ "type": "varchar(255)","primaryKey": false,"notNull": false},- "agent_id": {- "name": "agent_id",+ "description": {+ "name": "description","type": "text","primaryKey": false,"notNull": false},- "title": {- "name": "title",+ "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},- "sequence": {- "name": "sequence",- "type": "integer",+ "render_config": {+ "name": "render_config",+ "type": "jsonb","primaryKey": false,- "notNull": true,- "default": 0+ "notNull": false},- "status": {- "name": "status",+ "permission": {+ "name": "permission","type": "text","primaryKey": false,- "notNull": true,- "default": "'active'"+ "notNull": true},- "visibility": {- "name": "visibility",- "type": "text",+ "is_work_artifact": {+ "name": "is_work_artifact",+ "type": "boolean","primaryKey": false,"notNull": true,- "default": "'private'"+ "default": false},- "config": {- "name": "config",+ "work_artifact_config": {+ "name": "work_artifact_config","type": "jsonb","primaryKey": false,"notNull": false},- "metadata": {- "name": "metadata",+ "limit_config": {+ "name": "limit_config","type": "jsonb","primaryKey": false,- "notNull": false,- "default": "'{}'::jsonb"+ "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",+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "now()"},"created_at": {"name": "created_at",@@ -12698,79 +15943,65 @@}},"indexes": {- "channels_user_id_idx": {- "name": "channels_user_id_idx",+ "user_connector_tools_connector_tool_unique": {+ "name": "user_connector_tools_connector_tool_unique","columns": [{- "expression": "user_id",+ "expression": "user_connector_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "tool_name","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,"concurrently": false,"method": "btree","with": {}},- "channels_direct_unique": {- "name": "channels_direct_unique",+ "user_connector_tools_user_id_idx": {+ "name": "user_connector_tools_user_id_idx","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",+ "isUnique": false,"concurrently": false,"method": "btree","with": {}},- "channels_project_id_idx": {- "name": "channels_project_id_idx",+ "user_connector_tools_connector_id_idx": {+ "name": "user_connector_tools_connector_id_idx","columns": [{- "expression": "project_id",+ "expression": "user_connector_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",+ "user_connector_tools_workspace_id_idx": {+ "name": "user_connector_tools_workspace_id_idx","columns": [{"expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"- },- {- "expression": "visibility",- "isExpression": false,- "asc": true,- "nulls": "last"}],"isUnique": false,@@ -12780,38 +16011,29 @@}},"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"],+ "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"},- "channels_project_id_projects_id_fk": {- "name": "channels_project_id_projects_id_fk",- "tableFrom": "channels",- "tableTo": "projects",- "columnsFrom": ["project_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": "set null",+ "onDelete": "cascade","onUpdate": "no action"},- "channels_agent_id_agents_id_fk": {- "name": "channels_agent_id_agents_id_fk",- "tableFrom": "channels",- "tableTo": "agents",- "columnsFrom": ["agent_id"],+ "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"@@ -12820,102 +16042,110 @@"compositePrimaryKeys": {},"uniqueConstraints": {},"policies": {},- "checkConstraints": {- "channels_direct_visibility_check": {- "name": "channels_direct_visibility_check",- "value": "\"channels\".\"agent_id\" IS NULL OR \"channels\".\"visibility\" = 'private'"- }- },+ "checkConstraints": {},"isRLSEnabled": false},- "public.chat_groups": {- "name": "chat_groups",+ "public.user_connectors": {+ "name": "user_connectors","schema": "","columns": {"id": {"name": "id",- "type": "text",+ "type": "uuid","primaryKey": true,- "notNull": true+ "notNull": true,+ "default": "gen_random_uuid()"},- "title": {- "name": "title",+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,- "notNull": 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},- "background_color": {- "name": "background_color",- "type": "text",+ "identifier": {+ "name": "identifier",+ "type": "varchar(255)","primaryKey": false,- "notNull": false+ "notNull": true},- "market_identifier": {- "name": "market_identifier",+ "name": {+ "name": "name",+ "type": "varchar(255)",+ "primaryKey": false,+ "notNull": true+ },+ "source_type": {+ "name": "source_type","type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "content": {- "name": "content",+ "mcp_server_url": {+ "name": "mcp_server_url","type": "text","primaryKey": false,"notNull": false},- "editor_data": {- "name": "editor_data",- "type": "jsonb",+ "mcp_connection_type": {+ "name": "mcp_connection_type",+ "type": "text","primaryKey": false,"notNull": false},- "config": {- "name": "config",+ "mcp_stdio_config": {+ "name": "mcp_stdio_config","type": "jsonb","primaryKey": false,"notNull": false},- "client_id": {- "name": "client_id",+ "status": {+ "name": "status","type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "user_id": {- "name": "user_id",- "type": "text",+ "is_enabled": {+ "name": "is_enabled",+ "type": "boolean","primaryKey": false,- "notNull": true+ "notNull": true,+ "default": true},- "workspace_id": {- "name": "workspace_id",- "type": "text",+ "oidc_config": {+ "name": "oidc_config",+ "type": "jsonb","primaryKey": false,"notNull": false},- "group_id": {- "name": "group_id",+ "credentials": {+ "name": "credentials","type": "text","primaryKey": false,"notNull": false},- "pinned": {- "name": "pinned",- "type": "boolean",+ "token_expires_at": {+ "name": "token_expires_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": false,- "default": false+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false},"visibility": {"name": "visibility",@@ -12924,18 +16154,6 @@"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",@@ -12959,47 +16177,83 @@}},"indexes": {- "chat_groups_client_id_user_id_unique": {- "name": "chat_groups_client_id_user_id_unique",+ "user_connectors_personal_identifier_idx": {+ "name": "user_connectors_personal_identifier_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "identifier",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"user_connectors\".\"workspace_id\" IS NULL AND \"user_connectors\".\"agent_id\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_connectors_workspace_identifier_idx": {+ "name": "user_connectors_workspace_identifier_idx","columns": [{- "expression": "client_id",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "user_id",+ "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": {}},- "chat_groups_user_id_idx": {- "name": "chat_groups_user_id_idx",+ "user_connectors_agent_identifier_idx": {+ "name": "user_connectors_agent_identifier_idx","columns": [{- "expression": "user_id",+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "identifier","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": false,+ "where": "\"user_connectors\".\"agent_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}},- "chat_groups_group_id_idx": {- "name": "chat_groups_group_id_idx",+ "user_connectors_user_id_idx": {+ "name": "user_connectors_user_id_idx","columns": [{- "expression": "group_id",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"@@ -13010,11 +16264,11 @@"method": "btree","with": {}},- "chat_groups_workspace_id_idx": {- "name": "chat_groups_workspace_id_idx",+ "user_connectors_token_expires_at_idx": {+ "name": "user_connectors_token_expires_at_idx","columns": [{- "expression": "workspace_id",+ "expression": "token_expires_at","isExpression": false,"asc": true,"nulls": "last"@@ -13025,23 +16279,26 @@"method": "btree","with": {}},- "chat_groups_workspace_visibility_idx": {- "name": "chat_groups_workspace_visibility_idx",+ "user_connectors_workspace_id_idx": {+ "name": "user_connectors_workspace_id_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": {}+ },+ "user_connectors_agent_id_idx": {+ "name": "user_connectors_agent_id_idx",+ "columns": [{- "expression": "user_id",+ "expression": "agent_id","isExpression": false,"asc": true,"nulls": "last"@@ -13054,31 +16311,31 @@}},"foreignKeys": {- "chat_groups_user_id_users_id_fk": {- "name": "chat_groups_user_id_users_id_fk",- "tableFrom": "chat_groups",+ "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"},- "chat_groups_workspace_id_workspaces_id_fk": {- "name": "chat_groups_workspace_id_workspaces_id_fk",- "tableFrom": "chat_groups",+ "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": "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"],+ "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",+ "onDelete": "cascade","onUpdate": "no action"}},@@ -13088,54 +16345,57 @@"checkConstraints": {},"isRLSEnabled": false},- "public.chat_groups_agents": {- "name": "chat_groups_agents",+ "public.user_installed_plugins": {+ "name": "user_installed_plugins","schema": "","columns": {- "chat_group_id": {- "name": "chat_group_id",+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,"notNull": true},- "agent_id": {- "name": "agent_id",+ "workspace_id": {+ "name": "workspace_id","type": "text","primaryKey": false,- "notNull": true+ "notNull": false},- "user_id": {- "name": "user_id",+ "identifier": {+ "name": "identifier","type": "text","primaryKey": false,"notNull": true},- "workspace_id": {- "name": "workspace_id",+ "type": {+ "name": "type","type": "text","primaryKey": false,+ "notNull": true+ },+ "manifest": {+ "name": "manifest",+ "type": "jsonb",+ "primaryKey": false,"notNull": false},- "enabled": {- "name": "enabled",- "type": "boolean",+ "settings": {+ "name": "settings",+ "type": "jsonb","primaryKey": false,- "notNull": false,- "default": true+ "notNull": false},- "order": {- "name": "order",- "type": "integer",+ "custom_params": {+ "name": "custom_params",+ "type": "jsonb","primaryKey": false,- "notNull": false,- "default": 0+ "notNull": false},- "role": {- "name": "role",- "type": "text",+ "source": {+ "name": "source",+ "type": "varchar(255)","primaryKey": false,- "notNull": false,- "default": "'participant'"+ "notNull": false},"accessed_at": {"name": "accessed_at",@@ -13160,23 +16420,8 @@}},"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",+ "user_installed_plugins_workspace_id_idx": {+ "name": "user_installed_plugins_workspace_id_idx","columns": [{"expression": "workspace_id",@@ -13192,36 +16437,18 @@}},"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_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"},- "chat_groups_agents_workspace_id_workspaces_id_fk": {- "name": "chat_groups_agents_workspace_id_workspaces_id_fk",- "tableFrom": "chat_groups_agents",+ "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"],@@ -13230,9 +16457,9 @@}},"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"]+ "user_installed_plugins_user_id_identifier_pk": {+ "name": "user_installed_plugins_user_id_identifier_pk",+ "columns": ["user_id", "identifier"]}},"uniqueConstraints": {},@@ -13240,8 +16467,8 @@"checkConstraints": {},"isRLSEnabled": false},- "public.user_connector_tools": {- "name": "user_connector_tools",+ "public.user_contact_requests": {+ "name": "user_contact_requests","schema": "","columns": {"id": {@@ -13251,14 +16478,14 @@"notNull": true,"default": "gen_random_uuid()"},- "user_connector_id": {- "name": "user_connector_id",- "type": "uuid",+ "requester_id": {+ "name": "requester_id",+ "type": "text","primaryKey": false,"notNull": true},- "user_id": {- "name": "user_id",+ "addressee_id": {+ "name": "addressee_id","type": "text","primaryKey": false,"notNull": true@@ -13269,76 +16496,22 @@"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",+ "message": {+ "name": "message","type": "text","primaryKey": false,- "notNull": true- },- "render_config": {- "name": "render_config",- "type": "jsonb",- "primaryKey": false,"notNull": false},- "permission": {- "name": "permission",+ "status": {+ "name": "status","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+ "default": "'pending'"},- "metadata": {- "name": "metadata",- "type": "jsonb",+ "responded_at": {+ "name": "responded_at",+ "type": "timestamp with time zone","primaryKey": false,"notNull": false},@@ -13365,32 +16538,67 @@}},"indexes": {- "user_connector_tools_connector_tool_unique": {- "name": "user_connector_tools_connector_tool_unique",+ "user_contact_requests_pending_unique": {+ "name": "user_contact_requests_pending_unique","columns": [{- "expression": "user_connector_id",+ "expression": "requester_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "tool_name",+ "expression": "addressee_id","isExpression": false,"asc": true,"nulls": "last"}],"isUnique": true,+ "where": "\"user_contact_requests\".\"status\" = 'pending' AND \"user_contact_requests\".\"workspace_id\" IS NULL","concurrently": false,"method": "btree","with": {}},- "user_connector_tools_user_id_idx": {- "name": "user_connector_tools_user_id_idx",+ "user_contact_requests_workspace_pending_unique": {+ "name": "user_contact_requests_workspace_pending_unique","columns": [{- "expression": "user_id",+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "requester_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "addressee_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"user_contact_requests\".\"status\" = 'pending' AND \"user_contact_requests\".\"workspace_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_contact_requests_addressee_status_idx": {+ "name": "user_contact_requests_addressee_status_idx",+ "columns": [+ {+ "expression": "addressee_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status","isExpression": false,"asc": true,"nulls": "last"@@ -13401,11 +16609,17 @@"method": "btree","with": {}},- "user_connector_tools_connector_id_idx": {- "name": "user_connector_tools_connector_id_idx",+ "user_contact_requests_requester_status_idx": {+ "name": "user_contact_requests_requester_status_idx","columns": [{- "expression": "user_connector_id",+ "expression": "requester_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "status","isExpression": false,"asc": true,"nulls": "last"@@ -13416,8 +16630,8 @@"method": "btree","with": {}},- "user_connector_tools_workspace_id_idx": {- "name": "user_connector_tools_workspace_id_idx",+ "user_contact_requests_workspace_id_idx": {+ "name": "user_contact_requests_workspace_id_idx","columns": [{"expression": "workspace_id",@@ -13433,27 +16647,27 @@}},"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"],+ "user_contact_requests_requester_id_users_id_fk": {+ "name": "user_contact_requests_requester_id_users_id_fk",+ "tableFrom": "user_contact_requests",+ "tableTo": "users",+ "columnsFrom": ["requester_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",+ "user_contact_requests_addressee_id_users_id_fk": {+ "name": "user_contact_requests_addressee_id_users_id_fk",+ "tableFrom": "user_contact_requests","tableTo": "users",- "columnsFrom": ["user_id"],+ "columnsFrom": ["addressee_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",+ "user_contact_requests_workspace_id_workspaces_id_fk": {+ "name": "user_contact_requests_workspace_id_workspaces_id_fk",+ "tableFrom": "user_contact_requests","tableTo": "workspaces","columnsFrom": ["workspace_id"],"columnsTo": ["id"],@@ -13464,11 +16678,16 @@"compositePrimaryKeys": {},"uniqueConstraints": {},"policies": {},- "checkConstraints": {},+ "checkConstraints": {+ "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.user_connectors": {- "name": "user_connectors",+ "public.user_contact_tag_assignments": {+ "name": "user_contact_tag_assignments","schema": "","columns": {"id": {@@ -13478,96 +16697,169 @@"notNull": true,"default": "gen_random_uuid()"},- "user_id": {- "name": "user_id",- "type": "text",+ "tag_id": {+ "name": "tag_id",+ "type": "uuid","primaryKey": false,"notNull": true},- "workspace_id": {- "name": "workspace_id",- "type": "text",+ "contact_id": {+ "name": "contact_id",+ "type": "uuid","primaryKey": false,- "notNull": false+ "notNull": true},- "agent_id": {- "name": "agent_id",+ "user_id": {+ "name": "user_id","type": "text","primaryKey": false,- "notNull": false- },- "identifier": {- "name": "identifier",- "type": "varchar(255)",- "primaryKey": false,"notNull": true},- "name": {- "name": "name",- "type": "varchar(255)",+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": true+ "notNull": true,+ "default": "now()"},- "source_type": {- "name": "source_type",- "type": "text",+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": true+ "notNull": true,+ "default": "now()"},- "mcp_server_url": {- "name": "mcp_server_url",- "type": "text",+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "user_contact_tag_assignments_tag_id_contact_id_unique": {+ "name": "user_contact_tag_assignments_tag_id_contact_id_unique",+ "columns": [+ {+ "expression": "tag_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "contact_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}},- "mcp_connection_type": {- "name": "mcp_connection_type",- "type": "text",- "primaryKey": false,- "notNull": false+ "user_contact_tag_assignments_contact_id_idx": {+ "name": "user_contact_tag_assignments_contact_id_idx",+ "columns": [+ {+ "expression": "contact_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}},- "mcp_stdio_config": {- "name": "mcp_stdio_config",- "type": "jsonb",- "primaryKey": false,- "notNull": false+ "user_contact_tag_assignments_user_id_idx": {+ "name": "user_contact_tag_assignments_user_id_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "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"},- "status": {- "name": "status",- "type": "text",- "primaryKey": false,- "notNull": true+ "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"},- "is_enabled": {- "name": "is_enabled",- "type": "boolean",- "primaryKey": false,+ "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": true+ "default": "gen_random_uuid()"},- "oidc_config": {- "name": "oidc_config",- "type": "jsonb",+ "user_id": {+ "name": "user_id",+ "type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "credentials": {- "name": "credentials",+ "name": {+ "name": "name","type": "text","primaryKey": false,- "notNull": false+ "notNull": true},- "token_expires_at": {- "name": "token_expires_at",- "type": "timestamp with time zone",+ "color": {+ "name": "color",+ "type": "text","primaryKey": false,"notNull": false},- "metadata": {- "name": "metadata",- "type": "jsonb",+ "sort_order": {+ "name": "sort_order",+ "type": "integer","primaryKey": false,- "notNull": false+ "notNull": true,+ "default": 0},"accessed_at": {"name": "accessed_at",@@ -13592,8 +16884,8 @@}},"indexes": {- "user_connectors_personal_identifier_idx": {- "name": "user_connectors_personal_identifier_idx",+ "user_contact_tags_user_id_name_unique": {+ "name": "user_contact_tags_user_id_name_unique","columns": [{"expression": "user_id",@@ -13602,20 +16894,125 @@"nulls": "last"},{- "expression": "identifier",+ "expression": "name","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,- "where": "\"user_connectors\".\"workspace_id\" IS NULL AND \"user_connectors\".\"agent_id\" IS NULL",+ "isUnique": true,"concurrently": false,"method": "btree","with": {}+ }+ },+ "foreignKeys": {+ "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"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_contacts": {+ "name": "user_contacts",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"},- "user_connectors_workspace_identifier_idx": {- "name": "user_connectors_workspace_identifier_idx",+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "contact_user_id": {+ "name": "contact_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "remark": {+ "name": "remark",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "phones": {+ "name": "phones",+ "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": {+ "user_contacts_user_unique": {+ "name": "user_contacts_user_unique","columns": [{"expression": "user_id",@@ -13623,6 +17020,22 @@"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 AND \"user_contacts\".\"workspace_id\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_contacts_workspace_user_unique": {+ "name": "user_contacts_workspace_user_unique",+ "columns": [{"expression": "workspace_id","isExpression": false,@@ -13630,60 +17043,73 @@"nulls": "last"},{- "expression": "identifier",+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "contact_user_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,- "where": "\"user_connectors\".\"workspace_id\" IS NOT NULL AND \"user_connectors\".\"agent_id\" IS NULL",+ "isUnique": true,+ "where": "\"user_contacts\".\"contact_user_id\" IS NOT NULL AND \"user_contacts\".\"workspace_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}},- "user_connectors_agent_identifier_idx": {- "name": "user_connectors_agent_identifier_idx",+ "user_contacts_agent_unique": {+ "name": "user_contacts_agent_unique","columns": [{- "expression": "agent_id",+ "expression": "user_id","isExpression": false,"asc": true,"nulls": "last"},{- "expression": "identifier",+ "expression": "agent_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,- "where": "\"user_connectors\".\"agent_id\" IS NOT NULL",+ "isUnique": true,+ "where": "\"user_contacts\".\"agent_id\" IS NOT NULL AND \"user_contacts\".\"workspace_id\" IS NULL","concurrently": false,"method": "btree","with": {}},- "user_connectors_user_id_idx": {- "name": "user_connectors_user_id_idx",+ "user_contacts_workspace_agent_unique": {+ "name": "user_contacts_workspace_agent_unique","columns": [{- "expression": "user_id",+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "agent_id","isExpression": false,"asc": true,"nulls": "last"}],- "isUnique": false,+ "isUnique": true,+ "where": "\"user_contacts\".\"agent_id\" IS NOT NULL AND \"user_contacts\".\"workspace_id\" IS NOT NULL","concurrently": false,"method": "btree","with": {}},- "user_connectors_token_expires_at_idx": {- "name": "user_connectors_token_expires_at_idx",+ "user_contacts_contact_user_id_idx": {+ "name": "user_contacts_contact_user_id_idx","columns": [{- "expression": "token_expires_at",+ "expression": "contact_user_id","isExpression": false,"asc": true,"nulls": "last"@@ -13694,11 +17120,11 @@"method": "btree","with": {}},- "user_connectors_workspace_id_idx": {- "name": "user_connectors_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"@@ -13709,11 +17135,11 @@"method": "btree","with": {}},- "user_connectors_agent_id_idx": {- "name": "user_connectors_agent_id_idx",+ "user_contacts_workspace_id_idx": {+ "name": "user_contacts_workspace_id_idx","columns": [{- "expression": "agent_id",+ "expression": "workspace_id","isExpression": false,"asc": true,"nulls": "last"@@ -13726,157 +17152,44 @@}},"foreignKeys": {- "user_connectors_user_id_users_id_fk": {- "name": "user_connectors_user_id_users_id_fk",- "tableFrom": "user_connectors",+ "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"},- "user_connectors_workspace_id_workspaces_id_fk": {- "name": "user_connectors_workspace_id_workspaces_id_fk",- "tableFrom": "user_connectors",+ "user_contacts_workspace_id_workspaces_id_fk": {+ "name": "user_contacts_workspace_id_workspaces_id_fk",+ "tableFrom": "user_contacts","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",- "tableTo": "agents",- "columnsFrom": ["agent_id"],- "columnsTo": ["id"],- "onDelete": "cascade",- "onUpdate": "no action"- }- },- "compositePrimaryKeys": {},- "uniqueConstraints": {},- "policies": {},- "checkConstraints": {},- "isRLSEnabled": false- },- "public.user_installed_plugins": {- "name": "user_installed_plugins",- "schema": "",- "columns": {- "user_id": {- "name": "user_id",- "type": "text",- "primaryKey": false,- "notNull": true- },- "workspace_id": {- "name": "workspace_id",- "type": "text",- "primaryKey": false,- "notNull": false- },- "identifier": {- "name": "identifier",- "type": "text",- "primaryKey": false,- "notNull": true- },- "type": {- "name": "type",- "type": "text",- "primaryKey": false,- "notNull": true- },- "manifest": {- "name": "manifest",- "type": "jsonb",- "primaryKey": false,- "notNull": false- },- "settings": {- "name": "settings",- "type": "jsonb",- "primaryKey": false,- "notNull": false- },- "custom_params": {- "name": "custom_params",- "type": "jsonb",- "primaryKey": false,- "notNull": false- },- "source": {- "name": "source",- "type": "varchar(255)",- "primaryKey": false,- "notNull": false- },- "accessed_at": {- "name": "accessed_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": true,- "default": "now()"- },- "created_at": {- "name": "created_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": true,- "default": "now()"- },- "updated_at": {- "name": "updated_at",- "type": "timestamp with time zone",- "primaryKey": false,- "notNull": true,- "default": "now()"- }- },- "indexes": {- "user_installed_plugins_workspace_id_idx": {- "name": "user_installed_plugins_workspace_id_idx",- "columns": [- {- "expression": "workspace_id",- "isExpression": false,- "asc": true,- "nulls": "last"- }- ],- "isUnique": false,- "concurrently": false,- "method": "btree",- "with": {}- }- },- "foreignKeys": {- "user_installed_plugins_user_id_users_id_fk": {- "name": "user_installed_plugins_user_id_users_id_fk",- "tableFrom": "user_installed_plugins",+ "user_contacts_contact_user_id_users_id_fk": {+ "name": "user_contacts_contact_user_id_users_id_fk",+ "tableFrom": "user_contacts","tableTo": "users",- "columnsFrom": ["user_id"],+ "columnsFrom": ["contact_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",- "tableTo": "workspaces",- "columnsFrom": ["workspace_id"],+ "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": {- "user_installed_plugins_user_id_identifier_pk": {- "name": "user_installed_plugins_user_id_identifier_pk",- "columns": ["user_id", "identifier"]- }- },+ "compositePrimaryKeys": {},"uniqueConstraints": {},"policies": {},"checkConstraints": {},@@ -15507,6 +18820,12 @@"primaryKey": false,"notNull": false},+ "project_id": {+ "name": "project_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },"name": {"name": "name","type": "varchar(255)",@@ -15592,6 +18911,22 @@"method": "btree","with": {}},+ "environments_project_id_unique": {+ "name": "environments_project_id_unique",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"environments\".\"project_id\" is not null",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },"environments_workspace_visibility_idx": {"name": "environments_workspace_visibility_idx","columns": [@@ -15636,7 +18971,7 @@}],"isUnique": true,- "where": "\"environments\".\"workspace_id\" is null",+ "where": "\"environments\".\"workspace_id\" IS NULL AND \"environments\".\"project_id\" IS NULL","concurrently": false,"method": "btree","with": {}@@ -15664,7 +18999,7 @@}],"isUnique": true,- "where": "\"environments\".\"workspace_id\" is not null",+ "where": "\"environments\".\"workspace_id\" IS NOT NULL AND \"environments\".\"project_id\" IS NULL","concurrently": false,"method": "btree","with": {}@@ -15688,6 +19023,15 @@"columnsTo": ["id"],"onDelete": "restrict","onUpdate": "no action"+ },+ "environments_project_id_projects_id_fk": {+ "name": "environments_project_id_projects_id_fk",+ "tableFrom": "environments",+ "tableTo": "projects",+ "columnsFrom": ["project_id"],+ "columnsTo": ["id"],+ "onDelete": "restrict",+ "onUpdate": "no action"}},"compositePrimaryKeys": {},@@ -22583,6 +25927,338 @@"checkConstraints": {},"isRLSEnabled": false},+ "public.inbound_webhooks": {+ "name": "inbound_webhooks",+ "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+ },+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "agent_id": {+ "name": "agent_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "topic_id": {+ "name": "topic_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "instructions": {+ "name": "instructions",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "secret": {+ "name": "secret",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "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+ },+ "dedupe_key": {+ "name": "dedupe_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "next_maintenance_at": {+ "name": "next_maintenance_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "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+ },+ "last_error": {+ "name": "last_error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "wake_count": {+ "name": "wake_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "wake_window_started_at": {+ "name": "wake_window_started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "accessed_at": {+ "name": "accessed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "inbound_webhooks_user_kind_dedupe_unique": {+ "name": "inbound_webhooks_user_kind_dedupe_unique",+ "columns": [+ {+ "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": {}+ },+ "inbound_webhooks_next_maintenance_idx": {+ "name": "inbound_webhooks_next_maintenance_idx",+ "columns": [+ {+ "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": {}+ },+ "inbound_webhooks_user_idx": {+ "name": "inbound_webhooks_user_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "inbound_webhooks_workspace_idx": {+ "name": "inbound_webhooks_workspace_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "inbound_webhooks_topic_idx": {+ "name": "inbound_webhooks_topic_idx",+ "columns": [+ {+ "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": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "inbound_webhooks_connector_idx": {+ "name": "inbound_webhooks_connector_idx",+ "columns": [+ {+ "expression": "connector_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "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"+ },+ "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"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },"public.linear_connections": {"name": "linear_connections","schema": "",@@ -48572,6 +52248,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 a383420d31d..04db923d415 100644--- a/packages/database/migrations/meta/_journal.json+++ b/packages/database/migrations/meta/_journal.json@@ -1547,7 +1547,14 @@"when": 1794939107563,"tag": "0220_channel_sections","breakpoints": true+ },+ {+ "idx": 221,+ "version": "7",+ "when": 1794996111307,+ "tag": "0221_project_environment_owner",+ "breakpoints": true}],"version": "6"-}\ No newline at end of file+}diff --git a/packages/database/src/schemas/__tests__/environment.test.ts b/packages/database/src/schemas/__tests__/environment.test.tsindex c9a6339b773..bccf7c41141 100644--- a/packages/database/src/schemas/__tests__/environment.test.ts+++ b/packages/database/src/schemas/__tests__/environment.test.ts@@ -133,6 +133,59 @@ describe('Environment registration schema', () => {await createEnvironment('Data analysis', workspaceId, colleagueId);});+ it('gives a project at most one environment of its own', async () => {+ const project = await createProject('OWN');+ await db+ .insert(environments)+ .values({ configuration, name: 'Own', projectId: project.id, userId });++ await expect(+ db+ .insert(environments)+ .values({ configuration, name: 'Second', projectId: project.id, userId }),+ ).rejects.toMatchObject({ cause: { constraint: 'environments_project_id_unique' } });+ });++ it("keeps a project's environment out of the per-member name uniqueness", async () => {+ // A project's environment is named after the project and only ever shown+ // inside it, so it must not collide with a standalone environment or with+ // another project's of the same name.+ const first = await createProject('NAMEA');+ const second = await createProject('NAMEB');+ await createEnvironment('Shared name');++ await db.insert(environments).values([+ { configuration, name: 'Shared name', projectId: first.id, userId },+ { configuration, name: 'Shared name', projectId: second.id, userId },+ ]);++ // Standalone environments still identify one by name per member.+ await expect(createEnvironment('Shared name')).rejects.toMatchObject({+ cause: { constraint: 'environments_user_name_unique' },+ });+ });++ it('refuses to delete a project until its environment is dealt with', async () => {+ // Not `set null`: the environment would turn standalone under its+ // project-derived name and could collide with a standalone one of the+ // same name. The caller removes it, or releases it under a name of its+ // own, first.+ const project = await createProject('GONE');+ await createEnvironment('Same name');+ const [own] = await db+ .insert(environments)+ .values({ configuration, name: 'Same name', projectId: project.id, userId })+ .returning();++ await expect(db.delete(projects).where(eq(projects.id, project.id))).rejects.toMatchObject({+ cause: { constraint: 'environments_project_id_projects_id_fk' },+ });++ await db.delete(environments).where(eq(environments.id, own.id));+ await db.delete(projects).where(eq(projects.id, project.id));+ expect(await db.select().from(projects).where(eq(projects.id, project.id))).toEqual([]);+ });+it('retains environment records until explicit cleanup on owner or workspace deletion', async () => {await db.insert(workspaces)diff --git a/packages/database/src/schemas/environment.ts b/packages/database/src/schemas/environment.tsindex a9d7cf5cb04..12d9246be31 100644--- a/packages/database/src/schemas/environment.ts+++ b/packages/database/src/schemas/environment.ts@@ -1,5 +1,5 @@import type { EnvironmentConfiguration } from '@lobechat/types';-import { isNotNull, isNull, sql } from 'drizzle-orm';+import { isNotNull, sql } from 'drizzle-orm';import {boolean,check,@@ -13,12 +13,19 @@ import {} from 'drizzle-orm/pg-core';import { timestamps } from './_helpers';+import { projects } from './project';import { users } from './user';import { workspaces } from './workspace';/**- * A reusable working environment. Projects associate with this resource without- * taking ownership. Registration alone neither provisions compute nor persists files.+ * A working environment: the repositories to check out, the setup that makes+ * them usable and the variables every command sees. Registration alone neither+ * provisions compute nor persists files.+ *+ * Two kinds of row share the table. A row with `project_id` is that project's+ * environment — every project has exactly one, made with it, edited on the+ * project's own settings and never listed anywhere else. A row without one is a+ * standalone environment from「设置 → 环境」, picked per conversation.*/export const environments = pgTable('environments',@@ -29,6 +36,18 @@ export const environments = pgTable(.references(() => users.id, { onDelete: 'restrict' }).notNull(),workspaceId: text('workspace_id').references(() => workspaces.id, { onDelete: 'restrict' }),+ /**+ * The project this environment belongs to, or null for a standalone one.+ *+ * `restrict`: a project is deleted only after its environment has been+ * dealt with — removed when nothing was built from it, otherwise released+ * as standalone under a name of its own. Not `set null`, which would turn+ * it standalone under its project-derived name, collide with the+ * standalone name indexes and abort the deletion; and not `cascade`, since+ * instances reference the row with `restrict` and their builds live on the+ * execution plane.+ */+ projectId: text('project_id').references(() => projects.id, { onDelete: 'restrict' }),name: varchar('name', { length: 255 }).notNull(),description: text('description'),/** Registration availability, not the running/stopped state of an instance. */@@ -51,6 +70,8 @@ export const environments = pgTable((t) => [index('environments_user_id_idx').on(t.userId),index('environments_workspace_id_idx').on(t.workspaceId),+ // One environment per project.+ uniqueIndex('environments_project_id_unique').on(t.projectId).where(isNotNull(t.projectId)),// The listing's own shape: one workspace, one visibility, then the creator// — which is the order `buildWorkspaceWhere` narrows in.index('environments_workspace_visibility_idx').on(t.workspaceId, t.visibility, t.userId),@@ -60,10 +81,16 @@ export const environments = pgTable(// environment without either having to rename theirs. Sharing one into a// project goes through `project_environments`, which references a row// instead of matching it by name.- uniqueIndex('environments_user_name_unique').on(t.userId, t.name).where(isNull(t.workspaceId)),+ //+ // A project's environment is named after the project and only ever shown+ // inside it, so it takes no part: two projects of the same name, or a+ // project named like a standalone environment, must not collide.+ uniqueIndex('environments_user_name_unique')+ .on(t.userId, t.name)+ .where(sql`${t.workspaceId} IS NULL AND ${t.projectId} IS NULL`),uniqueIndex('environments_workspace_user_name_unique').on(t.workspaceId, t.userId, t.name)- .where(isNotNull(t.workspaceId)),+ .where(sql`${t.workspaceId} IS NOT NULL AND ${t.projectId} IS NULL`),check('environments_name_not_empty', sql`length(btrim(${t.name})) > 0`),check('environments_configuration_object', sql`jsonb_typeof(${t.configuration}) = 'object'`),],