diff --git a/packages/db/src/migrations/0094_plugin_config_company_scope.sql b/packages/db/src/migrations/0094_plugin_config_company_scope.sql deleted file mode 100644 index 381fcb7f..00000000 --- a/packages/db/src/migrations/0094_plugin_config_company_scope.sql +++ /dev/null @@ -1,11 +0,0 @@ -ALTER TABLE "plugin_config" ADD COLUMN IF NOT EXISTS "company_id" uuid;--> statement-breakpoint -DO $$ BEGIN - IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'plugin_config_company_id_companies_id_fk') THEN - ALTER TABLE "plugin_config" ADD CONSTRAINT "plugin_config_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON DELETE cascade ON UPDATE no action; - END IF; -END $$;--> statement-breakpoint -DROP INDEX IF EXISTS "plugin_config_plugin_id_idx";--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "plugin_config_plugin_id_idx" ON "plugin_config" USING btree ("plugin_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "plugin_config_company_id_idx" ON "plugin_config" USING btree ("company_id");--> statement-breakpoint -CREATE UNIQUE INDEX IF NOT EXISTS "plugin_config_legacy_plugin_id_uq" ON "plugin_config" USING btree ("plugin_id") WHERE "plugin_config"."company_id" is null;--> statement-breakpoint -CREATE UNIQUE INDEX IF NOT EXISTS "plugin_config_company_plugin_uq" ON "plugin_config" USING btree ("plugin_id","company_id") WHERE "plugin_config"."company_id" is not null; diff --git a/packages/db/src/migrations/meta/0094_snapshot.json b/packages/db/src/migrations/meta/0094_snapshot.json deleted file mode 100644 index 214c435a..00000000 --- a/packages/db/src/migrations/meta/0094_snapshot.json +++ /dev/null @@ -1,19615 +0,0 @@ -{ - "id": "2168fe84-c36e-4f66-b32b-16d07294e61e", - "prevId": "8b20879c-4a71-4a03-adb8-d1567d5540a3", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.activity_log": { - "name": "activity_log", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_type": { - "name": "actor_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'system'" - }, - "actor_id": { - "name": "actor_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "agent_id": { - "name": "agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "run_id": { - "name": "run_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "details": { - "name": "details", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "activity_log_company_created_idx": { - "name": "activity_log_company_created_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "activity_log_run_id_idx": { - "name": "activity_log_run_id_idx", - "columns": [ - { - "expression": "run_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "activity_log_entity_type_id_idx": { - "name": "activity_log_entity_type_id_idx", - "columns": [ - { - "expression": "entity_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "entity_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "activity_log_company_id_companies_id_fk": { - "name": "activity_log_company_id_companies_id_fk", - "tableFrom": "activity_log", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "activity_log_agent_id_agents_id_fk": { - "name": "activity_log_agent_id_agents_id_fk", - "tableFrom": "activity_log", - "tableTo": "agents", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "activity_log_run_id_heartbeat_runs_id_fk": { - "name": "activity_log_run_id_heartbeat_runs_id_fk", - "tableFrom": "activity_log", - "tableTo": "heartbeat_runs", - "columnsFrom": [ - "run_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.agent_api_keys": { - "name": "agent_api_keys", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "agent_id": { - "name": "agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "key_hash": { - "name": "key_hash", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "last_used_at": { - "name": "last_used_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "revoked_at": { - "name": "revoked_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()" - } - }, - "indexes": { - "agent_api_keys_key_hash_idx": { - "name": "agent_api_keys_key_hash_idx", - "columns": [ - { - "expression": "key_hash", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "agent_api_keys_company_agent_idx": { - "name": "agent_api_keys_company_agent_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "agent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "agent_api_keys_agent_id_agents_id_fk": { - "name": "agent_api_keys_agent_id_agents_id_fk", - "tableFrom": "agent_api_keys", - "tableTo": "agents", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_api_keys_company_id_companies_id_fk": { - "name": "agent_api_keys_company_id_companies_id_fk", - "tableFrom": "agent_api_keys", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.agent_config_revisions": { - "name": "agent_config_revisions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "agent_id": { - "name": "agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_by_agent_id": { - "name": "created_by_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "source": { - "name": "source", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'patch'" - }, - "rolled_back_from_revision_id": { - "name": "rolled_back_from_revision_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "changed_keys": { - "name": "changed_keys", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'[]'::jsonb" - }, - "before_config": { - "name": "before_config", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "after_config": { - "name": "after_config", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "agent_config_revisions_company_agent_created_idx": { - "name": "agent_config_revisions_company_agent_created_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "agent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "agent_config_revisions_agent_created_idx": { - "name": "agent_config_revisions_agent_created_idx", - "columns": [ - { - "expression": "agent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "agent_config_revisions_company_id_companies_id_fk": { - "name": "agent_config_revisions_company_id_companies_id_fk", - "tableFrom": "agent_config_revisions", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_config_revisions_agent_id_agents_id_fk": { - "name": "agent_config_revisions_agent_id_agents_id_fk", - "tableFrom": "agent_config_revisions", - "tableTo": "agents", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "agent_config_revisions_created_by_agent_id_agents_id_fk": { - "name": "agent_config_revisions_created_by_agent_id_agents_id_fk", - "tableFrom": "agent_config_revisions", - "tableTo": "agents", - "columnsFrom": [ - "created_by_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.agent_memberships": { - "name": "agent_memberships", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "agent_id": { - "name": "agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "state": { - "name": "state", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'joined'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "agent_memberships_company_user_idx": { - "name": "agent_memberships_company_user_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "agent_memberships_agent_idx": { - "name": "agent_memberships_agent_idx", - "columns": [ - { - "expression": "agent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "agent_memberships_company_user_agent_uq": { - "name": "agent_memberships_company_user_agent_uq", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "agent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "agent_memberships_company_id_companies_id_fk": { - "name": "agent_memberships_company_id_companies_id_fk", - "tableFrom": "agent_memberships", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "agent_memberships_agent_id_agents_id_fk": { - "name": "agent_memberships_agent_id_agents_id_fk", - "tableFrom": "agent_memberships", - "tableTo": "agents", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.agent_runtime_state": { - "name": "agent_runtime_state", - "schema": "", - "columns": { - "agent_id": { - "name": "agent_id", - "type": "uuid", - "primaryKey": true, - "notNull": true - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "adapter_type": { - "name": "adapter_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "session_id": { - "name": "session_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "state_json": { - "name": "state_json", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "last_run_id": { - "name": "last_run_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "last_run_status": { - "name": "last_run_status", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "total_input_tokens": { - "name": "total_input_tokens", - "type": "bigint", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "total_output_tokens": { - "name": "total_output_tokens", - "type": "bigint", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "total_cached_input_tokens": { - "name": "total_cached_input_tokens", - "type": "bigint", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "total_cost_cents": { - "name": "total_cost_cents", - "type": "bigint", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "last_error": { - "name": "last_error", - "type": "text", - "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": { - "agent_runtime_state_company_agent_idx": { - "name": "agent_runtime_state_company_agent_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "agent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "agent_runtime_state_company_updated_idx": { - "name": "agent_runtime_state_company_updated_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "agent_runtime_state_agent_id_agents_id_fk": { - "name": "agent_runtime_state_agent_id_agents_id_fk", - "tableFrom": "agent_runtime_state", - "tableTo": "agents", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_runtime_state_company_id_companies_id_fk": { - "name": "agent_runtime_state_company_id_companies_id_fk", - "tableFrom": "agent_runtime_state", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.agent_task_sessions": { - "name": "agent_task_sessions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "agent_id": { - "name": "agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "adapter_type": { - "name": "adapter_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "task_key": { - "name": "task_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "session_params_json": { - "name": "session_params_json", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "session_display_id": { - "name": "session_display_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "last_run_id": { - "name": "last_run_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "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": { - "agent_task_sessions_company_agent_adapter_task_uniq": { - "name": "agent_task_sessions_company_agent_adapter_task_uniq", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "agent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "adapter_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "task_key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "agent_task_sessions_company_agent_updated_idx": { - "name": "agent_task_sessions_company_agent_updated_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "agent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "agent_task_sessions_company_task_updated_idx": { - "name": "agent_task_sessions_company_task_updated_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "task_key", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "agent_task_sessions_company_id_companies_id_fk": { - "name": "agent_task_sessions_company_id_companies_id_fk", - "tableFrom": "agent_task_sessions", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_task_sessions_agent_id_agents_id_fk": { - "name": "agent_task_sessions_agent_id_agents_id_fk", - "tableFrom": "agent_task_sessions", - "tableTo": "agents", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_task_sessions_last_run_id_heartbeat_runs_id_fk": { - "name": "agent_task_sessions_last_run_id_heartbeat_runs_id_fk", - "tableFrom": "agent_task_sessions", - "tableTo": "heartbeat_runs", - "columnsFrom": [ - "last_run_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.agent_wakeup_requests": { - "name": "agent_wakeup_requests", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "agent_id": { - "name": "agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "source": { - "name": "source", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "trigger_detail": { - "name": "trigger_detail", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "payload": { - "name": "payload", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'queued'" - }, - "coalesced_count": { - "name": "coalesced_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "requested_by_actor_type": { - "name": "requested_by_actor_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "requested_by_actor_id": { - "name": "requested_by_actor_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "idempotency_key": { - "name": "idempotency_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "run_id": { - "name": "run_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "requested_at": { - "name": "requested_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "claimed_at": { - "name": "claimed_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "finished_at": { - "name": "finished_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "error": { - "name": "error", - "type": "text", - "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": { - "agent_wakeup_requests_company_agent_status_idx": { - "name": "agent_wakeup_requests_company_agent_status_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "agent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "agent_wakeup_requests_company_requested_idx": { - "name": "agent_wakeup_requests_company_requested_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "requested_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "agent_wakeup_requests_agent_requested_idx": { - "name": "agent_wakeup_requests_agent_requested_idx", - "columns": [ - { - "expression": "agent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "requested_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "agent_wakeup_requests_company_id_companies_id_fk": { - "name": "agent_wakeup_requests_company_id_companies_id_fk", - "tableFrom": "agent_wakeup_requests", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_wakeup_requests_agent_id_agents_id_fk": { - "name": "agent_wakeup_requests_agent_id_agents_id_fk", - "tableFrom": "agent_wakeup_requests", - "tableTo": "agents", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.agents": { - "name": "agents", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'general'" - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "icon": { - "name": "icon", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'idle'" - }, - "reports_to": { - "name": "reports_to", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "capabilities": { - "name": "capabilities", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "adapter_type": { - "name": "adapter_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'process'" - }, - "adapter_config": { - "name": "adapter_config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "runtime_config": { - "name": "runtime_config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "default_environment_id": { - "name": "default_environment_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "budget_monthly_cents": { - "name": "budget_monthly_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "spent_monthly_cents": { - "name": "spent_monthly_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "pause_reason": { - "name": "pause_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "paused_at": { - "name": "paused_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "permissions": { - "name": "permissions", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "last_heartbeat_at": { - "name": "last_heartbeat_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "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": { - "agents_company_status_idx": { - "name": "agents_company_status_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "agents_company_reports_to_idx": { - "name": "agents_company_reports_to_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "reports_to", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "agents_company_default_environment_idx": { - "name": "agents_company_default_environment_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "default_environment_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "agents_company_id_companies_id_fk": { - "name": "agents_company_id_companies_id_fk", - "tableFrom": "agents", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agents_reports_to_agents_id_fk": { - "name": "agents_reports_to_agents_id_fk", - "tableFrom": "agents", - "tableTo": "agents", - "columnsFrom": [ - "reports_to" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agents_default_environment_id_environments_id_fk": { - "name": "agents_default_environment_id_environments_id_fk", - "tableFrom": "agents", - "tableTo": "environments", - "columnsFrom": [ - "default_environment_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.approval_comments": { - "name": "approval_comments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "approval_id": { - "name": "approval_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "author_agent_id": { - "name": "author_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "author_user_id": { - "name": "author_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "body": { - "name": "body", - "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": { - "approval_comments_company_idx": { - "name": "approval_comments_company_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "approval_comments_approval_idx": { - "name": "approval_comments_approval_idx", - "columns": [ - { - "expression": "approval_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "approval_comments_approval_created_idx": { - "name": "approval_comments_approval_created_idx", - "columns": [ - { - "expression": "approval_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "approval_comments_company_id_companies_id_fk": { - "name": "approval_comments_company_id_companies_id_fk", - "tableFrom": "approval_comments", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "approval_comments_approval_id_approvals_id_fk": { - "name": "approval_comments_approval_id_approvals_id_fk", - "tableFrom": "approval_comments", - "tableTo": "approvals", - "columnsFrom": [ - "approval_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "approval_comments_author_agent_id_agents_id_fk": { - "name": "approval_comments_author_agent_id_agents_id_fk", - "tableFrom": "approval_comments", - "tableTo": "agents", - "columnsFrom": [ - "author_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.approvals": { - "name": "approvals", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "requested_by_agent_id": { - "name": "requested_by_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "requested_by_user_id": { - "name": "requested_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "payload": { - "name": "payload", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "decision_note": { - "name": "decision_note", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "decided_by_user_id": { - "name": "decided_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "decided_at": { - "name": "decided_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": { - "approvals_company_status_type_idx": { - "name": "approvals_company_status_type_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "type", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "approvals_company_id_companies_id_fk": { - "name": "approvals_company_id_companies_id_fk", - "tableFrom": "approvals", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "approvals_requested_by_agent_id_agents_id_fk": { - "name": "approvals_requested_by_agent_id_agents_id_fk", - "tableFrom": "approvals", - "tableTo": "agents", - "columnsFrom": [ - "requested_by_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.assets": { - "name": "assets", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "object_key": { - "name": "object_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content_type": { - "name": "content_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "byte_size": { - "name": "byte_size", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "sha256": { - "name": "sha256", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "original_filename": { - "name": "original_filename", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_by_agent_id": { - "name": "created_by_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "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": { - "assets_company_created_idx": { - "name": "assets_company_created_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "assets_company_provider_idx": { - "name": "assets_company_provider_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "provider", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "assets_company_object_key_uq": { - "name": "assets_company_object_key_uq", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "object_key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "assets_company_id_companies_id_fk": { - "name": "assets_company_id_companies_id_fk", - "tableFrom": "assets", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "assets_created_by_agent_id_agents_id_fk": { - "name": "assets_created_by_agent_id_agents_id_fk", - "tableFrom": "assets", - "tableTo": "agents", - "columnsFrom": [ - "created_by_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.account": { - "name": "account", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "account_id": { - "name": "account_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider_id": { - "name": "provider_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "access_token": { - "name": "access_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "refresh_token": { - "name": "refresh_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "id_token": { - "name": "id_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "access_token_expires_at": { - "name": "access_token_expires_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "scope": { - "name": "scope", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "password": { - "name": "password", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "account_user_id_user_id_fk": { - "name": "account_user_id_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "session_user_id_user_id_fk": { - "name": "session_user_id_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email_verified": { - "name": "email_verified", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "image": { - "name": "image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.verification": { - "name": "verification", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "identifier": { - "name": "identifier", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.board_api_keys": { - "name": "board_api_keys", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "key_hash": { - "name": "key_hash", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "last_used_at": { - "name": "last_used_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_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()" - } - }, - "indexes": { - "board_api_keys_key_hash_idx": { - "name": "board_api_keys_key_hash_idx", - "columns": [ - { - "expression": "key_hash", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "board_api_keys_user_idx": { - "name": "board_api_keys_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "board_api_keys_user_id_user_id_fk": { - "name": "board_api_keys_user_id_user_id_fk", - "tableFrom": "board_api_keys", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.budget_incidents": { - "name": "budget_incidents", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "scope_type": { - "name": "scope_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "scope_id": { - "name": "scope_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "metric": { - "name": "metric", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "window_kind": { - "name": "window_kind", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "window_start": { - "name": "window_start", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - }, - "window_end": { - "name": "window_end", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - }, - "threshold_type": { - "name": "threshold_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "amount_limit": { - "name": "amount_limit", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "amount_observed": { - "name": "amount_observed", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'open'" - }, - "approval_id": { - "name": "approval_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "resolved_at": { - "name": "resolved_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": { - "budget_incidents_company_status_idx": { - "name": "budget_incidents_company_status_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "budget_incidents_company_scope_idx": { - "name": "budget_incidents_company_scope_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "scope_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "scope_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "budget_incidents_policy_window_threshold_idx": { - "name": "budget_incidents_policy_window_threshold_idx", - "columns": [ - { - "expression": "policy_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "window_start", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "threshold_type", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "where": "\"budget_incidents\".\"status\" <> 'dismissed'", - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "budget_incidents_company_id_companies_id_fk": { - "name": "budget_incidents_company_id_companies_id_fk", - "tableFrom": "budget_incidents", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "budget_incidents_policy_id_budget_policies_id_fk": { - "name": "budget_incidents_policy_id_budget_policies_id_fk", - "tableFrom": "budget_incidents", - "tableTo": "budget_policies", - "columnsFrom": [ - "policy_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "budget_incidents_approval_id_approvals_id_fk": { - "name": "budget_incidents_approval_id_approvals_id_fk", - "tableFrom": "budget_incidents", - "tableTo": "approvals", - "columnsFrom": [ - "approval_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.budget_policies": { - "name": "budget_policies", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "scope_type": { - "name": "scope_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "scope_id": { - "name": "scope_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "metric": { - "name": "metric", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'billed_cents'" - }, - "window_kind": { - "name": "window_kind", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "amount": { - "name": "amount", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "warn_percent": { - "name": "warn_percent", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 80 - }, - "hard_stop_enabled": { - "name": "hard_stop_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "notify_enabled": { - "name": "notify_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "updated_by_user_id": { - "name": "updated_by_user_id", - "type": "text", - "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": { - "budget_policies_company_scope_active_idx": { - "name": "budget_policies_company_scope_active_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "scope_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "scope_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "is_active", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "budget_policies_company_window_idx": { - "name": "budget_policies_company_window_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "window_kind", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "metric", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "budget_policies_company_scope_metric_unique_idx": { - "name": "budget_policies_company_scope_metric_unique_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "scope_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "scope_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "metric", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "window_kind", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "budget_policies_company_id_companies_id_fk": { - "name": "budget_policies_company_id_companies_id_fk", - "tableFrom": "budget_policies", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.cli_auth_challenges": { - "name": "cli_auth_challenges", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "secret_hash": { - "name": "secret_hash", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "command": { - "name": "command", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "requested_access": { - "name": "requested_access", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'board'" - }, - "requested_company_id": { - "name": "requested_company_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "pending_key_hash": { - "name": "pending_key_hash", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "pending_key_name": { - "name": "pending_key_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "approved_by_user_id": { - "name": "approved_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "board_api_key_id": { - "name": "board_api_key_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "approved_at": { - "name": "approved_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "cancelled_at": { - "name": "cancelled_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp with time zone", - "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": { - "cli_auth_challenges_secret_hash_idx": { - "name": "cli_auth_challenges_secret_hash_idx", - "columns": [ - { - "expression": "secret_hash", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "cli_auth_challenges_approved_by_idx": { - "name": "cli_auth_challenges_approved_by_idx", - "columns": [ - { - "expression": "approved_by_user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "cli_auth_challenges_requested_company_idx": { - "name": "cli_auth_challenges_requested_company_idx", - "columns": [ - { - "expression": "requested_company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "cli_auth_challenges_requested_company_id_companies_id_fk": { - "name": "cli_auth_challenges_requested_company_id_companies_id_fk", - "tableFrom": "cli_auth_challenges", - "tableTo": "companies", - "columnsFrom": [ - "requested_company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "cli_auth_challenges_approved_by_user_id_user_id_fk": { - "name": "cli_auth_challenges_approved_by_user_id_user_id_fk", - "tableFrom": "cli_auth_challenges", - "tableTo": "user", - "columnsFrom": [ - "approved_by_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "cli_auth_challenges_board_api_key_id_board_api_keys_id_fk": { - "name": "cli_auth_challenges_board_api_key_id_board_api_keys_id_fk", - "tableFrom": "cli_auth_challenges", - "tableTo": "board_api_keys", - "columnsFrom": [ - "board_api_key_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.cloud_upstream_connections": { - "name": "cloud_upstream_connections", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "remote_url": { - "name": "remote_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "source_instance_id": { - "name": "source_instance_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "source_instance_fingerprint": { - "name": "source_instance_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "source_public_key": { - "name": "source_public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "private_key_pem": { - "name": "private_key_pem", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token_status": { - "name": "token_status", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "scopes": { - "name": "scopes", - "type": "text[]", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "authorized_global_user_id": { - "name": "authorized_global_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "access_token": { - "name": "access_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "token_id": { - "name": "token_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "token_expires_at": { - "name": "token_expires_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "target_stack_id": { - "name": "target_stack_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_stack_slug": { - "name": "target_stack_slug", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "target_stack_display_name": { - "name": "target_stack_display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "target_company_id": { - "name": "target_company_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_origin": { - "name": "target_origin", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_primary_host": { - "name": "target_primary_host", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_product": { - "name": "target_product", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_schema_major": { - "name": "target_schema_major", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "target_max_chunk_bytes": { - "name": "target_max_chunk_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "pending_state": { - "name": "pending_state", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "pending_code_verifier": { - "name": "pending_code_verifier", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "pending_redirect_uri": { - "name": "pending_redirect_uri", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "pending_token_url": { - "name": "pending_token_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "last_run_id": { - "name": "last_run_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": { - "cloud_upstream_connections_company_idx": { - "name": "cloud_upstream_connections_company_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "cloud_upstream_connections_company_id_companies_id_fk": { - "name": "cloud_upstream_connections_company_id_companies_id_fk", - "tableFrom": "cloud_upstream_connections", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.cloud_upstream_runs": { - "name": "cloud_upstream_runs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "connection_id": { - "name": "connection_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "remote_run_id": { - "name": "remote_run_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "active_step": { - "name": "active_step", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "progress_percent": { - "name": "progress_percent", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "dry_run": { - "name": "dry_run", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "retry_of_run_id": { - "name": "retry_of_run_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "summary": { - "name": "summary", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'[]'::jsonb" - }, - "warnings": { - "name": "warnings", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'[]'::jsonb" - }, - "conflicts": { - "name": "conflicts", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'[]'::jsonb" - }, - "events": { - "name": "events", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'[]'::jsonb" - }, - "report": { - "name": "report", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "idempotency_key": { - "name": "idempotency_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "manifest_hash": { - "name": "manifest_hash", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_url": { - "name": "target_url", - "type": "text", - "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()" - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "cloud_upstream_runs_company_created_idx": { - "name": "cloud_upstream_runs_company_created_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "cloud_upstream_runs_connection_idx": { - "name": "cloud_upstream_runs_connection_idx", - "columns": [ - { - "expression": "connection_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "cloud_upstream_runs_connection_id_cloud_upstream_connections_id_fk": { - "name": "cloud_upstream_runs_connection_id_cloud_upstream_connections_id_fk", - "tableFrom": "cloud_upstream_runs", - "tableTo": "cloud_upstream_connections", - "columnsFrom": [ - "connection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "cloud_upstream_runs_company_id_companies_id_fk": { - "name": "cloud_upstream_runs_company_id_companies_id_fk", - "tableFrom": "cloud_upstream_runs", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.companies": { - "name": "companies", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'active'" - }, - "pause_reason": { - "name": "pause_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "paused_at": { - "name": "paused_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "issue_prefix": { - "name": "issue_prefix", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'PAP'" - }, - "issue_counter": { - "name": "issue_counter", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "budget_monthly_cents": { - "name": "budget_monthly_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "spent_monthly_cents": { - "name": "spent_monthly_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "attachment_max_bytes": { - "name": "attachment_max_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 10485760 - }, - "require_board_approval_for_new_agents": { - "name": "require_board_approval_for_new_agents", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "feedback_data_sharing_enabled": { - "name": "feedback_data_sharing_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "feedback_data_sharing_consent_at": { - "name": "feedback_data_sharing_consent_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "feedback_data_sharing_consent_by_user_id": { - "name": "feedback_data_sharing_consent_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "feedback_data_sharing_terms_version": { - "name": "feedback_data_sharing_terms_version", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "brand_color": { - "name": "brand_color", - "type": "text", - "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": { - "companies_issue_prefix_idx": { - "name": "companies_issue_prefix_idx", - "columns": [ - { - "expression": "issue_prefix", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.company_logos": { - "name": "company_logos", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "asset_id": { - "name": "asset_id", - "type": "uuid", - "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": { - "company_logos_company_uq": { - "name": "company_logos_company_uq", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "company_logos_asset_uq": { - "name": "company_logos_asset_uq", - "columns": [ - { - "expression": "asset_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "company_logos_company_id_companies_id_fk": { - "name": "company_logos_company_id_companies_id_fk", - "tableFrom": "company_logos", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "company_logos_asset_id_assets_id_fk": { - "name": "company_logos_asset_id_assets_id_fk", - "tableFrom": "company_logos", - "tableTo": "assets", - "columnsFrom": [ - "asset_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.company_memberships": { - "name": "company_memberships", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "principal_type": { - "name": "principal_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "principal_id": { - "name": "principal_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'active'" - }, - "membership_role": { - "name": "membership_role", - "type": "text", - "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": { - "company_memberships_company_principal_unique_idx": { - "name": "company_memberships_company_principal_unique_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "principal_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "principal_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "company_memberships_principal_status_idx": { - "name": "company_memberships_principal_status_idx", - "columns": [ - { - "expression": "principal_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "principal_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "company_memberships_company_status_idx": { - "name": "company_memberships_company_status_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "company_memberships_company_id_companies_id_fk": { - "name": "company_memberships_company_id_companies_id_fk", - "tableFrom": "company_memberships", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.company_secret_bindings": { - "name": "company_secret_bindings", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "secret_id": { - "name": "secret_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "target_type": { - "name": "target_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_id": { - "name": "target_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "config_path": { - "name": "config_path", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "version_selector": { - "name": "version_selector", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'latest'" - }, - "required": { - "name": "required", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "label": { - "name": "label", - "type": "text", - "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": { - "company_secret_bindings_company_idx": { - "name": "company_secret_bindings_company_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "company_secret_bindings_secret_idx": { - "name": "company_secret_bindings_secret_idx", - "columns": [ - { - "expression": "secret_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "company_secret_bindings_target_idx": { - "name": "company_secret_bindings_target_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "target_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "target_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "company_secret_bindings_target_path_uq": { - "name": "company_secret_bindings_target_path_uq", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "target_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "target_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "config_path", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "company_secret_bindings_company_id_companies_id_fk": { - "name": "company_secret_bindings_company_id_companies_id_fk", - "tableFrom": "company_secret_bindings", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "company_secret_bindings_secret_id_company_secrets_id_fk": { - "name": "company_secret_bindings_secret_id_company_secrets_id_fk", - "tableFrom": "company_secret_bindings", - "tableTo": "company_secrets", - "columnsFrom": [ - "secret_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.company_secret_provider_configs": { - "name": "company_secret_provider_configs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'ready'" - }, - "is_default": { - "name": "is_default", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "config": { - "name": "config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "health_status": { - "name": "health_status", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "health_checked_at": { - "name": "health_checked_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "health_message": { - "name": "health_message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "health_details": { - "name": "health_details", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "disabled_at": { - "name": "disabled_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "created_by_agent_id": { - "name": "created_by_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "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": { - "company_secret_provider_configs_company_idx": { - "name": "company_secret_provider_configs_company_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "company_secret_provider_configs_company_provider_idx": { - "name": "company_secret_provider_configs_company_provider_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "provider", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "company_secret_provider_configs_default_uq": { - "name": "company_secret_provider_configs_default_uq", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "provider", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "where": "\"company_secret_provider_configs\".\"is_default\" = true", - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "company_secret_provider_configs_company_id_companies_id_fk": { - "name": "company_secret_provider_configs_company_id_companies_id_fk", - "tableFrom": "company_secret_provider_configs", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "company_secret_provider_configs_created_by_agent_id_agents_id_fk": { - "name": "company_secret_provider_configs_created_by_agent_id_agents_id_fk", - "tableFrom": "company_secret_provider_configs", - "tableTo": "agents", - "columnsFrom": [ - "created_by_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.company_secret_versions": { - "name": "company_secret_versions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "secret_id": { - "name": "secret_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "material": { - "name": "material", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "value_sha256": { - "name": "value_sha256", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider_version_ref": { - "name": "provider_version_ref", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'current'" - }, - "fingerprint_sha256": { - "name": "fingerprint_sha256", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "rotation_job_id": { - "name": "rotation_job_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_by_agent_id": { - "name": "created_by_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "revoked_at": { - "name": "revoked_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "company_secret_versions_secret_idx": { - "name": "company_secret_versions_secret_idx", - "columns": [ - { - "expression": "secret_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "company_secret_versions_value_sha256_idx": { - "name": "company_secret_versions_value_sha256_idx", - "columns": [ - { - "expression": "value_sha256", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "company_secret_versions_fingerprint_idx": { - "name": "company_secret_versions_fingerprint_idx", - "columns": [ - { - "expression": "fingerprint_sha256", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "company_secret_versions_secret_version_uq": { - "name": "company_secret_versions_secret_version_uq", - "columns": [ - { - "expression": "secret_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "version", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "company_secret_versions_secret_id_company_secrets_id_fk": { - "name": "company_secret_versions_secret_id_company_secrets_id_fk", - "tableFrom": "company_secret_versions", - "tableTo": "company_secrets", - "columnsFrom": [ - "secret_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "company_secret_versions_created_by_agent_id_agents_id_fk": { - "name": "company_secret_versions_created_by_agent_id_agents_id_fk", - "tableFrom": "company_secret_versions", - "tableTo": "agents", - "columnsFrom": [ - "created_by_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.company_secrets": { - "name": "company_secrets", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'local_encrypted'" - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'active'" - }, - "managed_mode": { - "name": "managed_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'paperclip_managed'" - }, - "external_ref": { - "name": "external_ref", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "provider_config_id": { - "name": "provider_config_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "provider_metadata": { - "name": "provider_metadata", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "latest_version": { - "name": "latest_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "last_resolved_at": { - "name": "last_resolved_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "last_rotated_at": { - "name": "last_rotated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "deleted_at": { - "name": "deleted_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "created_by_agent_id": { - "name": "created_by_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "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": { - "company_secrets_company_idx": { - "name": "company_secrets_company_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "company_secrets_company_provider_idx": { - "name": "company_secrets_company_provider_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "provider", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "company_secrets_provider_config_idx": { - "name": "company_secrets_provider_config_idx", - "columns": [ - { - "expression": "provider_config_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "company_secrets_company_name_uq": { - "name": "company_secrets_company_name_uq", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "name", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "company_secrets_company_key_uq": { - "name": "company_secrets_company_key_uq", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "company_secrets_company_id_companies_id_fk": { - "name": "company_secrets_company_id_companies_id_fk", - "tableFrom": "company_secrets", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "company_secrets_provider_config_id_company_secret_provider_configs_id_fk": { - "name": "company_secrets_provider_config_id_company_secret_provider_configs_id_fk", - "tableFrom": "company_secrets", - "tableTo": "company_secret_provider_configs", - "columnsFrom": [ - "provider_config_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "company_secrets_created_by_agent_id_agents_id_fk": { - "name": "company_secrets_created_by_agent_id_agents_id_fk", - "tableFrom": "company_secrets", - "tableTo": "agents", - "columnsFrom": [ - "created_by_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.company_skills": { - "name": "company_skills", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "markdown": { - "name": "markdown", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "source_type": { - "name": "source_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'local_path'" - }, - "source_locator": { - "name": "source_locator", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "source_ref": { - "name": "source_ref", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "trust_level": { - "name": "trust_level", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'markdown_only'" - }, - "compatibility": { - "name": "compatibility", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'compatible'" - }, - "file_inventory": { - "name": "file_inventory", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'[]'::jsonb" - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "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": { - "company_skills_company_key_idx": { - "name": "company_skills_company_key_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "company_skills_company_name_idx": { - "name": "company_skills_company_name_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "name", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "company_skills_company_id_companies_id_fk": { - "name": "company_skills_company_id_companies_id_fk", - "tableFrom": "company_skills", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.company_user_sidebar_preferences": { - "name": "company_user_sidebar_preferences", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "project_order": { - "name": "project_order", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "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": { - "company_user_sidebar_preferences_company_idx": { - "name": "company_user_sidebar_preferences_company_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "company_user_sidebar_preferences_user_idx": { - "name": "company_user_sidebar_preferences_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "company_user_sidebar_preferences_company_user_uq": { - "name": "company_user_sidebar_preferences_company_user_uq", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "company_user_sidebar_preferences_company_id_companies_id_fk": { - "name": "company_user_sidebar_preferences_company_id_companies_id_fk", - "tableFrom": "company_user_sidebar_preferences", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.cost_events": { - "name": "cost_events", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "agent_id": { - "name": "agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "issue_id": { - "name": "issue_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "project_id": { - "name": "project_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "goal_id": { - "name": "goal_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "heartbeat_run_id": { - "name": "heartbeat_run_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "billing_code": { - "name": "billing_code", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "biller": { - "name": "biller", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'unknown'" - }, - "billing_type": { - "name": "billing_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'unknown'" - }, - "model": { - "name": "model", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "input_tokens": { - "name": "input_tokens", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "cached_input_tokens": { - "name": "cached_input_tokens", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "output_tokens": { - "name": "output_tokens", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "cost_cents": { - "name": "cost_cents", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "occurred_at": { - "name": "occurred_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "cost_events_company_occurred_idx": { - "name": "cost_events_company_occurred_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "occurred_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "cost_events_company_agent_occurred_idx": { - "name": "cost_events_company_agent_occurred_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "agent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "occurred_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "cost_events_company_provider_occurred_idx": { - "name": "cost_events_company_provider_occurred_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "provider", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "occurred_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "cost_events_company_biller_occurred_idx": { - "name": "cost_events_company_biller_occurred_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "biller", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "occurred_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "cost_events_company_heartbeat_run_idx": { - "name": "cost_events_company_heartbeat_run_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "heartbeat_run_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "cost_events_company_id_companies_id_fk": { - "name": "cost_events_company_id_companies_id_fk", - "tableFrom": "cost_events", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "cost_events_agent_id_agents_id_fk": { - "name": "cost_events_agent_id_agents_id_fk", - "tableFrom": "cost_events", - "tableTo": "agents", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "cost_events_issue_id_issues_id_fk": { - "name": "cost_events_issue_id_issues_id_fk", - "tableFrom": "cost_events", - "tableTo": "issues", - "columnsFrom": [ - "issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "cost_events_project_id_projects_id_fk": { - "name": "cost_events_project_id_projects_id_fk", - "tableFrom": "cost_events", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "cost_events_goal_id_goals_id_fk": { - "name": "cost_events_goal_id_goals_id_fk", - "tableFrom": "cost_events", - "tableTo": "goals", - "columnsFrom": [ - "goal_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "cost_events_heartbeat_run_id_heartbeat_runs_id_fk": { - "name": "cost_events_heartbeat_run_id_heartbeat_runs_id_fk", - "tableFrom": "cost_events", - "tableTo": "heartbeat_runs", - "columnsFrom": [ - "heartbeat_run_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.document_annotation_anchor_snapshots": { - "name": "document_annotation_anchor_snapshots", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "thread_id": { - "name": "thread_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "from_revision_id": { - "name": "from_revision_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "from_revision_number": { - "name": "from_revision_number", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "to_revision_id": { - "name": "to_revision_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "to_revision_number": { - "name": "to_revision_number", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "previous_anchor": { - "name": "previous_anchor", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "next_anchor": { - "name": "next_anchor", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "anchor_state": { - "name": "anchor_state", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "anchor_confidence": { - "name": "anchor_confidence", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "failure_reason": { - "name": "failure_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "document_annotation_anchor_snapshots_company_thread_created_at_idx": { - "name": "document_annotation_anchor_snapshots_company_thread_created_at_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "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": {} - }, - "document_annotation_anchor_snapshots_company_document_revision_idx": { - "name": "document_annotation_anchor_snapshots_company_document_revision_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "to_revision_number", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "document_annotation_anchor_snapshots_company_id_companies_id_fk": { - "name": "document_annotation_anchor_snapshots_company_id_companies_id_fk", - "tableFrom": "document_annotation_anchor_snapshots", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "document_annotation_anchor_snapshots_thread_id_document_annotation_threads_id_fk": { - "name": "document_annotation_anchor_snapshots_thread_id_document_annotation_threads_id_fk", - "tableFrom": "document_annotation_anchor_snapshots", - "tableTo": "document_annotation_threads", - "columnsFrom": [ - "thread_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "document_annotation_anchor_snapshots_document_id_documents_id_fk": { - "name": "document_annotation_anchor_snapshots_document_id_documents_id_fk", - "tableFrom": "document_annotation_anchor_snapshots", - "tableTo": "documents", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "document_annotation_anchor_snapshots_from_revision_id_document_revisions_id_fk": { - "name": "document_annotation_anchor_snapshots_from_revision_id_document_revisions_id_fk", - "tableFrom": "document_annotation_anchor_snapshots", - "tableTo": "document_revisions", - "columnsFrom": [ - "from_revision_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "document_annotation_anchor_snapshots_to_revision_id_document_revisions_id_fk": { - "name": "document_annotation_anchor_snapshots_to_revision_id_document_revisions_id_fk", - "tableFrom": "document_annotation_anchor_snapshots", - "tableTo": "document_revisions", - "columnsFrom": [ - "to_revision_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.document_annotation_comments": { - "name": "document_annotation_comments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "thread_id": { - "name": "thread_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "issue_id": { - "name": "issue_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_type": { - "name": "author_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_agent_id": { - "name": "author_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "author_user_id": { - "name": "author_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_by_run_id": { - "name": "created_by_run_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": { - "document_annotation_comments_company_thread_created_at_idx": { - "name": "document_annotation_comments_company_thread_created_at_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "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": {} - }, - "document_annotation_comments_company_issue_created_at_idx": { - "name": "document_annotation_comments_company_issue_created_at_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "document_annotation_comments_company_document_created_at_idx": { - "name": "document_annotation_comments_company_document_created_at_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "document_annotation_comments_body_search_idx": { - "name": "document_annotation_comments_body_search_idx", - "columns": [ - { - "expression": "body", - "isExpression": false, - "asc": true, - "nulls": "last", - "opclass": "gin_trgm_ops" - } - ], - "isUnique": false, - "concurrently": false, - "method": "gin", - "with": {} - } - }, - "foreignKeys": { - "document_annotation_comments_company_id_companies_id_fk": { - "name": "document_annotation_comments_company_id_companies_id_fk", - "tableFrom": "document_annotation_comments", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "document_annotation_comments_thread_id_document_annotation_threads_id_fk": { - "name": "document_annotation_comments_thread_id_document_annotation_threads_id_fk", - "tableFrom": "document_annotation_comments", - "tableTo": "document_annotation_threads", - "columnsFrom": [ - "thread_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "document_annotation_comments_issue_id_issues_id_fk": { - "name": "document_annotation_comments_issue_id_issues_id_fk", - "tableFrom": "document_annotation_comments", - "tableTo": "issues", - "columnsFrom": [ - "issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "document_annotation_comments_document_id_documents_id_fk": { - "name": "document_annotation_comments_document_id_documents_id_fk", - "tableFrom": "document_annotation_comments", - "tableTo": "documents", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "document_annotation_comments_author_agent_id_agents_id_fk": { - "name": "document_annotation_comments_author_agent_id_agents_id_fk", - "tableFrom": "document_annotation_comments", - "tableTo": "agents", - "columnsFrom": [ - "author_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "document_annotation_comments_created_by_run_id_heartbeat_runs_id_fk": { - "name": "document_annotation_comments_created_by_run_id_heartbeat_runs_id_fk", - "tableFrom": "document_annotation_comments", - "tableTo": "heartbeat_runs", - "columnsFrom": [ - "created_by_run_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.document_annotation_threads": { - "name": "document_annotation_threads", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "issue_id": { - "name": "issue_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "document_key": { - "name": "document_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'open'" - }, - "anchor_state": { - "name": "anchor_state", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'active'" - }, - "original_revision_id": { - "name": "original_revision_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "original_revision_number": { - "name": "original_revision_number", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "current_revision_id": { - "name": "current_revision_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "current_revision_number": { - "name": "current_revision_number", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "selected_text": { - "name": "selected_text", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "prefix_text": { - "name": "prefix_text", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "suffix_text": { - "name": "suffix_text", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "normalized_start": { - "name": "normalized_start", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "normalized_end": { - "name": "normalized_end", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "markdown_start": { - "name": "markdown_start", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "markdown_end": { - "name": "markdown_end", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "anchor_confidence": { - "name": "anchor_confidence", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'exact'" - }, - "anchor_selector": { - "name": "anchor_selector", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "created_by_agent_id": { - "name": "created_by_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "resolved_by_agent_id": { - "name": "resolved_by_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "resolved_by_user_id": { - "name": "resolved_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "resolved_at": { - "name": "resolved_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": { - "document_annotation_threads_company_document_status_idx": { - "name": "document_annotation_threads_company_document_status_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "document_annotation_threads_company_issue_status_idx": { - "name": "document_annotation_threads_company_issue_status_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "document_annotation_threads_company_current_revision_open_idx": { - "name": "document_annotation_threads_company_current_revision_open_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "current_revision_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "document_annotation_threads_company_anchor_state_idx": { - "name": "document_annotation_threads_company_anchor_state_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "anchor_state", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "document_annotation_threads_company_id_companies_id_fk": { - "name": "document_annotation_threads_company_id_companies_id_fk", - "tableFrom": "document_annotation_threads", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "document_annotation_threads_issue_id_issues_id_fk": { - "name": "document_annotation_threads_issue_id_issues_id_fk", - "tableFrom": "document_annotation_threads", - "tableTo": "issues", - "columnsFrom": [ - "issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "document_annotation_threads_document_id_documents_id_fk": { - "name": "document_annotation_threads_document_id_documents_id_fk", - "tableFrom": "document_annotation_threads", - "tableTo": "documents", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "document_annotation_threads_original_revision_id_document_revisions_id_fk": { - "name": "document_annotation_threads_original_revision_id_document_revisions_id_fk", - "tableFrom": "document_annotation_threads", - "tableTo": "document_revisions", - "columnsFrom": [ - "original_revision_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "document_annotation_threads_current_revision_id_document_revisions_id_fk": { - "name": "document_annotation_threads_current_revision_id_document_revisions_id_fk", - "tableFrom": "document_annotation_threads", - "tableTo": "document_revisions", - "columnsFrom": [ - "current_revision_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "document_annotation_threads_created_by_agent_id_agents_id_fk": { - "name": "document_annotation_threads_created_by_agent_id_agents_id_fk", - "tableFrom": "document_annotation_threads", - "tableTo": "agents", - "columnsFrom": [ - "created_by_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "document_annotation_threads_resolved_by_agent_id_agents_id_fk": { - "name": "document_annotation_threads_resolved_by_agent_id_agents_id_fk", - "tableFrom": "document_annotation_threads", - "tableTo": "agents", - "columnsFrom": [ - "resolved_by_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.document_revisions": { - "name": "document_revisions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "revision_number": { - "name": "revision_number", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "format": { - "name": "format", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'markdown'" - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "change_summary": { - "name": "change_summary", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_by_agent_id": { - "name": "created_by_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_by_run_id": { - "name": "created_by_run_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "document_revisions_document_revision_uq": { - "name": "document_revisions_document_revision_uq", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "revision_number", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "document_revisions_company_document_created_idx": { - "name": "document_revisions_company_document_created_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "document_revisions_company_id_companies_id_fk": { - "name": "document_revisions_company_id_companies_id_fk", - "tableFrom": "document_revisions", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "document_revisions_document_id_documents_id_fk": { - "name": "document_revisions_document_id_documents_id_fk", - "tableFrom": "document_revisions", - "tableTo": "documents", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "document_revisions_created_by_agent_id_agents_id_fk": { - "name": "document_revisions_created_by_agent_id_agents_id_fk", - "tableFrom": "document_revisions", - "tableTo": "agents", - "columnsFrom": [ - "created_by_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "document_revisions_created_by_run_id_heartbeat_runs_id_fk": { - "name": "document_revisions_created_by_run_id_heartbeat_runs_id_fk", - "tableFrom": "document_revisions", - "tableTo": "heartbeat_runs", - "columnsFrom": [ - "created_by_run_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.documents": { - "name": "documents", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "format": { - "name": "format", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'markdown'" - }, - "latest_body": { - "name": "latest_body", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "latest_revision_id": { - "name": "latest_revision_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "latest_revision_number": { - "name": "latest_revision_number", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "created_by_agent_id": { - "name": "created_by_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "updated_by_agent_id": { - "name": "updated_by_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "updated_by_user_id": { - "name": "updated_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "locked_at": { - "name": "locked_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "locked_by_agent_id": { - "name": "locked_by_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "locked_by_user_id": { - "name": "locked_by_user_id", - "type": "text", - "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": { - "documents_company_updated_idx": { - "name": "documents_company_updated_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "documents_company_created_idx": { - "name": "documents_company_created_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "documents_title_search_idx": { - "name": "documents_title_search_idx", - "columns": [ - { - "expression": "title", - "isExpression": false, - "asc": true, - "nulls": "last", - "opclass": "gin_trgm_ops" - } - ], - "isUnique": false, - "concurrently": false, - "method": "gin", - "with": {} - }, - "documents_latest_body_search_idx": { - "name": "documents_latest_body_search_idx", - "columns": [ - { - "expression": "latest_body", - "isExpression": false, - "asc": true, - "nulls": "last", - "opclass": "gin_trgm_ops" - } - ], - "isUnique": false, - "concurrently": false, - "method": "gin", - "with": {} - } - }, - "foreignKeys": { - "documents_company_id_companies_id_fk": { - "name": "documents_company_id_companies_id_fk", - "tableFrom": "documents", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "documents_created_by_agent_id_agents_id_fk": { - "name": "documents_created_by_agent_id_agents_id_fk", - "tableFrom": "documents", - "tableTo": "agents", - "columnsFrom": [ - "created_by_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "documents_updated_by_agent_id_agents_id_fk": { - "name": "documents_updated_by_agent_id_agents_id_fk", - "tableFrom": "documents", - "tableTo": "agents", - "columnsFrom": [ - "updated_by_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "documents_locked_by_agent_id_agents_id_fk": { - "name": "documents_locked_by_agent_id_agents_id_fk", - "tableFrom": "documents", - "tableTo": "agents", - "columnsFrom": [ - "locked_by_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.environment_leases": { - "name": "environment_leases", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "environment_id": { - "name": "environment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "execution_workspace_id": { - "name": "execution_workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "issue_id": { - "name": "issue_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "heartbeat_run_id": { - "name": "heartbeat_run_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'active'" - }, - "lease_policy": { - "name": "lease_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'ephemeral'" - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "provider_lease_id": { - "name": "provider_lease_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "acquired_at": { - "name": "acquired_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_used_at": { - "name": "last_used_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "released_at": { - "name": "released_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "failure_reason": { - "name": "failure_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "cleanup_status": { - "name": "cleanup_status", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "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": { - "environment_leases_company_environment_status_idx": { - "name": "environment_leases_company_environment_status_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "environment_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "environment_leases_company_execution_workspace_idx": { - "name": "environment_leases_company_execution_workspace_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "execution_workspace_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "environment_leases_company_issue_idx": { - "name": "environment_leases_company_issue_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "environment_leases_heartbeat_run_idx": { - "name": "environment_leases_heartbeat_run_idx", - "columns": [ - { - "expression": "heartbeat_run_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "environment_leases_company_last_used_idx": { - "name": "environment_leases_company_last_used_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "last_used_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "environment_leases_provider_lease_idx": { - "name": "environment_leases_provider_lease_idx", - "columns": [ - { - "expression": "provider_lease_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "environment_leases_company_id_companies_id_fk": { - "name": "environment_leases_company_id_companies_id_fk", - "tableFrom": "environment_leases", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "environment_leases_environment_id_environments_id_fk": { - "name": "environment_leases_environment_id_environments_id_fk", - "tableFrom": "environment_leases", - "tableTo": "environments", - "columnsFrom": [ - "environment_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "environment_leases_execution_workspace_id_execution_workspaces_id_fk": { - "name": "environment_leases_execution_workspace_id_execution_workspaces_id_fk", - "tableFrom": "environment_leases", - "tableTo": "execution_workspaces", - "columnsFrom": [ - "execution_workspace_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "environment_leases_issue_id_issues_id_fk": { - "name": "environment_leases_issue_id_issues_id_fk", - "tableFrom": "environment_leases", - "tableTo": "issues", - "columnsFrom": [ - "issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "environment_leases_heartbeat_run_id_heartbeat_runs_id_fk": { - "name": "environment_leases_heartbeat_run_id_heartbeat_runs_id_fk", - "tableFrom": "environment_leases", - "tableTo": "heartbeat_runs", - "columnsFrom": [ - "heartbeat_run_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.environments": { - "name": "environments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "driver": { - "name": "driver", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'local'" - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'active'" - }, - "config": { - "name": "config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "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": { - "environments_company_status_idx": { - "name": "environments_company_status_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "environments_company_driver_idx": { - "name": "environments_company_driver_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "driver", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "where": "\"environments\".\"driver\" = 'local'", - "concurrently": false, - "method": "btree", - "with": {} - }, - "environments_company_name_idx": { - "name": "environments_company_name_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "name", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "environments_company_id_companies_id_fk": { - "name": "environments_company_id_companies_id_fk", - "tableFrom": "environments", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.execution_workspaces": { - "name": "execution_workspaces", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "project_workspace_id": { - "name": "project_workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "source_issue_id": { - "name": "source_issue_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "mode": { - "name": "mode", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "strategy_type": { - "name": "strategy_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'active'" - }, - "cwd": { - "name": "cwd", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "repo_url": { - "name": "repo_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "base_ref": { - "name": "base_ref", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "branch_name": { - "name": "branch_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "provider_type": { - "name": "provider_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'local_fs'" - }, - "provider_ref": { - "name": "provider_ref", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "derived_from_execution_workspace_id": { - "name": "derived_from_execution_workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "last_used_at": { - "name": "last_used_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "opened_at": { - "name": "opened_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "closed_at": { - "name": "closed_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "cleanup_eligible_at": { - "name": "cleanup_eligible_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "cleanup_reason": { - "name": "cleanup_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "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": { - "execution_workspaces_company_project_status_idx": { - "name": "execution_workspaces_company_project_status_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "project_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "execution_workspaces_company_project_workspace_status_idx": { - "name": "execution_workspaces_company_project_workspace_status_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "project_workspace_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "execution_workspaces_company_source_issue_idx": { - "name": "execution_workspaces_company_source_issue_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "source_issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "execution_workspaces_company_last_used_idx": { - "name": "execution_workspaces_company_last_used_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "last_used_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "execution_workspaces_company_branch_idx": { - "name": "execution_workspaces_company_branch_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "branch_name", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "execution_workspaces_company_id_companies_id_fk": { - "name": "execution_workspaces_company_id_companies_id_fk", - "tableFrom": "execution_workspaces", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "execution_workspaces_project_id_projects_id_fk": { - "name": "execution_workspaces_project_id_projects_id_fk", - "tableFrom": "execution_workspaces", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "execution_workspaces_project_workspace_id_project_workspaces_id_fk": { - "name": "execution_workspaces_project_workspace_id_project_workspaces_id_fk", - "tableFrom": "execution_workspaces", - "tableTo": "project_workspaces", - "columnsFrom": [ - "project_workspace_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "execution_workspaces_source_issue_id_issues_id_fk": { - "name": "execution_workspaces_source_issue_id_issues_id_fk", - "tableFrom": "execution_workspaces", - "tableTo": "issues", - "columnsFrom": [ - "source_issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "execution_workspaces_derived_from_execution_workspace_id_execution_workspaces_id_fk": { - "name": "execution_workspaces_derived_from_execution_workspace_id_execution_workspaces_id_fk", - "tableFrom": "execution_workspaces", - "tableTo": "execution_workspaces", - "columnsFrom": [ - "derived_from_execution_workspace_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.feedback_exports": { - "name": "feedback_exports", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "feedback_vote_id": { - "name": "feedback_vote_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "issue_id": { - "name": "issue_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "author_user_id": { - "name": "author_user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_type": { - "name": "target_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_id": { - "name": "target_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "vote": { - "name": "vote", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'local_only'" - }, - "destination": { - "name": "destination", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "export_id": { - "name": "export_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "consent_version": { - "name": "consent_version", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "schema_version": { - "name": "schema_version", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'paperclip-feedback-envelope-v2'" - }, - "bundle_version": { - "name": "bundle_version", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'paperclip-feedback-bundle-v2'" - }, - "payload_version": { - "name": "payload_version", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'paperclip-feedback-v1'" - }, - "payload_digest": { - "name": "payload_digest", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "payload_snapshot": { - "name": "payload_snapshot", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "target_summary": { - "name": "target_summary", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "redaction_summary": { - "name": "redaction_summary", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "attempt_count": { - "name": "attempt_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "last_attempted_at": { - "name": "last_attempted_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "exported_at": { - "name": "exported_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "failure_reason": { - "name": "failure_reason", - "type": "text", - "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": { - "feedback_exports_feedback_vote_idx": { - "name": "feedback_exports_feedback_vote_idx", - "columns": [ - { - "expression": "feedback_vote_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "feedback_exports_company_created_idx": { - "name": "feedback_exports_company_created_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "feedback_exports_company_status_idx": { - "name": "feedback_exports_company_status_idx", - "columns": [ - { - "expression": "company_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": {} - }, - "feedback_exports_company_issue_idx": { - "name": "feedback_exports_company_issue_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "feedback_exports_company_project_idx": { - "name": "feedback_exports_company_project_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "project_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "feedback_exports_company_author_idx": { - "name": "feedback_exports_company_author_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "author_user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "feedback_exports_company_id_companies_id_fk": { - "name": "feedback_exports_company_id_companies_id_fk", - "tableFrom": "feedback_exports", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "feedback_exports_feedback_vote_id_feedback_votes_id_fk": { - "name": "feedback_exports_feedback_vote_id_feedback_votes_id_fk", - "tableFrom": "feedback_exports", - "tableTo": "feedback_votes", - "columnsFrom": [ - "feedback_vote_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "feedback_exports_issue_id_issues_id_fk": { - "name": "feedback_exports_issue_id_issues_id_fk", - "tableFrom": "feedback_exports", - "tableTo": "issues", - "columnsFrom": [ - "issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "feedback_exports_project_id_projects_id_fk": { - "name": "feedback_exports_project_id_projects_id_fk", - "tableFrom": "feedback_exports", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.feedback_votes": { - "name": "feedback_votes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "issue_id": { - "name": "issue_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "target_type": { - "name": "target_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_id": { - "name": "target_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_user_id": { - "name": "author_user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "vote": { - "name": "vote", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "shared_with_labs": { - "name": "shared_with_labs", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "shared_at": { - "name": "shared_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "consent_version": { - "name": "consent_version", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "redaction_summary": { - "name": "redaction_summary", - "type": "jsonb", - "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": { - "feedback_votes_company_issue_idx": { - "name": "feedback_votes_company_issue_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "feedback_votes_issue_target_idx": { - "name": "feedback_votes_issue_target_idx", - "columns": [ - { - "expression": "issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "target_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "target_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "feedback_votes_author_idx": { - "name": "feedback_votes_author_idx", - "columns": [ - { - "expression": "author_user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "feedback_votes_company_target_author_idx": { - "name": "feedback_votes_company_target_author_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "target_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "target_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "author_user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "feedback_votes_company_id_companies_id_fk": { - "name": "feedback_votes_company_id_companies_id_fk", - "tableFrom": "feedback_votes", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "feedback_votes_issue_id_issues_id_fk": { - "name": "feedback_votes_issue_id_issues_id_fk", - "tableFrom": "feedback_votes", - "tableTo": "issues", - "columnsFrom": [ - "issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.finance_events": { - "name": "finance_events", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "agent_id": { - "name": "agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "issue_id": { - "name": "issue_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "project_id": { - "name": "project_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "goal_id": { - "name": "goal_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "heartbeat_run_id": { - "name": "heartbeat_run_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "cost_event_id": { - "name": "cost_event_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "billing_code": { - "name": "billing_code", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "event_kind": { - "name": "event_kind", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "direction": { - "name": "direction", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'debit'" - }, - "biller": { - "name": "biller", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "execution_adapter_type": { - "name": "execution_adapter_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "pricing_tier": { - "name": "pricing_tier", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "region": { - "name": "region", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "model": { - "name": "model", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "unit": { - "name": "unit", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "amount_cents": { - "name": "amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "currency": { - "name": "currency", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'USD'" - }, - "estimated": { - "name": "estimated", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "external_invoice_id": { - "name": "external_invoice_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "metadata_json": { - "name": "metadata_json", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "occurred_at": { - "name": "occurred_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "finance_events_company_occurred_idx": { - "name": "finance_events_company_occurred_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "occurred_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "finance_events_company_biller_occurred_idx": { - "name": "finance_events_company_biller_occurred_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "biller", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "occurred_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "finance_events_company_kind_occurred_idx": { - "name": "finance_events_company_kind_occurred_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "event_kind", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "occurred_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "finance_events_company_direction_occurred_idx": { - "name": "finance_events_company_direction_occurred_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "direction", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "occurred_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "finance_events_company_heartbeat_run_idx": { - "name": "finance_events_company_heartbeat_run_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "heartbeat_run_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "finance_events_company_cost_event_idx": { - "name": "finance_events_company_cost_event_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "cost_event_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "finance_events_company_id_companies_id_fk": { - "name": "finance_events_company_id_companies_id_fk", - "tableFrom": "finance_events", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "finance_events_agent_id_agents_id_fk": { - "name": "finance_events_agent_id_agents_id_fk", - "tableFrom": "finance_events", - "tableTo": "agents", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "finance_events_issue_id_issues_id_fk": { - "name": "finance_events_issue_id_issues_id_fk", - "tableFrom": "finance_events", - "tableTo": "issues", - "columnsFrom": [ - "issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "finance_events_project_id_projects_id_fk": { - "name": "finance_events_project_id_projects_id_fk", - "tableFrom": "finance_events", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "finance_events_goal_id_goals_id_fk": { - "name": "finance_events_goal_id_goals_id_fk", - "tableFrom": "finance_events", - "tableTo": "goals", - "columnsFrom": [ - "goal_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "finance_events_heartbeat_run_id_heartbeat_runs_id_fk": { - "name": "finance_events_heartbeat_run_id_heartbeat_runs_id_fk", - "tableFrom": "finance_events", - "tableTo": "heartbeat_runs", - "columnsFrom": [ - "heartbeat_run_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "finance_events_cost_event_id_cost_events_id_fk": { - "name": "finance_events_cost_event_id_cost_events_id_fk", - "tableFrom": "finance_events", - "tableTo": "cost_events", - "columnsFrom": [ - "cost_event_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.goals": { - "name": "goals", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "level": { - "name": "level", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'task'" - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'planned'" - }, - "parent_id": { - "name": "parent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "owner_agent_id": { - "name": "owner_agent_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": { - "goals_company_idx": { - "name": "goals_company_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "goals_company_id_companies_id_fk": { - "name": "goals_company_id_companies_id_fk", - "tableFrom": "goals", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "goals_parent_id_goals_id_fk": { - "name": "goals_parent_id_goals_id_fk", - "tableFrom": "goals", - "tableTo": "goals", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "goals_owner_agent_id_agents_id_fk": { - "name": "goals_owner_agent_id_agents_id_fk", - "tableFrom": "goals", - "tableTo": "agents", - "columnsFrom": [ - "owner_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.heartbeat_run_events": { - "name": "heartbeat_run_events", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "bigserial", - "primaryKey": true, - "notNull": true - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "run_id": { - "name": "run_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "agent_id": { - "name": "agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "seq": { - "name": "seq", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "event_type": { - "name": "event_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "stream": { - "name": "stream", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "level": { - "name": "level", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "message": { - "name": "message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "payload": { - "name": "payload", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "heartbeat_run_events_run_seq_idx": { - "name": "heartbeat_run_events_run_seq_idx", - "columns": [ - { - "expression": "run_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "seq", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "heartbeat_run_events_company_run_idx": { - "name": "heartbeat_run_events_company_run_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "run_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "heartbeat_run_events_company_created_idx": { - "name": "heartbeat_run_events_company_created_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "heartbeat_run_events_company_id_companies_id_fk": { - "name": "heartbeat_run_events_company_id_companies_id_fk", - "tableFrom": "heartbeat_run_events", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "heartbeat_run_events_run_id_heartbeat_runs_id_fk": { - "name": "heartbeat_run_events_run_id_heartbeat_runs_id_fk", - "tableFrom": "heartbeat_run_events", - "tableTo": "heartbeat_runs", - "columnsFrom": [ - "run_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "heartbeat_run_events_agent_id_agents_id_fk": { - "name": "heartbeat_run_events_agent_id_agents_id_fk", - "tableFrom": "heartbeat_run_events", - "tableTo": "agents", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.heartbeat_run_watchdog_decisions": { - "name": "heartbeat_run_watchdog_decisions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "run_id": { - "name": "run_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "evaluation_issue_id": { - "name": "evaluation_issue_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "decision": { - "name": "decision", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "snoozed_until": { - "name": "snoozed_until", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_by_agent_id": { - "name": "created_by_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_by_run_id": { - "name": "created_by_run_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "heartbeat_run_watchdog_decisions_company_run_created_idx": { - "name": "heartbeat_run_watchdog_decisions_company_run_created_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "run_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "heartbeat_run_watchdog_decisions_company_run_snooze_idx": { - "name": "heartbeat_run_watchdog_decisions_company_run_snooze_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "run_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "snoozed_until", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "heartbeat_run_watchdog_decisions_company_id_companies_id_fk": { - "name": "heartbeat_run_watchdog_decisions_company_id_companies_id_fk", - "tableFrom": "heartbeat_run_watchdog_decisions", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "heartbeat_run_watchdog_decisions_run_id_heartbeat_runs_id_fk": { - "name": "heartbeat_run_watchdog_decisions_run_id_heartbeat_runs_id_fk", - "tableFrom": "heartbeat_run_watchdog_decisions", - "tableTo": "heartbeat_runs", - "columnsFrom": [ - "run_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "heartbeat_run_watchdog_decisions_evaluation_issue_id_issues_id_fk": { - "name": "heartbeat_run_watchdog_decisions_evaluation_issue_id_issues_id_fk", - "tableFrom": "heartbeat_run_watchdog_decisions", - "tableTo": "issues", - "columnsFrom": [ - "evaluation_issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "heartbeat_run_watchdog_decisions_created_by_agent_id_agents_id_fk": { - "name": "heartbeat_run_watchdog_decisions_created_by_agent_id_agents_id_fk", - "tableFrom": "heartbeat_run_watchdog_decisions", - "tableTo": "agents", - "columnsFrom": [ - "created_by_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "heartbeat_run_watchdog_decisions_created_by_run_id_heartbeat_runs_id_fk": { - "name": "heartbeat_run_watchdog_decisions_created_by_run_id_heartbeat_runs_id_fk", - "tableFrom": "heartbeat_run_watchdog_decisions", - "tableTo": "heartbeat_runs", - "columnsFrom": [ - "created_by_run_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.heartbeat_runs": { - "name": "heartbeat_runs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "agent_id": { - "name": "agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "invocation_source": { - "name": "invocation_source", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'on_demand'" - }, - "trigger_detail": { - "name": "trigger_detail", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'queued'" - }, - "started_at": { - "name": "started_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "finished_at": { - "name": "finished_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "wakeup_request_id": { - "name": "wakeup_request_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "exit_code": { - "name": "exit_code", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "signal": { - "name": "signal", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "usage_json": { - "name": "usage_json", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "result_json": { - "name": "result_json", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "session_id_before": { - "name": "session_id_before", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "session_id_after": { - "name": "session_id_after", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "log_store": { - "name": "log_store", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "log_ref": { - "name": "log_ref", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "log_bytes": { - "name": "log_bytes", - "type": "bigint", - "primaryKey": false, - "notNull": false - }, - "log_sha256": { - "name": "log_sha256", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "log_compressed": { - "name": "log_compressed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "stdout_excerpt": { - "name": "stdout_excerpt", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "stderr_excerpt": { - "name": "stderr_excerpt", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "external_run_id": { - "name": "external_run_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "process_pid": { - "name": "process_pid", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "process_group_id": { - "name": "process_group_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "process_started_at": { - "name": "process_started_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "last_output_at": { - "name": "last_output_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "last_output_seq": { - "name": "last_output_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "last_output_stream": { - "name": "last_output_stream", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "last_output_bytes": { - "name": "last_output_bytes", - "type": "bigint", - "primaryKey": false, - "notNull": false - }, - "retry_of_run_id": { - "name": "retry_of_run_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "process_loss_retry_count": { - "name": "process_loss_retry_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "scheduled_retry_at": { - "name": "scheduled_retry_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "scheduled_retry_attempt": { - "name": "scheduled_retry_attempt", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "scheduled_retry_reason": { - "name": "scheduled_retry_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "issue_comment_status": { - "name": "issue_comment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'not_applicable'" - }, - "issue_comment_satisfied_by_comment_id": { - "name": "issue_comment_satisfied_by_comment_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "issue_comment_retry_queued_at": { - "name": "issue_comment_retry_queued_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "liveness_state": { - "name": "liveness_state", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "liveness_reason": { - "name": "liveness_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "continuation_attempt": { - "name": "continuation_attempt", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "last_useful_action_at": { - "name": "last_useful_action_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "next_action": { - "name": "next_action", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "context_snapshot": { - "name": "context_snapshot", - "type": "jsonb", - "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": { - "heartbeat_runs_company_agent_started_idx": { - "name": "heartbeat_runs_company_agent_started_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "agent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "started_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "heartbeat_runs_company_liveness_idx": { - "name": "heartbeat_runs_company_liveness_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "liveness_state", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "heartbeat_runs_company_status_last_output_idx": { - "name": "heartbeat_runs_company_status_last_output_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "last_output_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "heartbeat_runs_company_status_process_started_idx": { - "name": "heartbeat_runs_company_status_process_started_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "process_started_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "heartbeat_runs_company_id_companies_id_fk": { - "name": "heartbeat_runs_company_id_companies_id_fk", - "tableFrom": "heartbeat_runs", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "heartbeat_runs_agent_id_agents_id_fk": { - "name": "heartbeat_runs_agent_id_agents_id_fk", - "tableFrom": "heartbeat_runs", - "tableTo": "agents", - "columnsFrom": [ - "agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "heartbeat_runs_wakeup_request_id_agent_wakeup_requests_id_fk": { - "name": "heartbeat_runs_wakeup_request_id_agent_wakeup_requests_id_fk", - "tableFrom": "heartbeat_runs", - "tableTo": "agent_wakeup_requests", - "columnsFrom": [ - "wakeup_request_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "heartbeat_runs_retry_of_run_id_heartbeat_runs_id_fk": { - "name": "heartbeat_runs_retry_of_run_id_heartbeat_runs_id_fk", - "tableFrom": "heartbeat_runs", - "tableTo": "heartbeat_runs", - "columnsFrom": [ - "retry_of_run_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.inbox_dismissals": { - "name": "inbox_dismissals", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "item_key": { - "name": "item_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "dismissed_at": { - "name": "dismissed_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": { - "inbox_dismissals_company_user_idx": { - "name": "inbox_dismissals_company_user_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "inbox_dismissals_company_item_idx": { - "name": "inbox_dismissals_company_item_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "item_key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "inbox_dismissals_company_user_item_idx": { - "name": "inbox_dismissals_company_user_item_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "item_key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "inbox_dismissals_company_id_companies_id_fk": { - "name": "inbox_dismissals_company_id_companies_id_fk", - "tableFrom": "inbox_dismissals", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.instance_settings": { - "name": "instance_settings", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "singleton_key": { - "name": "singleton_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "general": { - "name": "general", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "experimental": { - "name": "experimental", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "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": { - "instance_settings_singleton_key_idx": { - "name": "instance_settings_singleton_key_idx", - "columns": [ - { - "expression": "singleton_key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.instance_user_roles": { - "name": "instance_user_roles", - "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 - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'instance_admin'" - }, - "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": { - "instance_user_roles_user_role_unique_idx": { - "name": "instance_user_roles_user_role_unique_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "role", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "instance_user_roles_role_idx": { - "name": "instance_user_roles_role_idx", - "columns": [ - { - "expression": "role", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.invites": { - "name": "invites", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "invite_type": { - "name": "invite_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'company_join'" - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "allowed_join_types": { - "name": "allowed_join_types", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'both'" - }, - "defaults_payload": { - "name": "defaults_payload", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "accepted_at": { - "name": "accepted_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": { - "invites_token_hash_unique_idx": { - "name": "invites_token_hash_unique_idx", - "columns": [ - { - "expression": "token_hash", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "invites_company_invite_state_idx": { - "name": "invites_company_invite_state_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "invite_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "revoked_at", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "expires_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "invites_company_id_companies_id_fk": { - "name": "invites_company_id_companies_id_fk", - "tableFrom": "invites", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.issue_approvals": { - "name": "issue_approvals", - "schema": "", - "columns": { - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "issue_id": { - "name": "issue_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "approval_id": { - "name": "approval_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "linked_by_agent_id": { - "name": "linked_by_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "linked_by_user_id": { - "name": "linked_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "issue_approvals_issue_idx": { - "name": "issue_approvals_issue_idx", - "columns": [ - { - "expression": "issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_approvals_approval_idx": { - "name": "issue_approvals_approval_idx", - "columns": [ - { - "expression": "approval_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_approvals_company_idx": { - "name": "issue_approvals_company_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "issue_approvals_company_id_companies_id_fk": { - "name": "issue_approvals_company_id_companies_id_fk", - "tableFrom": "issue_approvals", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "issue_approvals_issue_id_issues_id_fk": { - "name": "issue_approvals_issue_id_issues_id_fk", - "tableFrom": "issue_approvals", - "tableTo": "issues", - "columnsFrom": [ - "issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "issue_approvals_approval_id_approvals_id_fk": { - "name": "issue_approvals_approval_id_approvals_id_fk", - "tableFrom": "issue_approvals", - "tableTo": "approvals", - "columnsFrom": [ - "approval_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "issue_approvals_linked_by_agent_id_agents_id_fk": { - "name": "issue_approvals_linked_by_agent_id_agents_id_fk", - "tableFrom": "issue_approvals", - "tableTo": "agents", - "columnsFrom": [ - "linked_by_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "issue_approvals_pk": { - "name": "issue_approvals_pk", - "columns": [ - "issue_id", - "approval_id" - ] - } - }, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.issue_attachments": { - "name": "issue_attachments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "issue_id": { - "name": "issue_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "asset_id": { - "name": "asset_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "issue_comment_id": { - "name": "issue_comment_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": { - "issue_attachments_company_issue_idx": { - "name": "issue_attachments_company_issue_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_attachments_issue_comment_idx": { - "name": "issue_attachments_issue_comment_idx", - "columns": [ - { - "expression": "issue_comment_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_attachments_asset_uq": { - "name": "issue_attachments_asset_uq", - "columns": [ - { - "expression": "asset_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "issue_attachments_company_id_companies_id_fk": { - "name": "issue_attachments_company_id_companies_id_fk", - "tableFrom": "issue_attachments", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "issue_attachments_issue_id_issues_id_fk": { - "name": "issue_attachments_issue_id_issues_id_fk", - "tableFrom": "issue_attachments", - "tableTo": "issues", - "columnsFrom": [ - "issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "issue_attachments_asset_id_assets_id_fk": { - "name": "issue_attachments_asset_id_assets_id_fk", - "tableFrom": "issue_attachments", - "tableTo": "assets", - "columnsFrom": [ - "asset_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "issue_attachments_issue_comment_id_issue_comments_id_fk": { - "name": "issue_attachments_issue_comment_id_issue_comments_id_fk", - "tableFrom": "issue_attachments", - "tableTo": "issue_comments", - "columnsFrom": [ - "issue_comment_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.issue_comments": { - "name": "issue_comments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "issue_id": { - "name": "issue_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "author_agent_id": { - "name": "author_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "author_user_id": { - "name": "author_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "author_type": { - "name": "author_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_by_run_id": { - "name": "created_by_run_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "presentation": { - "name": "presentation", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "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": { - "issue_comments_issue_idx": { - "name": "issue_comments_issue_idx", - "columns": [ - { - "expression": "issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_comments_company_idx": { - "name": "issue_comments_company_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_comments_company_issue_created_at_idx": { - "name": "issue_comments_company_issue_created_at_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_comments_company_author_issue_created_at_idx": { - "name": "issue_comments_company_author_issue_created_at_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "author_user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_comments_body_search_idx": { - "name": "issue_comments_body_search_idx", - "columns": [ - { - "expression": "body", - "isExpression": false, - "asc": true, - "nulls": "last", - "opclass": "gin_trgm_ops" - } - ], - "isUnique": false, - "concurrently": false, - "method": "gin", - "with": {} - } - }, - "foreignKeys": { - "issue_comments_company_id_companies_id_fk": { - "name": "issue_comments_company_id_companies_id_fk", - "tableFrom": "issue_comments", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "issue_comments_issue_id_issues_id_fk": { - "name": "issue_comments_issue_id_issues_id_fk", - "tableFrom": "issue_comments", - "tableTo": "issues", - "columnsFrom": [ - "issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "issue_comments_author_agent_id_agents_id_fk": { - "name": "issue_comments_author_agent_id_agents_id_fk", - "tableFrom": "issue_comments", - "tableTo": "agents", - "columnsFrom": [ - "author_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "issue_comments_created_by_run_id_heartbeat_runs_id_fk": { - "name": "issue_comments_created_by_run_id_heartbeat_runs_id_fk", - "tableFrom": "issue_comments", - "tableTo": "heartbeat_runs", - "columnsFrom": [ - "created_by_run_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.issue_documents": { - "name": "issue_documents", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "issue_id": { - "name": "issue_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "key": { - "name": "key", - "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": { - "issue_documents_company_issue_key_uq": { - "name": "issue_documents_company_issue_key_uq", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_documents_document_uq": { - "name": "issue_documents_document_uq", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_documents_company_issue_updated_idx": { - "name": "issue_documents_company_issue_updated_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "issue_documents_company_id_companies_id_fk": { - "name": "issue_documents_company_id_companies_id_fk", - "tableFrom": "issue_documents", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "issue_documents_issue_id_issues_id_fk": { - "name": "issue_documents_issue_id_issues_id_fk", - "tableFrom": "issue_documents", - "tableTo": "issues", - "columnsFrom": [ - "issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "issue_documents_document_id_documents_id_fk": { - "name": "issue_documents_document_id_documents_id_fk", - "tableFrom": "issue_documents", - "tableTo": "documents", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.issue_execution_decisions": { - "name": "issue_execution_decisions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "issue_id": { - "name": "issue_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "stage_id": { - "name": "stage_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "stage_type": { - "name": "stage_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_agent_id": { - "name": "actor_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "actor_user_id": { - "name": "actor_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "outcome": { - "name": "outcome", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_by_run_id": { - "name": "created_by_run_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": { - "issue_execution_decisions_company_issue_idx": { - "name": "issue_execution_decisions_company_issue_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_execution_decisions_stage_idx": { - "name": "issue_execution_decisions_stage_idx", - "columns": [ - { - "expression": "issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "stage_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "issue_execution_decisions_company_id_companies_id_fk": { - "name": "issue_execution_decisions_company_id_companies_id_fk", - "tableFrom": "issue_execution_decisions", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "issue_execution_decisions_issue_id_issues_id_fk": { - "name": "issue_execution_decisions_issue_id_issues_id_fk", - "tableFrom": "issue_execution_decisions", - "tableTo": "issues", - "columnsFrom": [ - "issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "issue_execution_decisions_actor_agent_id_agents_id_fk": { - "name": "issue_execution_decisions_actor_agent_id_agents_id_fk", - "tableFrom": "issue_execution_decisions", - "tableTo": "agents", - "columnsFrom": [ - "actor_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "issue_execution_decisions_created_by_run_id_heartbeat_runs_id_fk": { - "name": "issue_execution_decisions_created_by_run_id_heartbeat_runs_id_fk", - "tableFrom": "issue_execution_decisions", - "tableTo": "heartbeat_runs", - "columnsFrom": [ - "created_by_run_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.issue_inbox_archives": { - "name": "issue_inbox_archives", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "issue_id": { - "name": "issue_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "archived_at": { - "name": "archived_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": { - "issue_inbox_archives_company_issue_idx": { - "name": "issue_inbox_archives_company_issue_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_inbox_archives_company_user_idx": { - "name": "issue_inbox_archives_company_user_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_inbox_archives_company_issue_user_idx": { - "name": "issue_inbox_archives_company_issue_user_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "issue_inbox_archives_company_id_companies_id_fk": { - "name": "issue_inbox_archives_company_id_companies_id_fk", - "tableFrom": "issue_inbox_archives", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "issue_inbox_archives_issue_id_issues_id_fk": { - "name": "issue_inbox_archives_issue_id_issues_id_fk", - "tableFrom": "issue_inbox_archives", - "tableTo": "issues", - "columnsFrom": [ - "issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.issue_labels": { - "name": "issue_labels", - "schema": "", - "columns": { - "issue_id": { - "name": "issue_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "label_id": { - "name": "label_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "issue_labels_issue_idx": { - "name": "issue_labels_issue_idx", - "columns": [ - { - "expression": "issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_labels_label_idx": { - "name": "issue_labels_label_idx", - "columns": [ - { - "expression": "label_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_labels_company_idx": { - "name": "issue_labels_company_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "issue_labels_issue_id_issues_id_fk": { - "name": "issue_labels_issue_id_issues_id_fk", - "tableFrom": "issue_labels", - "tableTo": "issues", - "columnsFrom": [ - "issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "issue_labels_label_id_labels_id_fk": { - "name": "issue_labels_label_id_labels_id_fk", - "tableFrom": "issue_labels", - "tableTo": "labels", - "columnsFrom": [ - "label_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "issue_labels_company_id_companies_id_fk": { - "name": "issue_labels_company_id_companies_id_fk", - "tableFrom": "issue_labels", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "issue_labels_pk": { - "name": "issue_labels_pk", - "columns": [ - "issue_id", - "label_id" - ] - } - }, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.issue_plan_decompositions": { - "name": "issue_plan_decompositions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "source_issue_id": { - "name": "source_issue_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "accepted_plan_revision_id": { - "name": "accepted_plan_revision_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "accepted_interaction_id": { - "name": "accepted_interaction_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'in_flight'" - }, - "request_fingerprint": { - "name": "request_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "requested_child_count": { - "name": "requested_child_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "requested_children": { - "name": "requested_children", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'[]'::jsonb" - }, - "child_issue_ids": { - "name": "child_issue_ids", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'[]'::jsonb" - }, - "owner_agent_id": { - "name": "owner_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "owner_user_id": { - "name": "owner_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "owner_run_id": { - "name": "owner_run_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_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": { - "issue_plan_decompositions_company_source_status_idx": { - "name": "issue_plan_decompositions_company_source_status_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "source_issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_plan_decompositions_active_owner_idx": { - "name": "issue_plan_decompositions_active_owner_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "owner_agent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "where": "\"issue_plan_decompositions\".\"status\" = 'in_flight'", - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_plan_decompositions_source_revision_uq": { - "name": "issue_plan_decompositions_source_revision_uq", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "source_issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "accepted_plan_revision_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "issue_plan_decompositions_company_id_companies_id_fk": { - "name": "issue_plan_decompositions_company_id_companies_id_fk", - "tableFrom": "issue_plan_decompositions", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "issue_plan_decompositions_source_issue_id_issues_id_fk": { - "name": "issue_plan_decompositions_source_issue_id_issues_id_fk", - "tableFrom": "issue_plan_decompositions", - "tableTo": "issues", - "columnsFrom": [ - "source_issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "issue_plan_decompositions_accepted_plan_revision_id_document_revisions_id_fk": { - "name": "issue_plan_decompositions_accepted_plan_revision_id_document_revisions_id_fk", - "tableFrom": "issue_plan_decompositions", - "tableTo": "document_revisions", - "columnsFrom": [ - "accepted_plan_revision_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "issue_plan_decompositions_accepted_interaction_id_issue_thread_interactions_id_fk": { - "name": "issue_plan_decompositions_accepted_interaction_id_issue_thread_interactions_id_fk", - "tableFrom": "issue_plan_decompositions", - "tableTo": "issue_thread_interactions", - "columnsFrom": [ - "accepted_interaction_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "issue_plan_decompositions_owner_agent_id_agents_id_fk": { - "name": "issue_plan_decompositions_owner_agent_id_agents_id_fk", - "tableFrom": "issue_plan_decompositions", - "tableTo": "agents", - "columnsFrom": [ - "owner_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "issue_plan_decompositions_owner_run_id_heartbeat_runs_id_fk": { - "name": "issue_plan_decompositions_owner_run_id_heartbeat_runs_id_fk", - "tableFrom": "issue_plan_decompositions", - "tableTo": "heartbeat_runs", - "columnsFrom": [ - "owner_run_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.issue_read_states": { - "name": "issue_read_states", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "issue_id": { - "name": "issue_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "last_read_at": { - "name": "last_read_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": { - "issue_read_states_company_issue_idx": { - "name": "issue_read_states_company_issue_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_read_states_company_user_idx": { - "name": "issue_read_states_company_user_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_read_states_company_issue_user_idx": { - "name": "issue_read_states_company_issue_user_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "issue_read_states_company_id_companies_id_fk": { - "name": "issue_read_states_company_id_companies_id_fk", - "tableFrom": "issue_read_states", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "issue_read_states_issue_id_issues_id_fk": { - "name": "issue_read_states_issue_id_issues_id_fk", - "tableFrom": "issue_read_states", - "tableTo": "issues", - "columnsFrom": [ - "issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.issue_recovery_actions": { - "name": "issue_recovery_actions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "source_issue_id": { - "name": "source_issue_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "recovery_issue_id": { - "name": "recovery_issue_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'active'" - }, - "owner_type": { - "name": "owner_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'agent'" - }, - "owner_agent_id": { - "name": "owner_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "owner_user_id": { - "name": "owner_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "previous_owner_agent_id": { - "name": "previous_owner_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "return_owner_agent_id": { - "name": "return_owner_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "cause": { - "name": "cause", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "fingerprint": { - "name": "fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "evidence": { - "name": "evidence", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "next_action": { - "name": "next_action", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "wake_policy": { - "name": "wake_policy", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "monitor_policy": { - "name": "monitor_policy", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "attempt_count": { - "name": "attempt_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "max_attempts": { - "name": "max_attempts", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "timeout_at": { - "name": "timeout_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "last_attempt_at": { - "name": "last_attempt_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "outcome": { - "name": "outcome", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "resolution_note": { - "name": "resolution_note", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "resolved_at": { - "name": "resolved_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": { - "issue_recovery_actions_company_source_status_idx": { - "name": "issue_recovery_actions_company_source_status_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "source_issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_recovery_actions_company_owner_status_idx": { - "name": "issue_recovery_actions_company_owner_status_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "owner_agent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_recovery_actions_company_recovery_issue_idx": { - "name": "issue_recovery_actions_company_recovery_issue_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "recovery_issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_recovery_actions_active_source_uq": { - "name": "issue_recovery_actions_active_source_uq", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "source_issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "where": "\"issue_recovery_actions\".\"status\" in ('active', 'escalated')", - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_recovery_actions_active_fingerprint_uq": { - "name": "issue_recovery_actions_active_fingerprint_uq", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "source_issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "cause", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "fingerprint", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "where": "\"issue_recovery_actions\".\"status\" in ('active', 'escalated')", - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "issue_recovery_actions_company_id_companies_id_fk": { - "name": "issue_recovery_actions_company_id_companies_id_fk", - "tableFrom": "issue_recovery_actions", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "issue_recovery_actions_source_issue_id_issues_id_fk": { - "name": "issue_recovery_actions_source_issue_id_issues_id_fk", - "tableFrom": "issue_recovery_actions", - "tableTo": "issues", - "columnsFrom": [ - "source_issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "issue_recovery_actions_recovery_issue_id_issues_id_fk": { - "name": "issue_recovery_actions_recovery_issue_id_issues_id_fk", - "tableFrom": "issue_recovery_actions", - "tableTo": "issues", - "columnsFrom": [ - "recovery_issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "issue_recovery_actions_owner_agent_id_agents_id_fk": { - "name": "issue_recovery_actions_owner_agent_id_agents_id_fk", - "tableFrom": "issue_recovery_actions", - "tableTo": "agents", - "columnsFrom": [ - "owner_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "issue_recovery_actions_previous_owner_agent_id_agents_id_fk": { - "name": "issue_recovery_actions_previous_owner_agent_id_agents_id_fk", - "tableFrom": "issue_recovery_actions", - "tableTo": "agents", - "columnsFrom": [ - "previous_owner_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "issue_recovery_actions_return_owner_agent_id_agents_id_fk": { - "name": "issue_recovery_actions_return_owner_agent_id_agents_id_fk", - "tableFrom": "issue_recovery_actions", - "tableTo": "agents", - "columnsFrom": [ - "return_owner_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.issue_reference_mentions": { - "name": "issue_reference_mentions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "source_issue_id": { - "name": "source_issue_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "target_issue_id": { - "name": "target_issue_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "source_kind": { - "name": "source_kind", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "source_record_id": { - "name": "source_record_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "document_key": { - "name": "document_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "matched_text": { - "name": "matched_text", - "type": "text", - "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": { - "issue_reference_mentions_company_source_issue_idx": { - "name": "issue_reference_mentions_company_source_issue_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "source_issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_reference_mentions_company_target_issue_idx": { - "name": "issue_reference_mentions_company_target_issue_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "target_issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_reference_mentions_company_issue_pair_idx": { - "name": "issue_reference_mentions_company_issue_pair_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "source_issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "target_issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_reference_mentions_company_source_mention_record_uq": { - "name": "issue_reference_mentions_company_source_mention_record_uq", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "source_issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "target_issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "source_kind", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "source_record_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "where": "\"issue_reference_mentions\".\"source_record_id\" is not null", - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_reference_mentions_company_source_mention_null_record_uq": { - "name": "issue_reference_mentions_company_source_mention_null_record_uq", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "source_issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "target_issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "source_kind", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "where": "\"issue_reference_mentions\".\"source_record_id\" is null", - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "issue_reference_mentions_company_id_companies_id_fk": { - "name": "issue_reference_mentions_company_id_companies_id_fk", - "tableFrom": "issue_reference_mentions", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "issue_reference_mentions_source_issue_id_issues_id_fk": { - "name": "issue_reference_mentions_source_issue_id_issues_id_fk", - "tableFrom": "issue_reference_mentions", - "tableTo": "issues", - "columnsFrom": [ - "source_issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "issue_reference_mentions_target_issue_id_issues_id_fk": { - "name": "issue_reference_mentions_target_issue_id_issues_id_fk", - "tableFrom": "issue_reference_mentions", - "tableTo": "issues", - "columnsFrom": [ - "target_issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.issue_relations": { - "name": "issue_relations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "issue_id": { - "name": "issue_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "related_issue_id": { - "name": "related_issue_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_by_agent_id": { - "name": "created_by_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "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": { - "issue_relations_company_issue_idx": { - "name": "issue_relations_company_issue_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_relations_company_related_issue_idx": { - "name": "issue_relations_company_related_issue_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "related_issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_relations_company_type_idx": { - "name": "issue_relations_company_type_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "type", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_relations_company_edge_uq": { - "name": "issue_relations_company_edge_uq", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "related_issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "type", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "issue_relations_company_id_companies_id_fk": { - "name": "issue_relations_company_id_companies_id_fk", - "tableFrom": "issue_relations", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "issue_relations_issue_id_issues_id_fk": { - "name": "issue_relations_issue_id_issues_id_fk", - "tableFrom": "issue_relations", - "tableTo": "issues", - "columnsFrom": [ - "issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "issue_relations_related_issue_id_issues_id_fk": { - "name": "issue_relations_related_issue_id_issues_id_fk", - "tableFrom": "issue_relations", - "tableTo": "issues", - "columnsFrom": [ - "related_issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "issue_relations_created_by_agent_id_agents_id_fk": { - "name": "issue_relations_created_by_agent_id_agents_id_fk", - "tableFrom": "issue_relations", - "tableTo": "agents", - "columnsFrom": [ - "created_by_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.issue_thread_interactions": { - "name": "issue_thread_interactions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "issue_id": { - "name": "issue_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "continuation_policy": { - "name": "continuation_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'wake_assignee'" - }, - "idempotency_key": { - "name": "idempotency_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "source_comment_id": { - "name": "source_comment_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "source_run_id": { - "name": "source_run_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_by_agent_id": { - "name": "created_by_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "resolved_by_agent_id": { - "name": "resolved_by_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "resolved_by_user_id": { - "name": "resolved_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "payload": { - "name": "payload", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "result": { - "name": "result", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "resolved_at": { - "name": "resolved_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": { - "issue_thread_interactions_issue_idx": { - "name": "issue_thread_interactions_issue_idx", - "columns": [ - { - "expression": "issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_thread_interactions_company_issue_created_at_idx": { - "name": "issue_thread_interactions_company_issue_created_at_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_thread_interactions_company_issue_status_idx": { - "name": "issue_thread_interactions_company_issue_status_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_thread_interactions_company_issue_idempotency_uq": { - "name": "issue_thread_interactions_company_issue_idempotency_uq", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "idempotency_key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "where": "\"issue_thread_interactions\".\"idempotency_key\" IS NOT NULL", - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_thread_interactions_source_comment_idx": { - "name": "issue_thread_interactions_source_comment_idx", - "columns": [ - { - "expression": "source_comment_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "issue_thread_interactions_company_id_companies_id_fk": { - "name": "issue_thread_interactions_company_id_companies_id_fk", - "tableFrom": "issue_thread_interactions", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "issue_thread_interactions_issue_id_issues_id_fk": { - "name": "issue_thread_interactions_issue_id_issues_id_fk", - "tableFrom": "issue_thread_interactions", - "tableTo": "issues", - "columnsFrom": [ - "issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "issue_thread_interactions_source_comment_id_issue_comments_id_fk": { - "name": "issue_thread_interactions_source_comment_id_issue_comments_id_fk", - "tableFrom": "issue_thread_interactions", - "tableTo": "issue_comments", - "columnsFrom": [ - "source_comment_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "issue_thread_interactions_source_run_id_heartbeat_runs_id_fk": { - "name": "issue_thread_interactions_source_run_id_heartbeat_runs_id_fk", - "tableFrom": "issue_thread_interactions", - "tableTo": "heartbeat_runs", - "columnsFrom": [ - "source_run_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "issue_thread_interactions_created_by_agent_id_agents_id_fk": { - "name": "issue_thread_interactions_created_by_agent_id_agents_id_fk", - "tableFrom": "issue_thread_interactions", - "tableTo": "agents", - "columnsFrom": [ - "created_by_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "issue_thread_interactions_resolved_by_agent_id_agents_id_fk": { - "name": "issue_thread_interactions_resolved_by_agent_id_agents_id_fk", - "tableFrom": "issue_thread_interactions", - "tableTo": "agents", - "columnsFrom": [ - "resolved_by_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.issue_tree_hold_members": { - "name": "issue_tree_hold_members", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "hold_id": { - "name": "hold_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "issue_id": { - "name": "issue_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "parent_issue_id": { - "name": "parent_issue_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "depth": { - "name": "depth", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "issue_identifier": { - "name": "issue_identifier", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "issue_title": { - "name": "issue_title", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "issue_status": { - "name": "issue_status", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "assignee_agent_id": { - "name": "assignee_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "assignee_user_id": { - "name": "assignee_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "active_run_id": { - "name": "active_run_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "active_run_status": { - "name": "active_run_status", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "skipped": { - "name": "skipped", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "skip_reason": { - "name": "skip_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "issue_tree_hold_members_hold_issue_uq": { - "name": "issue_tree_hold_members_hold_issue_uq", - "columns": [ - { - "expression": "hold_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_tree_hold_members_company_issue_idx": { - "name": "issue_tree_hold_members_company_issue_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_tree_hold_members_hold_depth_idx": { - "name": "issue_tree_hold_members_hold_depth_idx", - "columns": [ - { - "expression": "hold_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "depth", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "issue_tree_hold_members_company_id_companies_id_fk": { - "name": "issue_tree_hold_members_company_id_companies_id_fk", - "tableFrom": "issue_tree_hold_members", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "issue_tree_hold_members_hold_id_issue_tree_holds_id_fk": { - "name": "issue_tree_hold_members_hold_id_issue_tree_holds_id_fk", - "tableFrom": "issue_tree_hold_members", - "tableTo": "issue_tree_holds", - "columnsFrom": [ - "hold_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "issue_tree_hold_members_issue_id_issues_id_fk": { - "name": "issue_tree_hold_members_issue_id_issues_id_fk", - "tableFrom": "issue_tree_hold_members", - "tableTo": "issues", - "columnsFrom": [ - "issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "issue_tree_hold_members_parent_issue_id_issues_id_fk": { - "name": "issue_tree_hold_members_parent_issue_id_issues_id_fk", - "tableFrom": "issue_tree_hold_members", - "tableTo": "issues", - "columnsFrom": [ - "parent_issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "issue_tree_hold_members_assignee_agent_id_agents_id_fk": { - "name": "issue_tree_hold_members_assignee_agent_id_agents_id_fk", - "tableFrom": "issue_tree_hold_members", - "tableTo": "agents", - "columnsFrom": [ - "assignee_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "issue_tree_hold_members_active_run_id_heartbeat_runs_id_fk": { - "name": "issue_tree_hold_members_active_run_id_heartbeat_runs_id_fk", - "tableFrom": "issue_tree_hold_members", - "tableTo": "heartbeat_runs", - "columnsFrom": [ - "active_run_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.issue_tree_holds": { - "name": "issue_tree_holds", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "root_issue_id": { - "name": "root_issue_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "mode": { - "name": "mode", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'active'" - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "release_policy": { - "name": "release_policy", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "created_by_actor_type": { - "name": "created_by_actor_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'system'" - }, - "created_by_agent_id": { - "name": "created_by_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_by_run_id": { - "name": "created_by_run_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "released_at": { - "name": "released_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "released_by_actor_type": { - "name": "released_by_actor_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "released_by_agent_id": { - "name": "released_by_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "released_by_user_id": { - "name": "released_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "released_by_run_id": { - "name": "released_by_run_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "release_reason": { - "name": "release_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "release_metadata": { - "name": "release_metadata", - "type": "jsonb", - "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": { - "issue_tree_holds_company_root_status_idx": { - "name": "issue_tree_holds_company_root_status_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "root_issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_tree_holds_company_status_mode_idx": { - "name": "issue_tree_holds_company_status_mode_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "mode", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "issue_tree_holds_company_id_companies_id_fk": { - "name": "issue_tree_holds_company_id_companies_id_fk", - "tableFrom": "issue_tree_holds", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "issue_tree_holds_root_issue_id_issues_id_fk": { - "name": "issue_tree_holds_root_issue_id_issues_id_fk", - "tableFrom": "issue_tree_holds", - "tableTo": "issues", - "columnsFrom": [ - "root_issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "issue_tree_holds_created_by_agent_id_agents_id_fk": { - "name": "issue_tree_holds_created_by_agent_id_agents_id_fk", - "tableFrom": "issue_tree_holds", - "tableTo": "agents", - "columnsFrom": [ - "created_by_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "issue_tree_holds_created_by_run_id_heartbeat_runs_id_fk": { - "name": "issue_tree_holds_created_by_run_id_heartbeat_runs_id_fk", - "tableFrom": "issue_tree_holds", - "tableTo": "heartbeat_runs", - "columnsFrom": [ - "created_by_run_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "issue_tree_holds_released_by_agent_id_agents_id_fk": { - "name": "issue_tree_holds_released_by_agent_id_agents_id_fk", - "tableFrom": "issue_tree_holds", - "tableTo": "agents", - "columnsFrom": [ - "released_by_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "issue_tree_holds_released_by_run_id_heartbeat_runs_id_fk": { - "name": "issue_tree_holds_released_by_run_id_heartbeat_runs_id_fk", - "tableFrom": "issue_tree_holds", - "tableTo": "heartbeat_runs", - "columnsFrom": [ - "released_by_run_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.issue_work_products": { - "name": "issue_work_products", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "issue_id": { - "name": "issue_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "execution_workspace_id": { - "name": "execution_workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "runtime_service_id": { - "name": "runtime_service_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "external_id": { - "name": "external_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "review_state": { - "name": "review_state", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'none'" - }, - "is_primary": { - "name": "is_primary", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "health_status": { - "name": "health_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'unknown'" - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "created_by_run_id": { - "name": "created_by_run_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": { - "issue_work_products_company_issue_type_idx": { - "name": "issue_work_products_company_issue_type_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "type", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_work_products_company_execution_workspace_type_idx": { - "name": "issue_work_products_company_execution_workspace_type_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "execution_workspace_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "type", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_work_products_company_provider_external_id_idx": { - "name": "issue_work_products_company_provider_external_id_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "provider", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "external_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issue_work_products_company_updated_idx": { - "name": "issue_work_products_company_updated_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "issue_work_products_company_id_companies_id_fk": { - "name": "issue_work_products_company_id_companies_id_fk", - "tableFrom": "issue_work_products", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "issue_work_products_project_id_projects_id_fk": { - "name": "issue_work_products_project_id_projects_id_fk", - "tableFrom": "issue_work_products", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "issue_work_products_issue_id_issues_id_fk": { - "name": "issue_work_products_issue_id_issues_id_fk", - "tableFrom": "issue_work_products", - "tableTo": "issues", - "columnsFrom": [ - "issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "issue_work_products_execution_workspace_id_execution_workspaces_id_fk": { - "name": "issue_work_products_execution_workspace_id_execution_workspaces_id_fk", - "tableFrom": "issue_work_products", - "tableTo": "execution_workspaces", - "columnsFrom": [ - "execution_workspace_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "issue_work_products_runtime_service_id_workspace_runtime_services_id_fk": { - "name": "issue_work_products_runtime_service_id_workspace_runtime_services_id_fk", - "tableFrom": "issue_work_products", - "tableTo": "workspace_runtime_services", - "columnsFrom": [ - "runtime_service_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "issue_work_products_created_by_run_id_heartbeat_runs_id_fk": { - "name": "issue_work_products_created_by_run_id_heartbeat_runs_id_fk", - "tableFrom": "issue_work_products", - "tableTo": "heartbeat_runs", - "columnsFrom": [ - "created_by_run_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.issues": { - "name": "issues", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "project_workspace_id": { - "name": "project_workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "goal_id": { - "name": "goal_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_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 - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'backlog'" - }, - "work_mode": { - "name": "work_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'standard'" - }, - "priority": { - "name": "priority", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'medium'" - }, - "assignee_agent_id": { - "name": "assignee_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "assignee_user_id": { - "name": "assignee_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "checkout_run_id": { - "name": "checkout_run_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "execution_run_id": { - "name": "execution_run_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "execution_agent_name_key": { - "name": "execution_agent_name_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "execution_locked_at": { - "name": "execution_locked_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "created_by_agent_id": { - "name": "created_by_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "issue_number": { - "name": "issue_number", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "identifier": { - "name": "identifier", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "origin_kind": { - "name": "origin_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'manual'" - }, - "origin_id": { - "name": "origin_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "origin_run_id": { - "name": "origin_run_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "origin_fingerprint": { - "name": "origin_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "request_depth": { - "name": "request_depth", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "billing_code": { - "name": "billing_code", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "assignee_adapter_overrides": { - "name": "assignee_adapter_overrides", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "execution_policy": { - "name": "execution_policy", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "execution_state": { - "name": "execution_state", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "monitor_next_check_at": { - "name": "monitor_next_check_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "monitor_wake_requested_at": { - "name": "monitor_wake_requested_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "monitor_last_triggered_at": { - "name": "monitor_last_triggered_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "monitor_attempt_count": { - "name": "monitor_attempt_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "monitor_notes": { - "name": "monitor_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "monitor_scheduled_by": { - "name": "monitor_scheduled_by", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "execution_workspace_id": { - "name": "execution_workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "execution_workspace_preference": { - "name": "execution_workspace_preference", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "execution_workspace_settings": { - "name": "execution_workspace_settings", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "started_at": { - "name": "started_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "cancelled_at": { - "name": "cancelled_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "hidden_at": { - "name": "hidden_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": { - "issues_company_status_idx": { - "name": "issues_company_status_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issues_company_assignee_status_idx": { - "name": "issues_company_assignee_status_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "assignee_agent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issues_company_assignee_user_status_idx": { - "name": "issues_company_assignee_user_status_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "assignee_user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issues_company_parent_idx": { - "name": "issues_company_parent_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issues_company_project_idx": { - "name": "issues_company_project_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "project_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issues_company_origin_idx": { - "name": "issues_company_origin_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "origin_kind", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "origin_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issues_company_project_workspace_idx": { - "name": "issues_company_project_workspace_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "project_workspace_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issues_company_execution_workspace_idx": { - "name": "issues_company_execution_workspace_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "execution_workspace_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issues_company_monitor_due_idx": { - "name": "issues_company_monitor_due_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "monitor_next_check_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issues_identifier_idx": { - "name": "issues_identifier_idx", - "columns": [ - { - "expression": "identifier", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "issues_title_search_idx": { - "name": "issues_title_search_idx", - "columns": [ - { - "expression": "title", - "isExpression": false, - "asc": true, - "nulls": "last", - "opclass": "gin_trgm_ops" - } - ], - "isUnique": false, - "concurrently": false, - "method": "gin", - "with": {} - }, - "issues_identifier_search_idx": { - "name": "issues_identifier_search_idx", - "columns": [ - { - "expression": "identifier", - "isExpression": false, - "asc": true, - "nulls": "last", - "opclass": "gin_trgm_ops" - } - ], - "isUnique": false, - "concurrently": false, - "method": "gin", - "with": {} - }, - "issues_description_search_idx": { - "name": "issues_description_search_idx", - "columns": [ - { - "expression": "description", - "isExpression": false, - "asc": true, - "nulls": "last", - "opclass": "gin_trgm_ops" - } - ], - "isUnique": false, - "concurrently": false, - "method": "gin", - "with": {} - }, - "issues_open_routine_execution_uq": { - "name": "issues_open_routine_execution_uq", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "origin_kind", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "origin_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "origin_fingerprint", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "where": "\"issues\".\"origin_kind\" = 'routine_execution'\n and \"issues\".\"origin_id\" is not null\n and \"issues\".\"hidden_at\" is null\n and \"issues\".\"execution_run_id\" is not null\n and \"issues\".\"status\" in ('backlog', 'todo', 'in_progress', 'in_review', 'blocked')", - "concurrently": false, - "method": "btree", - "with": {} - }, - "issues_active_liveness_recovery_incident_uq": { - "name": "issues_active_liveness_recovery_incident_uq", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "origin_kind", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "origin_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "where": "\"issues\".\"origin_kind\" = 'harness_liveness_escalation'\n and \"issues\".\"origin_id\" is not null\n and \"issues\".\"hidden_at\" is null\n and \"issues\".\"status\" not in ('done', 'cancelled')", - "concurrently": false, - "method": "btree", - "with": {} - }, - "issues_active_liveness_recovery_leaf_uq": { - "name": "issues_active_liveness_recovery_leaf_uq", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "origin_kind", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "origin_fingerprint", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "where": "\"issues\".\"origin_kind\" = 'harness_liveness_escalation'\n and \"issues\".\"origin_fingerprint\" <> 'default'\n and \"issues\".\"hidden_at\" is null\n and \"issues\".\"status\" not in ('done', 'cancelled')", - "concurrently": false, - "method": "btree", - "with": {} - }, - "issues_active_stale_run_evaluation_uq": { - "name": "issues_active_stale_run_evaluation_uq", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "origin_kind", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "origin_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "where": "\"issues\".\"origin_kind\" = 'stale_active_run_evaluation'\n and \"issues\".\"origin_id\" is not null\n and \"issues\".\"hidden_at\" is null\n and \"issues\".\"status\" not in ('done', 'cancelled')", - "concurrently": false, - "method": "btree", - "with": {} - }, - "issues_active_productivity_review_uq": { - "name": "issues_active_productivity_review_uq", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "origin_kind", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "origin_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "where": "\"issues\".\"origin_kind\" = 'issue_productivity_review'\n and \"issues\".\"origin_id\" is not null\n and \"issues\".\"hidden_at\" is null\n and \"issues\".\"status\" not in ('done', 'cancelled')", - "concurrently": false, - "method": "btree", - "with": {} - }, - "issues_active_stranded_issue_recovery_uq": { - "name": "issues_active_stranded_issue_recovery_uq", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "origin_kind", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "origin_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "where": "\"issues\".\"origin_kind\" = 'stranded_issue_recovery'\n and \"issues\".\"origin_id\" is not null\n and \"issues\".\"hidden_at\" is null\n and \"issues\".\"status\" not in ('done', 'cancelled')", - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "issues_company_id_companies_id_fk": { - "name": "issues_company_id_companies_id_fk", - "tableFrom": "issues", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "issues_project_id_projects_id_fk": { - "name": "issues_project_id_projects_id_fk", - "tableFrom": "issues", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "issues_project_workspace_id_project_workspaces_id_fk": { - "name": "issues_project_workspace_id_project_workspaces_id_fk", - "tableFrom": "issues", - "tableTo": "project_workspaces", - "columnsFrom": [ - "project_workspace_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "issues_goal_id_goals_id_fk": { - "name": "issues_goal_id_goals_id_fk", - "tableFrom": "issues", - "tableTo": "goals", - "columnsFrom": [ - "goal_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "issues_parent_id_issues_id_fk": { - "name": "issues_parent_id_issues_id_fk", - "tableFrom": "issues", - "tableTo": "issues", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "issues_assignee_agent_id_agents_id_fk": { - "name": "issues_assignee_agent_id_agents_id_fk", - "tableFrom": "issues", - "tableTo": "agents", - "columnsFrom": [ - "assignee_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "issues_checkout_run_id_heartbeat_runs_id_fk": { - "name": "issues_checkout_run_id_heartbeat_runs_id_fk", - "tableFrom": "issues", - "tableTo": "heartbeat_runs", - "columnsFrom": [ - "checkout_run_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "issues_execution_run_id_heartbeat_runs_id_fk": { - "name": "issues_execution_run_id_heartbeat_runs_id_fk", - "tableFrom": "issues", - "tableTo": "heartbeat_runs", - "columnsFrom": [ - "execution_run_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "issues_created_by_agent_id_agents_id_fk": { - "name": "issues_created_by_agent_id_agents_id_fk", - "tableFrom": "issues", - "tableTo": "agents", - "columnsFrom": [ - "created_by_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "issues_execution_workspace_id_execution_workspaces_id_fk": { - "name": "issues_execution_workspace_id_execution_workspaces_id_fk", - "tableFrom": "issues", - "tableTo": "execution_workspaces", - "columnsFrom": [ - "execution_workspace_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.join_requests": { - "name": "join_requests", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "invite_id": { - "name": "invite_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "request_type": { - "name": "request_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'pending_approval'" - }, - "request_ip": { - "name": "request_ip", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "requesting_user_id": { - "name": "requesting_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "request_email_snapshot": { - "name": "request_email_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "agent_name": { - "name": "agent_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "adapter_type": { - "name": "adapter_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "capabilities": { - "name": "capabilities", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "agent_defaults_payload": { - "name": "agent_defaults_payload", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "claim_secret_hash": { - "name": "claim_secret_hash", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "claim_secret_expires_at": { - "name": "claim_secret_expires_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "claim_secret_consumed_at": { - "name": "claim_secret_consumed_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "created_agent_id": { - "name": "created_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "approved_by_user_id": { - "name": "approved_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approved_at": { - "name": "approved_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "rejected_by_user_id": { - "name": "rejected_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "rejected_at": { - "name": "rejected_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": { - "join_requests_invite_unique_idx": { - "name": "join_requests_invite_unique_idx", - "columns": [ - { - "expression": "invite_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "join_requests_company_status_type_created_idx": { - "name": "join_requests_company_status_type_created_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "request_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "join_requests_pending_human_user_uq": { - "name": "join_requests_pending_human_user_uq", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "requesting_user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "where": "\"join_requests\".\"request_type\" = 'human' AND \"join_requests\".\"status\" = 'pending_approval' AND \"join_requests\".\"requesting_user_id\" IS NOT NULL", - "concurrently": false, - "method": "btree", - "with": {} - }, - "join_requests_pending_human_email_uq": { - "name": "join_requests_pending_human_email_uq", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "lower(\"request_email_snapshot\")", - "asc": true, - "isExpression": true, - "nulls": "last" - } - ], - "isUnique": true, - "where": "\"join_requests\".\"request_type\" = 'human' AND \"join_requests\".\"status\" = 'pending_approval' AND \"join_requests\".\"request_email_snapshot\" IS NOT NULL", - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "join_requests_invite_id_invites_id_fk": { - "name": "join_requests_invite_id_invites_id_fk", - "tableFrom": "join_requests", - "tableTo": "invites", - "columnsFrom": [ - "invite_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "join_requests_company_id_companies_id_fk": { - "name": "join_requests_company_id_companies_id_fk", - "tableFrom": "join_requests", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "join_requests_created_agent_id_agents_id_fk": { - "name": "join_requests_created_agent_id_agents_id_fk", - "tableFrom": "join_requests", - "tableTo": "agents", - "columnsFrom": [ - "created_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.labels": { - "name": "labels", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "color": { - "name": "color", - "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": { - "labels_company_idx": { - "name": "labels_company_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "labels_company_name_idx": { - "name": "labels_company_name_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "name", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "labels_company_id_companies_id_fk": { - "name": "labels_company_id_companies_id_fk", - "tableFrom": "labels", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.plugin_company_settings": { - "name": "plugin_company_settings", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "plugin_id": { - "name": "plugin_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "enabled": { - "name": "enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "settings_json": { - "name": "settings_json", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "last_error": { - "name": "last_error", - "type": "text", - "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": { - "plugin_company_settings_company_idx": { - "name": "plugin_company_settings_company_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "plugin_company_settings_plugin_idx": { - "name": "plugin_company_settings_plugin_idx", - "columns": [ - { - "expression": "plugin_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "plugin_company_settings_company_plugin_uq": { - "name": "plugin_company_settings_company_plugin_uq", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "plugin_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "plugin_company_settings_company_id_companies_id_fk": { - "name": "plugin_company_settings_company_id_companies_id_fk", - "tableFrom": "plugin_company_settings", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "plugin_company_settings_plugin_id_plugins_id_fk": { - "name": "plugin_company_settings_plugin_id_plugins_id_fk", - "tableFrom": "plugin_company_settings", - "tableTo": "plugins", - "columnsFrom": [ - "plugin_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.plugin_config": { - "name": "plugin_config", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "plugin_id": { - "name": "plugin_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "config_json": { - "name": "config_json", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "last_error": { - "name": "last_error", - "type": "text", - "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()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "plugin_config_plugin_id_idx": { - "name": "plugin_config_plugin_id_idx", - "columns": [ - { - "expression": "plugin_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "plugin_config_company_id_idx": { - "name": "plugin_config_company_id_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "plugin_config_legacy_plugin_id_uq": { - "name": "plugin_config_legacy_plugin_id_uq", - "columns": [ - { - "expression": "plugin_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "where": "\"plugin_config\".\"company_id\" is null", - "concurrently": false, - "method": "btree", - "with": {} - }, - "plugin_config_company_plugin_uq": { - "name": "plugin_config_company_plugin_uq", - "columns": [ - { - "expression": "plugin_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "where": "\"plugin_config\".\"company_id\" is not null", - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "plugin_config_plugin_id_plugins_id_fk": { - "name": "plugin_config_plugin_id_plugins_id_fk", - "tableFrom": "plugin_config", - "tableTo": "plugins", - "columnsFrom": [ - "plugin_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "plugin_config_company_id_companies_id_fk": { - "name": "plugin_config_company_id_companies_id_fk", - "tableFrom": "plugin_config", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.plugin_database_namespaces": { - "name": "plugin_database_namespaces", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "plugin_id": { - "name": "plugin_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "plugin_key": { - "name": "plugin_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "namespace_name": { - "name": "namespace_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "namespace_mode": { - "name": "namespace_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'schema'" - }, - "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": { - "plugin_database_namespaces_plugin_idx": { - "name": "plugin_database_namespaces_plugin_idx", - "columns": [ - { - "expression": "plugin_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "plugin_database_namespaces_namespace_idx": { - "name": "plugin_database_namespaces_namespace_idx", - "columns": [ - { - "expression": "namespace_name", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "plugin_database_namespaces_status_idx": { - "name": "plugin_database_namespaces_status_idx", - "columns": [ - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "plugin_database_namespaces_plugin_id_plugins_id_fk": { - "name": "plugin_database_namespaces_plugin_id_plugins_id_fk", - "tableFrom": "plugin_database_namespaces", - "tableTo": "plugins", - "columnsFrom": [ - "plugin_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.plugin_entities": { - "name": "plugin_entities", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "plugin_id": { - "name": "plugin_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "scope_kind": { - "name": "scope_kind", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "scope_id": { - "name": "scope_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "external_id": { - "name": "external_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "data": { - "name": "data", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "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": { - "plugin_entities_plugin_idx": { - "name": "plugin_entities_plugin_idx", - "columns": [ - { - "expression": "plugin_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "plugin_entities_type_idx": { - "name": "plugin_entities_type_idx", - "columns": [ - { - "expression": "entity_type", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "plugin_entities_scope_idx": { - "name": "plugin_entities_scope_idx", - "columns": [ - { - "expression": "scope_kind", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "scope_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "plugin_entities_external_idx": { - "name": "plugin_entities_external_idx", - "columns": [ - { - "expression": "plugin_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "entity_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "external_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "plugin_entities_plugin_id_plugins_id_fk": { - "name": "plugin_entities_plugin_id_plugins_id_fk", - "tableFrom": "plugin_entities", - "tableTo": "plugins", - "columnsFrom": [ - "plugin_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.plugin_job_runs": { - "name": "plugin_job_runs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "job_id": { - "name": "job_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "plugin_id": { - "name": "plugin_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "duration_ms": { - "name": "duration_ms", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "logs": { - "name": "logs", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'[]'::jsonb" - }, - "started_at": { - "name": "started_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "finished_at": { - "name": "finished_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()" - } - }, - "indexes": { - "plugin_job_runs_job_idx": { - "name": "plugin_job_runs_job_idx", - "columns": [ - { - "expression": "job_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "plugin_job_runs_plugin_idx": { - "name": "plugin_job_runs_plugin_idx", - "columns": [ - { - "expression": "plugin_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "plugin_job_runs_status_idx": { - "name": "plugin_job_runs_status_idx", - "columns": [ - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "plugin_job_runs_job_id_plugin_jobs_id_fk": { - "name": "plugin_job_runs_job_id_plugin_jobs_id_fk", - "tableFrom": "plugin_job_runs", - "tableTo": "plugin_jobs", - "columnsFrom": [ - "job_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "plugin_job_runs_plugin_id_plugins_id_fk": { - "name": "plugin_job_runs_plugin_id_plugins_id_fk", - "tableFrom": "plugin_job_runs", - "tableTo": "plugins", - "columnsFrom": [ - "plugin_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.plugin_jobs": { - "name": "plugin_jobs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "plugin_id": { - "name": "plugin_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "job_key": { - "name": "job_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "schedule": { - "name": "schedule", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'active'" - }, - "last_run_at": { - "name": "last_run_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "next_run_at": { - "name": "next_run_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": { - "plugin_jobs_plugin_idx": { - "name": "plugin_jobs_plugin_idx", - "columns": [ - { - "expression": "plugin_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "plugin_jobs_next_run_idx": { - "name": "plugin_jobs_next_run_idx", - "columns": [ - { - "expression": "next_run_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "plugin_jobs_unique_idx": { - "name": "plugin_jobs_unique_idx", - "columns": [ - { - "expression": "plugin_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "job_key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "plugin_jobs_plugin_id_plugins_id_fk": { - "name": "plugin_jobs_plugin_id_plugins_id_fk", - "tableFrom": "plugin_jobs", - "tableTo": "plugins", - "columnsFrom": [ - "plugin_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.plugin_logs": { - "name": "plugin_logs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "plugin_id": { - "name": "plugin_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "level": { - "name": "level", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'info'" - }, - "message": { - "name": "message", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "meta": { - "name": "meta", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "plugin_logs_plugin_time_idx": { - "name": "plugin_logs_plugin_time_idx", - "columns": [ - { - "expression": "plugin_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "plugin_logs_level_idx": { - "name": "plugin_logs_level_idx", - "columns": [ - { - "expression": "level", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "plugin_logs_plugin_id_plugins_id_fk": { - "name": "plugin_logs_plugin_id_plugins_id_fk", - "tableFrom": "plugin_logs", - "tableTo": "plugins", - "columnsFrom": [ - "plugin_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.plugin_managed_resources": { - "name": "plugin_managed_resources", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "plugin_id": { - "name": "plugin_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "plugin_key": { - "name": "plugin_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "resource_kind": { - "name": "resource_kind", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "resource_key": { - "name": "resource_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "resource_id": { - "name": "resource_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "defaults_json": { - "name": "defaults_json", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "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": { - "plugin_managed_resources_company_idx": { - "name": "plugin_managed_resources_company_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "plugin_managed_resources_plugin_idx": { - "name": "plugin_managed_resources_plugin_idx", - "columns": [ - { - "expression": "plugin_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "plugin_managed_resources_resource_idx": { - "name": "plugin_managed_resources_resource_idx", - "columns": [ - { - "expression": "resource_kind", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "resource_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "plugin_managed_resources_company_plugin_resource_uq": { - "name": "plugin_managed_resources_company_plugin_resource_uq", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "plugin_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "resource_kind", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "resource_key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "plugin_managed_resources_company_id_companies_id_fk": { - "name": "plugin_managed_resources_company_id_companies_id_fk", - "tableFrom": "plugin_managed_resources", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "plugin_managed_resources_plugin_id_plugins_id_fk": { - "name": "plugin_managed_resources_plugin_id_plugins_id_fk", - "tableFrom": "plugin_managed_resources", - "tableTo": "plugins", - "columnsFrom": [ - "plugin_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.plugin_migrations": { - "name": "plugin_migrations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "plugin_id": { - "name": "plugin_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "plugin_key": { - "name": "plugin_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "namespace_name": { - "name": "namespace_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "migration_key": { - "name": "migration_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "checksum": { - "name": "checksum", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "plugin_version": { - "name": "plugin_version", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "started_at": { - "name": "started_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "applied_at": { - "name": "applied_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "error_message": { - "name": "error_message", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "plugin_migrations_plugin_key_idx": { - "name": "plugin_migrations_plugin_key_idx", - "columns": [ - { - "expression": "plugin_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "migration_key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "plugin_migrations_plugin_idx": { - "name": "plugin_migrations_plugin_idx", - "columns": [ - { - "expression": "plugin_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "plugin_migrations_status_idx": { - "name": "plugin_migrations_status_idx", - "columns": [ - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "plugin_migrations_plugin_id_plugins_id_fk": { - "name": "plugin_migrations_plugin_id_plugins_id_fk", - "tableFrom": "plugin_migrations", - "tableTo": "plugins", - "columnsFrom": [ - "plugin_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.plugin_state": { - "name": "plugin_state", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "plugin_id": { - "name": "plugin_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "scope_kind": { - "name": "scope_kind", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "scope_id": { - "name": "scope_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "namespace": { - "name": "namespace", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "state_key": { - "name": "state_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "value_json": { - "name": "value_json", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "plugin_state_plugin_scope_idx": { - "name": "plugin_state_plugin_scope_idx", - "columns": [ - { - "expression": "plugin_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "scope_kind", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "plugin_state_plugin_id_plugins_id_fk": { - "name": "plugin_state_plugin_id_plugins_id_fk", - "tableFrom": "plugin_state", - "tableTo": "plugins", - "columnsFrom": [ - "plugin_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "plugin_state_unique_entry_idx": { - "name": "plugin_state_unique_entry_idx", - "nullsNotDistinct": true, - "columns": [ - "plugin_id", - "scope_kind", - "scope_id", - "namespace", - "state_key" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.plugin_webhook_deliveries": { - "name": "plugin_webhook_deliveries", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "plugin_id": { - "name": "plugin_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "webhook_key": { - "name": "webhook_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "external_id": { - "name": "external_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "duration_ms": { - "name": "duration_ms", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "payload": { - "name": "payload", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "headers": { - "name": "headers", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "started_at": { - "name": "started_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "finished_at": { - "name": "finished_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()" - } - }, - "indexes": { - "plugin_webhook_deliveries_plugin_idx": { - "name": "plugin_webhook_deliveries_plugin_idx", - "columns": [ - { - "expression": "plugin_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "plugin_webhook_deliveries_status_idx": { - "name": "plugin_webhook_deliveries_status_idx", - "columns": [ - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "plugin_webhook_deliveries_key_idx": { - "name": "plugin_webhook_deliveries_key_idx", - "columns": [ - { - "expression": "webhook_key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "plugin_webhook_deliveries_plugin_id_plugins_id_fk": { - "name": "plugin_webhook_deliveries_plugin_id_plugins_id_fk", - "tableFrom": "plugin_webhook_deliveries", - "tableTo": "plugins", - "columnsFrom": [ - "plugin_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.plugins": { - "name": "plugins", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "plugin_key": { - "name": "plugin_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "package_name": { - "name": "package_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "version": { - "name": "version", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "api_version": { - "name": "api_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "categories": { - "name": "categories", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'[]'::jsonb" - }, - "manifest_json": { - "name": "manifest_json", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'installed'" - }, - "install_order": { - "name": "install_order", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "package_path": { - "name": "package_path", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "installed_at": { - "name": "installed_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": { - "plugins_plugin_key_idx": { - "name": "plugins_plugin_key_idx", - "columns": [ - { - "expression": "plugin_key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "plugins_status_idx": { - "name": "plugins_status_idx", - "columns": [ - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.principal_permission_grants": { - "name": "principal_permission_grants", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "principal_type": { - "name": "principal_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "principal_id": { - "name": "principal_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "permission_key": { - "name": "permission_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "scope": { - "name": "scope", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "granted_by_user_id": { - "name": "granted_by_user_id", - "type": "text", - "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": { - "principal_permission_grants_unique_idx": { - "name": "principal_permission_grants_unique_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "principal_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "principal_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "permission_key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "principal_permission_grants_company_permission_idx": { - "name": "principal_permission_grants_company_permission_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "permission_key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "principal_permission_grants_company_id_companies_id_fk": { - "name": "principal_permission_grants_company_id_companies_id_fk", - "tableFrom": "principal_permission_grants", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.project_goals": { - "name": "project_goals", - "schema": "", - "columns": { - "project_id": { - "name": "project_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "goal_id": { - "name": "goal_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "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": { - "project_goals_project_idx": { - "name": "project_goals_project_idx", - "columns": [ - { - "expression": "project_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "project_goals_goal_idx": { - "name": "project_goals_goal_idx", - "columns": [ - { - "expression": "goal_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "project_goals_company_idx": { - "name": "project_goals_company_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "project_goals_project_id_projects_id_fk": { - "name": "project_goals_project_id_projects_id_fk", - "tableFrom": "project_goals", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "project_goals_goal_id_goals_id_fk": { - "name": "project_goals_goal_id_goals_id_fk", - "tableFrom": "project_goals", - "tableTo": "goals", - "columnsFrom": [ - "goal_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "project_goals_company_id_companies_id_fk": { - "name": "project_goals_company_id_companies_id_fk", - "tableFrom": "project_goals", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "project_goals_project_id_goal_id_pk": { - "name": "project_goals_project_id_goal_id_pk", - "columns": [ - "project_id", - "goal_id" - ] - } - }, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.project_memberships": { - "name": "project_memberships", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "state": { - "name": "state", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'joined'" - }, - "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": { - "project_memberships_company_user_idx": { - "name": "project_memberships_company_user_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "project_memberships_project_idx": { - "name": "project_memberships_project_idx", - "columns": [ - { - "expression": "project_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "project_memberships_company_user_project_uq": { - "name": "project_memberships_company_user_project_uq", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "project_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "project_memberships_company_id_companies_id_fk": { - "name": "project_memberships_company_id_companies_id_fk", - "tableFrom": "project_memberships", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "project_memberships_project_id_projects_id_fk": { - "name": "project_memberships_project_id_projects_id_fk", - "tableFrom": "project_memberships", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.project_workspaces": { - "name": "project_workspaces", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "source_type": { - "name": "source_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'local_path'" - }, - "cwd": { - "name": "cwd", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "repo_url": { - "name": "repo_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "repo_ref": { - "name": "repo_ref", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "default_ref": { - "name": "default_ref", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "visibility": { - "name": "visibility", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "setup_command": { - "name": "setup_command", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "cleanup_command": { - "name": "cleanup_command", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "remote_provider": { - "name": "remote_provider", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "remote_workspace_ref": { - "name": "remote_workspace_ref", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "shared_workspace_key": { - "name": "shared_workspace_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "is_primary": { - "name": "is_primary", - "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": { - "project_workspaces_company_project_idx": { - "name": "project_workspaces_company_project_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "project_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "project_workspaces_project_primary_idx": { - "name": "project_workspaces_project_primary_idx", - "columns": [ - { - "expression": "project_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "is_primary", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "project_workspaces_project_source_type_idx": { - "name": "project_workspaces_project_source_type_idx", - "columns": [ - { - "expression": "project_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "source_type", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "project_workspaces_company_shared_key_idx": { - "name": "project_workspaces_company_shared_key_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "shared_workspace_key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "project_workspaces_project_remote_ref_idx": { - "name": "project_workspaces_project_remote_ref_idx", - "columns": [ - { - "expression": "project_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "remote_provider", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "remote_workspace_ref", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "project_workspaces_company_id_companies_id_fk": { - "name": "project_workspaces_company_id_companies_id_fk", - "tableFrom": "project_workspaces", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "project_workspaces_project_id_projects_id_fk": { - "name": "project_workspaces_project_id_projects_id_fk", - "tableFrom": "project_workspaces", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.projects": { - "name": "projects", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "goal_id": { - "name": "goal_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'backlog'" - }, - "lead_agent_id": { - "name": "lead_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "target_date": { - "name": "target_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "env": { - "name": "env", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "pause_reason": { - "name": "pause_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "paused_at": { - "name": "paused_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "execution_workspace_policy": { - "name": "execution_workspace_policy", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "archived_at": { - "name": "archived_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": { - "projects_company_idx": { - "name": "projects_company_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "projects_company_id_companies_id_fk": { - "name": "projects_company_id_companies_id_fk", - "tableFrom": "projects", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "projects_goal_id_goals_id_fk": { - "name": "projects_goal_id_goals_id_fk", - "tableFrom": "projects", - "tableTo": "goals", - "columnsFrom": [ - "goal_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "projects_lead_agent_id_agents_id_fk": { - "name": "projects_lead_agent_id_agents_id_fk", - "tableFrom": "projects", - "tableTo": "agents", - "columnsFrom": [ - "lead_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.routine_revisions": { - "name": "routine_revisions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "routine_id": { - "name": "routine_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "revision_number": { - "name": "revision_number", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "snapshot": { - "name": "snapshot", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "change_summary": { - "name": "change_summary", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "restored_from_revision_id": { - "name": "restored_from_revision_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "created_by_agent_id": { - "name": "created_by_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_by_run_id": { - "name": "created_by_run_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "routine_revisions_routine_revision_uq": { - "name": "routine_revisions_routine_revision_uq", - "columns": [ - { - "expression": "routine_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "revision_number", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "routine_revisions_company_routine_created_idx": { - "name": "routine_revisions_company_routine_created_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "routine_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "routine_revisions_company_id_companies_id_fk": { - "name": "routine_revisions_company_id_companies_id_fk", - "tableFrom": "routine_revisions", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "routine_revisions_routine_id_routines_id_fk": { - "name": "routine_revisions_routine_id_routines_id_fk", - "tableFrom": "routine_revisions", - "tableTo": "routines", - "columnsFrom": [ - "routine_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "routine_revisions_restored_from_revision_id_routine_revisions_id_fk": { - "name": "routine_revisions_restored_from_revision_id_routine_revisions_id_fk", - "tableFrom": "routine_revisions", - "tableTo": "routine_revisions", - "columnsFrom": [ - "restored_from_revision_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "routine_revisions_created_by_agent_id_agents_id_fk": { - "name": "routine_revisions_created_by_agent_id_agents_id_fk", - "tableFrom": "routine_revisions", - "tableTo": "agents", - "columnsFrom": [ - "created_by_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "routine_revisions_created_by_run_id_heartbeat_runs_id_fk": { - "name": "routine_revisions_created_by_run_id_heartbeat_runs_id_fk", - "tableFrom": "routine_revisions", - "tableTo": "heartbeat_runs", - "columnsFrom": [ - "created_by_run_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.routine_runs": { - "name": "routine_runs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "routine_id": { - "name": "routine_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "trigger_id": { - "name": "trigger_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "source": { - "name": "source", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'received'" - }, - "triggered_at": { - "name": "triggered_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "routine_revision_id": { - "name": "routine_revision_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "idempotency_key": { - "name": "idempotency_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "trigger_payload": { - "name": "trigger_payload", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "dispatch_fingerprint": { - "name": "dispatch_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "linked_issue_id": { - "name": "linked_issue_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "coalesced_into_run_id": { - "name": "coalesced_into_run_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "failure_reason": { - "name": "failure_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_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": { - "routine_runs_company_routine_idx": { - "name": "routine_runs_company_routine_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "routine_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "routine_runs_revision_idx": { - "name": "routine_runs_revision_idx", - "columns": [ - { - "expression": "routine_revision_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "routine_runs_trigger_idx": { - "name": "routine_runs_trigger_idx", - "columns": [ - { - "expression": "trigger_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "routine_runs_dispatch_fingerprint_idx": { - "name": "routine_runs_dispatch_fingerprint_idx", - "columns": [ - { - "expression": "routine_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "dispatch_fingerprint", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "routine_runs_linked_issue_idx": { - "name": "routine_runs_linked_issue_idx", - "columns": [ - { - "expression": "linked_issue_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "routine_runs_trigger_idempotency_idx": { - "name": "routine_runs_trigger_idempotency_idx", - "columns": [ - { - "expression": "trigger_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "idempotency_key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "routine_runs_company_id_companies_id_fk": { - "name": "routine_runs_company_id_companies_id_fk", - "tableFrom": "routine_runs", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "routine_runs_routine_id_routines_id_fk": { - "name": "routine_runs_routine_id_routines_id_fk", - "tableFrom": "routine_runs", - "tableTo": "routines", - "columnsFrom": [ - "routine_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "routine_runs_trigger_id_routine_triggers_id_fk": { - "name": "routine_runs_trigger_id_routine_triggers_id_fk", - "tableFrom": "routine_runs", - "tableTo": "routine_triggers", - "columnsFrom": [ - "trigger_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "routine_runs_routine_revision_id_routine_revisions_id_fk": { - "name": "routine_runs_routine_revision_id_routine_revisions_id_fk", - "tableFrom": "routine_runs", - "tableTo": "routine_revisions", - "columnsFrom": [ - "routine_revision_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "routine_runs_linked_issue_id_issues_id_fk": { - "name": "routine_runs_linked_issue_id_issues_id_fk", - "tableFrom": "routine_runs", - "tableTo": "issues", - "columnsFrom": [ - "linked_issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.routine_triggers": { - "name": "routine_triggers", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "routine_id": { - "name": "routine_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "enabled": { - "name": "enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "cron_expression": { - "name": "cron_expression", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "timezone": { - "name": "timezone", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "next_run_at": { - "name": "next_run_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "last_fired_at": { - "name": "last_fired_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "public_id": { - "name": "public_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "secret_id": { - "name": "secret_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "signing_mode": { - "name": "signing_mode", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "replay_window_sec": { - "name": "replay_window_sec", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "last_rotated_at": { - "name": "last_rotated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "last_result": { - "name": "last_result", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_by_agent_id": { - "name": "created_by_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "updated_by_agent_id": { - "name": "updated_by_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "updated_by_user_id": { - "name": "updated_by_user_id", - "type": "text", - "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": { - "routine_triggers_company_routine_idx": { - "name": "routine_triggers_company_routine_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "routine_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "routine_triggers_company_kind_idx": { - "name": "routine_triggers_company_kind_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "kind", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "routine_triggers_next_run_idx": { - "name": "routine_triggers_next_run_idx", - "columns": [ - { - "expression": "next_run_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "routine_triggers_public_id_idx": { - "name": "routine_triggers_public_id_idx", - "columns": [ - { - "expression": "public_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "routine_triggers_public_id_uq": { - "name": "routine_triggers_public_id_uq", - "columns": [ - { - "expression": "public_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "routine_triggers_company_id_companies_id_fk": { - "name": "routine_triggers_company_id_companies_id_fk", - "tableFrom": "routine_triggers", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "routine_triggers_routine_id_routines_id_fk": { - "name": "routine_triggers_routine_id_routines_id_fk", - "tableFrom": "routine_triggers", - "tableTo": "routines", - "columnsFrom": [ - "routine_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "routine_triggers_secret_id_company_secrets_id_fk": { - "name": "routine_triggers_secret_id_company_secrets_id_fk", - "tableFrom": "routine_triggers", - "tableTo": "company_secrets", - "columnsFrom": [ - "secret_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "routine_triggers_created_by_agent_id_agents_id_fk": { - "name": "routine_triggers_created_by_agent_id_agents_id_fk", - "tableFrom": "routine_triggers", - "tableTo": "agents", - "columnsFrom": [ - "created_by_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "routine_triggers_updated_by_agent_id_agents_id_fk": { - "name": "routine_triggers_updated_by_agent_id_agents_id_fk", - "tableFrom": "routine_triggers", - "tableTo": "agents", - "columnsFrom": [ - "updated_by_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.routines": { - "name": "routines", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "goal_id": { - "name": "goal_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "parent_issue_id": { - "name": "parent_issue_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 - }, - "assignee_agent_id": { - "name": "assignee_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "priority": { - "name": "priority", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'medium'" - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'active'" - }, - "concurrency_policy": { - "name": "concurrency_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'coalesce_if_active'" - }, - "catch_up_policy": { - "name": "catch_up_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'skip_missed'" - }, - "variables": { - "name": "variables", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'[]'::jsonb" - }, - "env": { - "name": "env", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "latest_revision_id": { - "name": "latest_revision_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "latest_revision_number": { - "name": "latest_revision_number", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "created_by_agent_id": { - "name": "created_by_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "updated_by_agent_id": { - "name": "updated_by_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "updated_by_user_id": { - "name": "updated_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "last_triggered_at": { - "name": "last_triggered_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "last_enqueued_at": { - "name": "last_enqueued_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": { - "routines_company_status_idx": { - "name": "routines_company_status_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "routines_company_assignee_idx": { - "name": "routines_company_assignee_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "assignee_agent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "routines_company_project_idx": { - "name": "routines_company_project_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "project_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "routines_company_id_companies_id_fk": { - "name": "routines_company_id_companies_id_fk", - "tableFrom": "routines", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "routines_project_id_projects_id_fk": { - "name": "routines_project_id_projects_id_fk", - "tableFrom": "routines", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "routines_goal_id_goals_id_fk": { - "name": "routines_goal_id_goals_id_fk", - "tableFrom": "routines", - "tableTo": "goals", - "columnsFrom": [ - "goal_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "routines_parent_issue_id_issues_id_fk": { - "name": "routines_parent_issue_id_issues_id_fk", - "tableFrom": "routines", - "tableTo": "issues", - "columnsFrom": [ - "parent_issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "routines_assignee_agent_id_agents_id_fk": { - "name": "routines_assignee_agent_id_agents_id_fk", - "tableFrom": "routines", - "tableTo": "agents", - "columnsFrom": [ - "assignee_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "routines_created_by_agent_id_agents_id_fk": { - "name": "routines_created_by_agent_id_agents_id_fk", - "tableFrom": "routines", - "tableTo": "agents", - "columnsFrom": [ - "created_by_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "routines_updated_by_agent_id_agents_id_fk": { - "name": "routines_updated_by_agent_id_agents_id_fk", - "tableFrom": "routines", - "tableTo": "agents", - "columnsFrom": [ - "updated_by_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.secret_access_events": { - "name": "secret_access_events", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "secret_id": { - "name": "secret_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_type": { - "name": "actor_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_id": { - "name": "actor_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "consumer_type": { - "name": "consumer_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "consumer_id": { - "name": "consumer_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "config_path": { - "name": "config_path", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "issue_id": { - "name": "issue_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "heartbeat_run_id": { - "name": "heartbeat_run_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "plugin_id": { - "name": "plugin_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "outcome": { - "name": "outcome", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "secret_access_events_company_created_idx": { - "name": "secret_access_events_company_created_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "secret_access_events_secret_created_idx": { - "name": "secret_access_events_secret_created_idx", - "columns": [ - { - "expression": "secret_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "secret_access_events_consumer_idx": { - "name": "secret_access_events_consumer_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "consumer_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "consumer_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "secret_access_events_run_idx": { - "name": "secret_access_events_run_idx", - "columns": [ - { - "expression": "heartbeat_run_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "secret_access_events_company_id_companies_id_fk": { - "name": "secret_access_events_company_id_companies_id_fk", - "tableFrom": "secret_access_events", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "secret_access_events_secret_id_company_secrets_id_fk": { - "name": "secret_access_events_secret_id_company_secrets_id_fk", - "tableFrom": "secret_access_events", - "tableTo": "company_secrets", - "columnsFrom": [ - "secret_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "secret_access_events_issue_id_issues_id_fk": { - "name": "secret_access_events_issue_id_issues_id_fk", - "tableFrom": "secret_access_events", - "tableTo": "issues", - "columnsFrom": [ - "issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "secret_access_events_heartbeat_run_id_heartbeat_runs_id_fk": { - "name": "secret_access_events_heartbeat_run_id_heartbeat_runs_id_fk", - "tableFrom": "secret_access_events", - "tableTo": "heartbeat_runs", - "columnsFrom": [ - "heartbeat_run_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "secret_access_events_plugin_id_plugins_id_fk": { - "name": "secret_access_events_plugin_id_plugins_id_fk", - "tableFrom": "secret_access_events", - "tableTo": "plugins", - "columnsFrom": [ - "plugin_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user_sidebar_preferences": { - "name": "user_sidebar_preferences", - "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 - }, - "company_order": { - "name": "company_order", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "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": { - "user_sidebar_preferences_user_uq": { - "name": "user_sidebar_preferences_user_uq", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.workspace_operations": { - "name": "workspace_operations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "execution_workspace_id": { - "name": "execution_workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "heartbeat_run_id": { - "name": "heartbeat_run_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "phase": { - "name": "phase", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "command": { - "name": "command", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "cwd": { - "name": "cwd", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'running'" - }, - "exit_code": { - "name": "exit_code", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "log_store": { - "name": "log_store", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "log_ref": { - "name": "log_ref", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "log_bytes": { - "name": "log_bytes", - "type": "bigint", - "primaryKey": false, - "notNull": false - }, - "log_sha256": { - "name": "log_sha256", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "log_compressed": { - "name": "log_compressed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "stdout_excerpt": { - "name": "stdout_excerpt", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "stderr_excerpt": { - "name": "stderr_excerpt", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "started_at": { - "name": "started_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "finished_at": { - "name": "finished_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": { - "workspace_operations_company_run_started_idx": { - "name": "workspace_operations_company_run_started_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "heartbeat_run_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "started_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "workspace_operations_company_workspace_started_idx": { - "name": "workspace_operations_company_workspace_started_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "execution_workspace_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "started_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "workspace_operations_company_id_companies_id_fk": { - "name": "workspace_operations_company_id_companies_id_fk", - "tableFrom": "workspace_operations", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "workspace_operations_execution_workspace_id_execution_workspaces_id_fk": { - "name": "workspace_operations_execution_workspace_id_execution_workspaces_id_fk", - "tableFrom": "workspace_operations", - "tableTo": "execution_workspaces", - "columnsFrom": [ - "execution_workspace_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "workspace_operations_heartbeat_run_id_heartbeat_runs_id_fk": { - "name": "workspace_operations_heartbeat_run_id_heartbeat_runs_id_fk", - "tableFrom": "workspace_operations", - "tableTo": "heartbeat_runs", - "columnsFrom": [ - "heartbeat_run_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.workspace_runtime_services": { - "name": "workspace_runtime_services", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true - }, - "company_id": { - "name": "company_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "project_workspace_id": { - "name": "project_workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "execution_workspace_id": { - "name": "execution_workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "issue_id": { - "name": "issue_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "scope_type": { - "name": "scope_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "scope_id": { - "name": "scope_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "service_name": { - "name": "service_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "lifecycle": { - "name": "lifecycle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "reuse_key": { - "name": "reuse_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "command": { - "name": "command", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "cwd": { - "name": "cwd", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "port": { - "name": "port", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider_ref": { - "name": "provider_ref", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "owner_agent_id": { - "name": "owner_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "started_by_run_id": { - "name": "started_by_run_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "last_used_at": { - "name": "last_used_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "started_at": { - "name": "started_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "stopped_at": { - "name": "stopped_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "stop_policy": { - "name": "stop_policy", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "health_status": { - "name": "health_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'unknown'" - }, - "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": { - "workspace_runtime_services_company_workspace_status_idx": { - "name": "workspace_runtime_services_company_workspace_status_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "project_workspace_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "workspace_runtime_services_company_execution_workspace_status_idx": { - "name": "workspace_runtime_services_company_execution_workspace_status_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "execution_workspace_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "workspace_runtime_services_company_project_status_idx": { - "name": "workspace_runtime_services_company_project_status_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "project_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "workspace_runtime_services_run_idx": { - "name": "workspace_runtime_services_run_idx", - "columns": [ - { - "expression": "started_by_run_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "workspace_runtime_services_company_updated_idx": { - "name": "workspace_runtime_services_company_updated_idx", - "columns": [ - { - "expression": "company_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "workspace_runtime_services_company_id_companies_id_fk": { - "name": "workspace_runtime_services_company_id_companies_id_fk", - "tableFrom": "workspace_runtime_services", - "tableTo": "companies", - "columnsFrom": [ - "company_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "workspace_runtime_services_project_id_projects_id_fk": { - "name": "workspace_runtime_services_project_id_projects_id_fk", - "tableFrom": "workspace_runtime_services", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "workspace_runtime_services_project_workspace_id_project_workspaces_id_fk": { - "name": "workspace_runtime_services_project_workspace_id_project_workspaces_id_fk", - "tableFrom": "workspace_runtime_services", - "tableTo": "project_workspaces", - "columnsFrom": [ - "project_workspace_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "workspace_runtime_services_execution_workspace_id_execution_workspaces_id_fk": { - "name": "workspace_runtime_services_execution_workspace_id_execution_workspaces_id_fk", - "tableFrom": "workspace_runtime_services", - "tableTo": "execution_workspaces", - "columnsFrom": [ - "execution_workspace_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "workspace_runtime_services_issue_id_issues_id_fk": { - "name": "workspace_runtime_services_issue_id_issues_id_fk", - "tableFrom": "workspace_runtime_services", - "tableTo": "issues", - "columnsFrom": [ - "issue_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "workspace_runtime_services_owner_agent_id_agents_id_fk": { - "name": "workspace_runtime_services_owner_agent_id_agents_id_fk", - "tableFrom": "workspace_runtime_services", - "tableTo": "agents", - "columnsFrom": [ - "owner_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "workspace_runtime_services_started_by_run_id_heartbeat_runs_id_fk": { - "name": "workspace_runtime_services_started_by_run_id_heartbeat_runs_id_fk", - "tableFrom": "workspace_runtime_services", - "tableTo": "heartbeat_runs", - "columnsFrom": [ - "started_by_run_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} diff --git a/packages/db/src/migrations/meta/_journal.json b/packages/db/src/migrations/meta/_journal.json index 48546a4d..991a61ce 100644 --- a/packages/db/src/migrations/meta/_journal.json +++ b/packages/db/src/migrations/meta/_journal.json @@ -659,13 +659,6 @@ "when": 1780040470886, "tag": "0093_giant_green_goblin", "breakpoints": true - }, - { - "idx": 94, - "version": "7", - "when": 1780444800000, - "tag": "0094_plugin_config_company_scope", - "breakpoints": true } ] -} +} \ No newline at end of file diff --git a/packages/db/src/schema/plugin_config.ts b/packages/db/src/schema/plugin_config.ts index 66144689..24407b97 100644 --- a/packages/db/src/schema/plugin_config.ts +++ b/packages/db/src/schema/plugin_config.ts @@ -1,13 +1,10 @@ -import { sql } from "drizzle-orm"; -import { pgTable, uuid, text, timestamp, jsonb, uniqueIndex, index } from "drizzle-orm/pg-core"; -import { companies } from "./companies.js"; +import { pgTable, uuid, text, timestamp, jsonb, uniqueIndex } from "drizzle-orm/pg-core"; import { plugins } from "./plugins.js"; /** - * `plugin_config` table — stores operator-provided plugin configuration. - * - * New configuration is company-scoped. Legacy rows may still have a null - * `company_id` so existing installs keep working until re-saved. + * `plugin_config` table — stores operator-provided instance configuration + * for each plugin (one row per plugin, enforced by a unique index on + * `plugin_id`). * * The `config_json` column holds the values that the operator enters in the * plugin settings UI. These values are validated at runtime against the @@ -22,21 +19,12 @@ export const pluginConfig = pgTable( pluginId: uuid("plugin_id") .notNull() .references(() => plugins.id, { onDelete: "cascade" }), - companyId: uuid("company_id") - .references(() => companies.id, { onDelete: "cascade" }), configJson: jsonb("config_json").$type>().notNull().default({}), lastError: text("last_error"), createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(), updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(), }, (table) => ({ - pluginIdIdx: index("plugin_config_plugin_id_idx").on(table.pluginId), - companyIdIdx: index("plugin_config_company_id_idx").on(table.companyId), - legacyPluginIdUq: uniqueIndex("plugin_config_legacy_plugin_id_uq") - .on(table.pluginId) - .where(sql`${table.companyId} is null`), - companyPluginUq: uniqueIndex("plugin_config_company_plugin_uq") - .on(table.pluginId, table.companyId) - .where(sql`${table.companyId} is not null`), + pluginIdIdx: uniqueIndex("plugin_config_plugin_id_idx").on(table.pluginId), }), ); diff --git a/packages/plugins/sdk/src/host-client-factory.ts b/packages/plugins/sdk/src/host-client-factory.ts index ec58bf4e..8fc8fdfa 100644 --- a/packages/plugins/sdk/src/host-client-factory.ts +++ b/packages/plugins/sdk/src/host-client-factory.ts @@ -100,7 +100,7 @@ export class InvocationScopeDeniedError extends Error { export interface HostServices { /** Provides `config.get`. */ config: { - get(params: WorkerToHostMethods["config.get"][0]): Promise>; + get(): Promise>; }; /** Provides trusted company-scoped local folder helpers. */ @@ -627,8 +627,8 @@ export function createHostClientHandlers( return { // Config - "config.get": gated("config.get", async (params) => { - return services.config.get(params); + "config.get": gated("config.get", async () => { + return services.config.get(); }), "localFolders.declarations": gated("localFolders.declarations", async (params) => { diff --git a/packages/plugins/sdk/src/protocol.ts b/packages/plugins/sdk/src/protocol.ts index 4ea8044f..92fcbf42 100644 --- a/packages/plugins/sdk/src/protocol.ts +++ b/packages/plugins/sdk/src/protocol.ts @@ -672,7 +672,7 @@ export const HOST_TO_WORKER_OPTIONAL_METHODS: readonly HostToWorkerMethodName[] */ export interface WorkerToHostMethods { // Config - "config.get": [params: { companyId?: string | null }, result: Record]; + "config.get": [params: Record, result: Record]; // Trusted local folders "localFolders.declarations": [ @@ -809,7 +809,7 @@ export interface WorkerToHostMethods { // Secrets "secrets.resolve": [ - params: { secretRef: string; companyId?: string | null }, + params: { secretRef: string }, result: string, ]; diff --git a/packages/plugins/sdk/src/types.ts b/packages/plugins/sdk/src/types.ts index 2ad6361e..90af99b4 100644 --- a/packages/plugins/sdk/src/types.ts +++ b/packages/plugins/sdk/src/types.ts @@ -425,7 +425,7 @@ export interface PluginConfigClient { * Values are validated against the plugin's `instanceConfigSchema` by the * host before being passed to the worker. */ - get(params?: { companyId?: string | null }): Promise>; + get(): Promise>; } export interface PluginLocalFolderProblem { @@ -656,7 +656,7 @@ export interface PluginSecretsClient { * @param secretRef - The secret reference string from plugin config * @returns The resolved secret value */ - resolve(secretRef: string, companyId?: string | null): Promise; + resolve(secretRef: string): Promise; } /** diff --git a/packages/plugins/sdk/src/worker-rpc-host.ts b/packages/plugins/sdk/src/worker-rpc-host.ts index 28573112..a135d1f0 100644 --- a/packages/plugins/sdk/src/worker-rpc-host.ts +++ b/packages/plugins/sdk/src/worker-rpc-host.ts @@ -164,10 +164,6 @@ export interface WorkerRpcHost { stop(): void; } -interface RuntimeCompanyContext { - companyId?: string | null; -} - // --------------------------------------------------------------------------- // Internal: event registration // --------------------------------------------------------------------------- @@ -289,7 +285,6 @@ export function startWorkerRpcHost(options: WorkerRpcHostOptions): WorkerRpcHost let currentConfig: Record = {}; let databaseNamespace: string | null = null; const invocationContextStorage = new AsyncLocalStorage(); - const runtimeCompanyContext = new AsyncLocalStorage(); // Plugin handler registrations (populated during setup()) const eventHandlers: EventRegistration[] = []; @@ -418,12 +413,8 @@ export function startWorkerRpcHost(options: WorkerRpcHostOptions): WorkerRpcHost }, config: { - async get(params) { - if (params && "companyId" in params) { - return callHost("config.get", { companyId: params.companyId ?? null }); - } - const companyId = runtimeCompanyContext.getStore()?.companyId ?? null; - return callHost("config.get", companyId ? { companyId } : {}); + async get() { + return callHost("config.get", {} as Record); }, }, @@ -573,11 +564,8 @@ export function startWorkerRpcHost(options: WorkerRpcHostOptions): WorkerRpcHost }, secrets: { - async resolve(secretRef: string, companyId?: string | null): Promise { - const scopedCompanyId = arguments.length >= 2 - ? companyId ?? null - : runtimeCompanyContext.getStore()?.companyId ?? null; - return callHost("secrets.resolve", { secretRef, companyId: scopedCompanyId }); + async resolve(secretRef: string): Promise { + return callHost("secrets.resolve", { secretRef }); }, }, @@ -1479,10 +1467,7 @@ export function startWorkerRpcHost(options: WorkerRpcHostOptions): WorkerRpcHost if (registration.filter && !allowsEvent(registration.filter, event)) continue; try { - await runtimeCompanyContext.run( - { companyId: event.companyId }, - () => registration.fn(event), - ); + await registration.fn(event); } catch (err) { // Log error but continue processing other handlers so one failing // handler doesn't prevent the rest from running. @@ -1522,10 +1507,7 @@ export function startWorkerRpcHost(options: WorkerRpcHostOptions): WorkerRpcHost { code: PLUGIN_RPC_ERROR_CODES.METHOD_NOT_IMPLEMENTED }, ); } - return runtimeCompanyContext.run( - { companyId: params.companyId }, - () => plugin.definition.onApiRequest!(params), - ); + return plugin.definition.onApiRequest(params); } async function handleGetData(params: GetDataParams): Promise { @@ -1533,14 +1515,11 @@ export function startWorkerRpcHost(options: WorkerRpcHostOptions): WorkerRpcHost if (!handler) { throw new Error(`No data handler registered for key "${params.key}"`); } - const handlerParams = - params.renderEnvironment === undefined - ? params.params - : { ...params.params, renderEnvironment: params.renderEnvironment }; - return runtimeCompanyContext.run( - { companyId: params.companyId ?? null }, - () => handler(handlerParams), - ); + return handler({ + ...params.params, + ...(params.companyId === undefined ? {} : { companyId: params.companyId }), + ...(params.renderEnvironment === undefined ? {} : { renderEnvironment: params.renderEnvironment }), + }); } function stringOrNull(value: unknown): string | null { @@ -1573,14 +1552,13 @@ export function startWorkerRpcHost(options: WorkerRpcHostOptions): WorkerRpcHost if (!handler) { throw new Error(`No action handler registered for key "${params.key}"`); } - const handlerParams = - params.renderEnvironment === undefined - ? params.params - : { ...params.params, renderEnvironment: params.renderEnvironment }; - const actionContext = actionContextFromParams(params); - return runtimeCompanyContext.run( - { companyId: params.companyId ?? actionContext.companyId }, - () => handler(handlerParams ?? {}, actionContext), + return handler( + { + ...params.params, + ...(params.companyId === undefined ? {} : { companyId: params.companyId }), + ...(params.renderEnvironment === undefined ? {} : { renderEnvironment: params.renderEnvironment }), + }, + actionContextFromParams(params), ); } @@ -1589,10 +1567,7 @@ export function startWorkerRpcHost(options: WorkerRpcHostOptions): WorkerRpcHost if (!entry) { throw new Error(`No tool handler registered for "${params.toolName}"`); } - return runtimeCompanyContext.run( - { companyId: params.runContext.companyId }, - () => entry.fn(params.parameters, params.runContext), - ); + return entry.fn(params.parameters, params.runContext); } function methodNotImplemented(method: string): Error & { code: number } { @@ -1615,70 +1590,49 @@ export function startWorkerRpcHost(options: WorkerRpcHostOptions): WorkerRpcHost if (!plugin.definition.onEnvironmentProbe) { throw methodNotImplemented("environmentProbe"); } - return runtimeCompanyContext.run( - { companyId: params.companyId }, - () => plugin.definition.onEnvironmentProbe!(params), - ); + return plugin.definition.onEnvironmentProbe(params); } async function handleEnvironmentAcquireLease(params: PluginEnvironmentAcquireLeaseParams) { if (!plugin.definition.onEnvironmentAcquireLease) { throw methodNotImplemented("environmentAcquireLease"); } - return runtimeCompanyContext.run( - { companyId: params.companyId }, - () => plugin.definition.onEnvironmentAcquireLease!(params), - ); + return plugin.definition.onEnvironmentAcquireLease(params); } async function handleEnvironmentResumeLease(params: PluginEnvironmentResumeLeaseParams) { if (!plugin.definition.onEnvironmentResumeLease) { throw methodNotImplemented("environmentResumeLease"); } - return runtimeCompanyContext.run( - { companyId: params.companyId }, - () => plugin.definition.onEnvironmentResumeLease!(params), - ); + return plugin.definition.onEnvironmentResumeLease(params); } async function handleEnvironmentReleaseLease(params: PluginEnvironmentReleaseLeaseParams) { if (!plugin.definition.onEnvironmentReleaseLease) { throw methodNotImplemented("environmentReleaseLease"); } - return runtimeCompanyContext.run( - { companyId: params.companyId }, - () => plugin.definition.onEnvironmentReleaseLease!(params), - ); + return plugin.definition.onEnvironmentReleaseLease(params); } async function handleEnvironmentDestroyLease(params: PluginEnvironmentDestroyLeaseParams) { if (!plugin.definition.onEnvironmentDestroyLease) { throw methodNotImplemented("environmentDestroyLease"); } - return runtimeCompanyContext.run( - { companyId: params.companyId }, - () => plugin.definition.onEnvironmentDestroyLease!(params), - ); + return plugin.definition.onEnvironmentDestroyLease(params); } async function handleEnvironmentRealizeWorkspace(params: PluginEnvironmentRealizeWorkspaceParams) { if (!plugin.definition.onEnvironmentRealizeWorkspace) { throw methodNotImplemented("environmentRealizeWorkspace"); } - return runtimeCompanyContext.run( - { companyId: params.companyId }, - () => plugin.definition.onEnvironmentRealizeWorkspace!(params), - ); + return plugin.definition.onEnvironmentRealizeWorkspace(params); } async function handleEnvironmentExecute(params: PluginEnvironmentExecuteParams) { if (!plugin.definition.onEnvironmentExecute) { throw methodNotImplemented("environmentExecute"); } - return runtimeCompanyContext.run( - { companyId: params.companyId }, - () => plugin.definition.onEnvironmentExecute!(params), - ); + return plugin.definition.onEnvironmentExecute(params); } // ----------------------------------------------------------------------- diff --git a/packages/plugins/sdk/tests/worker-rpc-host.test.ts b/packages/plugins/sdk/tests/worker-rpc-host.test.ts index ef1eead9..d41aa863 100644 --- a/packages/plugins/sdk/tests/worker-rpc-host.test.ts +++ b/packages/plugins/sdk/tests/worker-rpc-host.test.ts @@ -296,222 +296,3 @@ describe("worker invocation scope propagation", () => { } }); }); - -describe("startWorkerRpcHost runtime company context", () => { - function collectJsonLines(stream: PassThrough) { - const queue: unknown[] = []; - const waiters: Array<(value: unknown) => void> = []; - let buffer = ""; - - stream.on("data", (chunk) => { - buffer += chunk.toString("utf8"); - let newlineIndex = buffer.indexOf("\n"); - while (newlineIndex !== -1) { - const line = buffer.slice(0, newlineIndex).trim(); - buffer = buffer.slice(newlineIndex + 1); - if (line) { - const message = JSON.parse(line); - const waiter = waiters.shift(); - if (waiter) waiter(message); - else queue.push(message); - } - newlineIndex = buffer.indexOf("\n"); - } - }); - - return async function nextMessage(): Promise { - const queued = queue.shift(); - if (queued) return queued; - return new Promise((resolve) => waiters.push(resolve)); - }; - } - - function writeMessage(stream: PassThrough, message: unknown): void { - stream.write(`${JSON.stringify(message)}\n`); - } - - it("passes executeTool company context into config and secret host calls", async () => { - const stdin = new PassThrough(); - const stdout = new PassThrough(); - const nextMessage = collectJsonLines(stdout); - - const plugin = definePlugin({ - async setup(ctx) { - ctx.tools.register( - "check-context", - { - displayName: "Check Context", - description: "Checks runtime context propagation", - parametersSchema: { type: "object", properties: {} }, - }, - async () => { - const config = await ctx.config.get(); - const token = await ctx.secrets.resolve("77777777-7777-4777-8777-777777777777"); - return { content: `${config.mode}:${token}` }; - }, - ); - }, - }); - - const host = startWorkerRpcHost({ plugin, stdin, stdout }); - - try { - writeMessage(stdin, { - jsonrpc: "2.0", - id: 1, - method: "initialize", - params: { - manifest: { id: "test-plugin", name: "test-plugin", version: "1.0.0" }, - config: {}, - instanceInfo: { instanceId: "inst-1", hostVersion: "0.0.0-test" }, - apiVersion: 1, - }, - }); - await expect(nextMessage()).resolves.toMatchObject({ id: 1, result: { ok: true } }); - - writeMessage(stdin, { - jsonrpc: "2.0", - id: 2, - method: "executeTool", - params: { - toolName: "check-context", - parameters: {}, - runContext: { - agentId: "agent-1", - runId: "run-1", - companyId: "company-1", - projectId: "project-1", - }, - }, - }); - - const configRequest = await nextMessage(); - expect(configRequest).toMatchObject({ - method: "config.get", - params: { companyId: "company-1" }, - }); - writeMessage(stdin, { - jsonrpc: "2.0", - id: configRequest.id, - result: { mode: "company-config" }, - }); - - const secretRequest = await nextMessage(); - expect(secretRequest).toMatchObject({ - method: "secrets.resolve", - params: { - secretRef: "77777777-7777-4777-8777-777777777777", - companyId: "company-1", - }, - }); - writeMessage(stdin, { - jsonrpc: "2.0", - id: secretRequest.id, - result: "company-secret", - }); - - await expect(nextMessage()).resolves.toMatchObject({ - id: 2, - result: { content: "company-config:company-secret" }, - }); - } finally { - host.stop(); - stdin.destroy(); - stdout.destroy(); - } - }); - - it("preserves explicit null company context in config and secret host calls", async () => { - const stdin = new PassThrough(); - const stdout = new PassThrough(); - const nextMessage = collectJsonLines(stdout); - - const plugin = definePlugin({ - async setup(ctx) { - ctx.tools.register( - "check-explicit-null", - { - displayName: "Check Explicit Null", - description: "Checks explicit null runtime context propagation", - parametersSchema: { type: "object", properties: {} }, - }, - async () => { - const config = await ctx.config.get({ companyId: null }); - const token = await ctx.secrets.resolve( - "77777777-7777-4777-8777-777777777777", - null, - ); - return { content: `${config.mode}:${token}` }; - }, - ); - }, - }); - - const host = startWorkerRpcHost({ plugin, stdin, stdout }); - - try { - writeMessage(stdin, { - jsonrpc: "2.0", - id: 1, - method: "initialize", - params: { - manifest: { id: "test-plugin", name: "test-plugin", version: "1.0.0" }, - config: {}, - instanceInfo: { instanceId: "inst-1", hostVersion: "0.0.0-test" }, - apiVersion: 1, - }, - }); - await expect(nextMessage()).resolves.toMatchObject({ id: 1, result: { ok: true } }); - - writeMessage(stdin, { - jsonrpc: "2.0", - id: 2, - method: "executeTool", - params: { - toolName: "check-explicit-null", - parameters: {}, - runContext: { - agentId: "agent-1", - runId: "run-1", - companyId: "company-1", - projectId: "project-1", - }, - }, - }); - - const configRequest = await nextMessage(); - expect(configRequest).toMatchObject({ - method: "config.get", - params: { companyId: null }, - }); - writeMessage(stdin, { - jsonrpc: "2.0", - id: configRequest.id, - result: { mode: "global-config" }, - }); - - const secretRequest = await nextMessage(); - expect(secretRequest).toMatchObject({ - method: "secrets.resolve", - params: { - secretRef: "77777777-7777-4777-8777-777777777777", - companyId: null, - }, - }); - writeMessage(stdin, { - jsonrpc: "2.0", - id: secretRequest.id, - result: "global-secret", - }); - - await expect(nextMessage()).resolves.toMatchObject({ - id: 2, - result: { content: "global-config:global-secret" }, - }); - } finally { - host.stop(); - stdin.destroy(); - stdout.destroy(); - } - }); -}); diff --git a/packages/shared/src/types/plugin.ts b/packages/shared/src/types/plugin.ts index 1086eac1..351b2dda 100644 --- a/packages/shared/src/types/plugin.ts +++ b/packages/shared/src/types/plugin.ts @@ -678,17 +678,15 @@ export interface PluginStateRecord { // --------------------------------------------------------------------------- /** - * Domain type for a plugin's configuration as persisted in the + * Domain type for a plugin's instance configuration as persisted in the * `plugin_config` table. * See PLUGIN_SPEC.md §21.3 for the schema definition. */ export interface PluginConfig { /** UUID primary key. */ id: string; - /** FK to `plugins.id`. */ + /** FK to `plugins.id`. Unique — each plugin has at most one config row. */ pluginId: string; - /** Company scope for this config row. Null only for legacy/global fallback rows. */ - companyId: string | null; /** Operator-provided configuration values (validated against `instanceConfigSchema`). */ configJson: Record; /** Most recent config validation error, if any. */ diff --git a/server/src/__tests__/plugin-lifecycle-restart.test.ts b/server/src/__tests__/plugin-lifecycle-restart.test.ts index 03da11ae..04026e6e 100644 --- a/server/src/__tests__/plugin-lifecycle-restart.test.ts +++ b/server/src/__tests__/plugin-lifecycle-restart.test.ts @@ -126,35 +126,4 @@ describe("pluginLifecycleManager.restartWorker", () => { expect(started).toHaveBeenCalledTimes(1); expect(started).toHaveBeenCalledWith({ pluginId: "plugin-1", pluginKey: "example.plugin" }); }); - - it("uses a late-bound runtime loader after bootstrap wiring completes", async () => { - mockRegistry.getById.mockResolvedValue(pluginRecord); - mockRegistry.updateStatus.mockResolvedValue(pluginRecord); - - const { handle, workerManager } = makeWorkerManagerStub(); - let runtimeLoader: Partial | undefined; - const lifecycle = pluginLifecycleManager( - {} as never, - { - resolveLoader: () => runtimeLoader as PluginLoader | undefined, - workerManager, - }, - ); - - runtimeLoader = { - hasRuntimeServices: vi.fn().mockReturnValue(true) as PluginLoader["hasRuntimeServices"], - loadSingle: vi.fn().mockResolvedValue({ - success: true, - plugin: pluginRecord, - registered: { worker: true, eventSubscriptions: 0, jobs: 0, webhooks: 0, tools: 0 }, - }) as PluginLoader["loadSingle"], - unloadSingle: vi.fn().mockResolvedValue(undefined) as PluginLoader["unloadSingle"], - }; - - await lifecycle.restartWorker("plugin-1"); - - expect(runtimeLoader.unloadSingle).toHaveBeenCalledWith("plugin-1", "example.plugin"); - expect(runtimeLoader.loadSingle).toHaveBeenCalledWith("plugin-1"); - expect(handle.restart).not.toHaveBeenCalled(); - }); }); diff --git a/server/src/__tests__/plugin-routes-authz.test.ts b/server/src/__tests__/plugin-routes-authz.test.ts index 28921811..90371991 100644 --- a/server/src/__tests__/plugin-routes-authz.test.ts +++ b/server/src/__tests__/plugin-routes-authz.test.ts @@ -8,11 +8,6 @@ const mockRegistry = vi.hoisted(() => ({ upsertConfig: vi.fn(), getCompanySettings: vi.fn(), upsertCompanySettings: vi.fn(), - getConfig: vi.fn(), -})); - -const mockSecrets = vi.hoisted(() => ({ - syncSecretRefsForTarget: vi.fn(), })); const mockLifecycle = vi.hoisted(() => ({ @@ -27,10 +22,6 @@ vi.mock("../services/plugin-registry.js", () => ({ pluginRegistryService: () => mockRegistry, })); -vi.mock("../services/secrets.js", () => ({ - secretService: () => mockSecrets, -})); - vi.mock("../services/plugin-lifecycle.js", () => ({ pluginLifecycleManager: () => mockLifecycle, })); @@ -336,105 +327,8 @@ describe.sequential("plugin install and upgrade authz", () => { }); expect(res.status).toBe(422); - expect(res.body.error).toMatch(/secret references require companyId/i); + expect(res.body.error).toMatch(/secret references are disabled/i); expect(mockRegistry.upsertConfig).not.toHaveBeenCalled(); - expect(mockSecrets.syncSecretRefsForTarget).not.toHaveBeenCalled(); - }, 20_000); - - it("saves company-scoped plugin config secret refs as plugin bindings", async () => { - readyPlugin(); - mockRegistry.upsertConfig.mockResolvedValue({ - id: "99999999-9999-4999-8999-999999999999", - pluginId, - companyId: companyA, - configJson: { - apiKeyRef: "77777777-7777-4777-8777-777777777777", - }, - lastError: null, - createdAt: new Date(), - updatedAt: new Date(), - }); - - const { app } = await createApp(boardActor({ - isInstanceAdmin: true, - companyIds: [companyA], - })); - - const res = await request(app) - .post(`/api/plugins/${pluginId}/config`) - .send({ - companyId: companyA, - configJson: { - apiKeyRef: "77777777-7777-4777-8777-777777777777", - }, - }); - - expect(res.status).toBe(200); - expect(mockSecrets.syncSecretRefsForTarget).toHaveBeenCalledWith( - companyA, - { targetType: "plugin", targetId: pluginId }, - [{ - secretId: "77777777-7777-4777-8777-777777777777", - configPath: "$", - }], - ); - expect(mockRegistry.upsertConfig).toHaveBeenCalledWith( - pluginId, - { - configJson: { - apiKeyRef: "77777777-7777-4777-8777-777777777777", - }, - }, - companyA, - ); - }, 20_000); - - it("rejects company-scoped plugin config secret refs that do not belong to the selected company", async () => { - readyPlugin(); - mockSecrets.syncSecretRefsForTarget.mockRejectedValueOnce(new Error("Secret not found")); - - const { app } = await createApp(boardActor({ - isInstanceAdmin: true, - companyIds: [companyA], - })); - - const res = await request(app) - .post(`/api/plugins/${pluginId}/config`) - .send({ - companyId: companyA, - configJson: { - apiKeyRef: "88888888-8888-4888-8888-888888888888", - }, - }); - - expect(res.status).toBe(400); - expect(res.body.error).toMatch(/secret not found/i); - expect(mockRegistry.upsertConfig).not.toHaveBeenCalled(); - }, 20_000); - - it("reads plugin config from the requested company scope", async () => { - readyPlugin(); - mockRegistry.getConfig.mockResolvedValue({ - id: "99999999-9999-4999-8999-999999999999", - pluginId, - companyId: companyA, - configJson: { botName: "company-a" }, - lastError: null, - createdAt: new Date(), - updatedAt: new Date(), - }); - - const { app } = await createApp(boardActor({ - isInstanceAdmin: true, - companyIds: [companyA, companyB], - })); - - const res = await request(app) - .get(`/api/plugins/${pluginId}/config?companyId=${companyA}`); - - expect(res.status).toBe(200); - expect(mockRegistry.getConfig).toHaveBeenCalledWith(pluginId, companyA); - expect(res.body.configJson).toEqual({ botName: "company-a" }); }, 20_000); it("allows instance admins to upgrade plugins", async () => { diff --git a/server/src/__tests__/plugin-secrets-handler-runtime.test.ts b/server/src/__tests__/plugin-secrets-handler-runtime.test.ts deleted file mode 100644 index da152656..00000000 --- a/server/src/__tests__/plugin-secrets-handler-runtime.test.ts +++ /dev/null @@ -1,105 +0,0 @@ -import { beforeEach, describe, expect, it, vi } from "vitest"; - -const mocks = vi.hoisted(() => ({ - getConfig: vi.fn(), - resolveSecretValue: vi.fn(), -})); - -vi.mock("../services/plugin-registry.js", () => ({ - pluginRegistryService: () => ({ - getConfig: mocks.getConfig, - }), -})); - -vi.mock("../services/secrets.js", () => ({ - secretService: () => ({ - resolveSecretValue: mocks.resolveSecretValue, - }), -})); - -import { - createPluginSecretsHandler, - PLUGIN_SECRET_REFS_REQUIRE_COMPANY_MESSAGE, -} from "../services/plugin-secrets-handler.js"; - -const pluginId = "11111111-1111-4111-8111-111111111111"; -const companyId = "22222222-2222-4222-8222-222222222222"; -const secretRef = "77777777-7777-4777-8777-777777777777"; - -const manifest = { - instanceConfigSchema: { - type: "object", - properties: { - apiKeyRef: { - type: "string", - format: "secret-ref", - }, - }, - }, -}; - -describe("createPluginSecretsHandler runtime company scoping", () => { - beforeEach(() => { - mocks.getConfig.mockReset(); - mocks.resolveSecretValue.mockReset(); - }); - - it("fails closed when the runtime call has no company context", async () => { - const handler = createPluginSecretsHandler({ - db: {} as never, - pluginId, - manifest: manifest as never, - }); - - await expect(handler.resolve({ secretRef })).rejects.toThrow( - PLUGIN_SECRET_REFS_REQUIRE_COMPANY_MESSAGE, - ); - expect(mocks.getConfig).not.toHaveBeenCalled(); - expect(mocks.resolveSecretValue).not.toHaveBeenCalled(); - }); - - it("rejects a secret ref that is not referenced by that company's plugin config", async () => { - mocks.getConfig.mockResolvedValue({ - configJson: { - apiKeyRef: "88888888-8888-4888-8888-888888888888", - }, - }); - - const handler = createPluginSecretsHandler({ - db: {} as never, - pluginId, - manifest: manifest as never, - }); - - await expect(handler.resolve({ secretRef, companyId })).rejects.toThrow( - /not referenced by this company's plugin config/i, - ); - expect(mocks.getConfig).toHaveBeenCalledWith(pluginId, companyId); - expect(mocks.resolveSecretValue).not.toHaveBeenCalled(); - }); - - it("resolves only through the company plugin binding context from saved config", async () => { - mocks.getConfig.mockResolvedValue({ - configJson: { - apiKeyRef: secretRef, - }, - }); - mocks.resolveSecretValue.mockResolvedValue("plaintext-token"); - - const handler = createPluginSecretsHandler({ - db: {} as never, - pluginId, - manifest: manifest as never, - }); - - await expect(handler.resolve({ secretRef, companyId })).resolves.toBe("plaintext-token"); - expect(mocks.resolveSecretValue).toHaveBeenCalledWith(companyId, secretRef, "latest", { - consumerType: "plugin", - consumerId: pluginId, - configPath: "apiKeyRef", - actorType: "plugin", - actorId: pluginId, - pluginId, - }); - }); -}); diff --git a/server/src/__tests__/plugin-secrets-handler.test.ts b/server/src/__tests__/plugin-secrets-handler.test.ts index fd0d61bd..ec89c872 100644 --- a/server/src/__tests__/plugin-secrets-handler.test.ts +++ b/server/src/__tests__/plugin-secrets-handler.test.ts @@ -1,11 +1,11 @@ import { describe, expect, it } from "vitest"; import { createPluginSecretsHandler, - PLUGIN_SECRET_REFS_REQUIRE_COMPANY_MESSAGE, + PLUGIN_SECRET_REFS_DISABLED_MESSAGE, } from "../services/plugin-secrets-handler.js"; describe("createPluginSecretsHandler", () => { - it("fails closed for plugin secret resolution without company scope", async () => { + it("fails closed for plugin secret resolution until company scoping lands", async () => { const handler = createPluginSecretsHandler({ db: {} as never, pluginId: "11111111-1111-4111-8111-111111111111", @@ -13,7 +13,7 @@ describe("createPluginSecretsHandler", () => { await expect( handler.resolve({ secretRef: "77777777-7777-4777-8777-777777777777" }), - ).rejects.toThrow(PLUGIN_SECRET_REFS_REQUIRE_COMPANY_MESSAGE); + ).rejects.toThrow(PLUGIN_SECRET_REFS_DISABLED_MESSAGE); }); it("still rejects malformed secret refs before the feature-disable guard", async () => { diff --git a/server/src/app.ts b/server/src/app.ts index 74ceabfe..57f5fae5 100644 --- a/server/src/app.ts +++ b/server/src/app.ts @@ -242,11 +242,7 @@ export async function createApp( const eventBus = createPluginEventBus(); setPluginEventBus(eventBus); const jobStore = pluginJobStore(db); - let loader: ReturnType; - const lifecycle = pluginLifecycleManager(db, { - workerManager, - resolveLoader: () => loader, - }); + const lifecycle = pluginLifecycleManager(db, { workerManager }); const scheduler = createPluginJobScheduler({ db, jobStore, @@ -265,7 +261,7 @@ export async function createApp( }); const hostServiceCleanup = createPluginHostServiceCleanup(lifecycle, hostServicesDisposers); let viteHtmlRenderer: ReturnType | null = null; - loader = pluginLoader( + const loader = pluginLoader( db, { localPluginDir: opts.localPluginDir ?? DEFAULT_LOCAL_PLUGIN_DIR, diff --git a/server/src/routes/plugins.ts b/server/src/routes/plugins.ts index deaa4419..c3f6265f 100644 --- a/server/src/routes/plugins.ts +++ b/server/src/routes/plugins.ts @@ -75,8 +75,8 @@ import { } from "../services/plugin-local-folders.js"; import { extractSecretRefPathsFromConfig, + PLUGIN_SECRET_REFS_DISABLED_MESSAGE, } from "../services/plugin-secrets-handler.js"; -import { secretService } from "../services/secrets.js"; import { badRequest, forbidden, notFound, unauthorized, unprocessable } from "../errors.js"; /** UI slot declaration extracted from plugin manifest */ @@ -481,7 +481,6 @@ export function pluginRoutes( ) { const router = Router(); const registry = pluginRegistryService(db); - const secrets = secretService(db); const lifecycle = pluginLifecycleManager(db, { loader, workerManager: bridgeDeps?.workerManager ?? webhookDeps?.workerManager, @@ -670,27 +669,6 @@ export function pluginRoutes( }))); } - function resolvePluginConfigCompanyId(req: Request): string | null { - const body = req.body as { companyId?: unknown } | undefined; - const rawCompanyId = typeof req.query.companyId === "string" - ? req.query.companyId - : typeof body?.companyId === "string" - ? body.companyId - : null; - - if (rawCompanyId) { - if ( - req.actor.type !== "board" || - (req.actor.source !== "local_implicit" && !req.actor.isInstanceAdmin) - ) { - assertCompanyAccess(req, rawCompanyId); - } - return rawCompanyId; - } - - return null; - } - function assertPluginBridgeScope(req: Request, companyId: unknown): string | undefined { if (companyId === undefined || companyId === null) { assertInstanceAdmin(req); @@ -2133,8 +2111,7 @@ export function pluginRoutes( return; } - const companyId = resolvePluginConfigCompanyId(req); - const config = await registry.getConfig(plugin.id, companyId); + const config = await registry.getConfig(plugin.id); res.json(config); }); @@ -2164,29 +2141,27 @@ export function pluginRoutes( return; } - const body = req.body as { configJson?: Record; companyId?: string } | undefined; + const body = req.body as { configJson?: Record } | undefined; if (!body?.configJson || typeof body.configJson !== "object") { res.status(400).json({ error: '"configJson" is required and must be an object' }); return; } - const configJson = body.configJson; - const companyId = resolvePluginConfigCompanyId(req); // Strip devUiUrl unless the caller is an instance admin. devUiUrl activates // a dev-proxy in the static file route that could be abused for SSRF if any // board-level user were allowed to set it. if ( - "devUiUrl" in configJson && + "devUiUrl" in body.configJson && !(req.actor.type === "board" && req.actor.isInstanceAdmin) ) { - delete configJson.devUiUrl; + delete body.configJson.devUiUrl; } // Validate configJson against the plugin's instanceConfigSchema (if declared). // This ensures CLI/API callers get the same validation the UI performs client-side. const schema = plugin.manifestJson?.instanceConfigSchema; if (schema && Object.keys(schema).length > 0) { - const validation = validateInstanceConfig(configJson, schema); + const validation = validateInstanceConfig(body.configJson, schema); if (!validation.valid) { res.status(400).json({ error: "Configuration does not match the plugin's instanceConfigSchema", @@ -2197,55 +2172,31 @@ export function pluginRoutes( } try { - const secretRefsByPath = extractSecretRefPathsFromConfig(configJson, schema); - if (secretRefsByPath.size > 0 && !companyId) { - res.status(422).json({ error: "Plugin secret references require companyId" }); + const secretRefsByPath = extractSecretRefPathsFromConfig(body.configJson, schema); + if (secretRefsByPath.size > 0) { + res.status(422).json({ error: PLUGIN_SECRET_REFS_DISABLED_MESSAGE }); return; } - const refs = [...secretRefsByPath.entries()].flatMap(([secretId, paths]) => - [...paths].map((configPath) => ({ secretId, configPath })), - ); - const persistConfig = async ( - scopedSecrets: typeof secrets, - scopedRegistry: typeof registry, - secretDb?: Db, - ) => { - if (companyId) { - const target = { targetType: "plugin" as const, targetId: plugin.id }; - if (secretDb) { - await scopedSecrets.syncSecretRefsForTarget(companyId, target, refs, { db: secretDb }); - } else { - await scopedSecrets.syncSecretRefsForTarget(companyId, target, refs); - } - } - return scopedRegistry.upsertConfig(plugin.id, { - configJson, - }, companyId); - }; - const result = typeof db.transaction === "function" - ? await db.transaction((tx) => - persistConfig( - secretService(tx as unknown as Db), - pluginRegistryService(tx as unknown as Db), - tx as unknown as Db, - ) - ) - : await persistConfig(secrets, registry); + + const result = await registry.upsertConfig(plugin.id, { + configJson: body.configJson, + }); await logPluginMutationActivity(req, "plugin.config.updated", plugin.id, { pluginId: plugin.id, pluginKey: plugin.pluginKey, - companyId, - configKeyCount: Object.keys(configJson).length, + configKeyCount: Object.keys(body.configJson).length, }); - // Only legacy/global config is still pushed into the process-global worker state. - // Company-scoped config is read at call time through ctx.config.get(). - if (companyId === null && bridgeDeps?.workerManager.isRunning(plugin.id)) { + // Notify the running worker about the config change (PLUGIN_SPEC §25.4.4). + // If the worker implements onConfigChanged, send the new config via RPC. + // If it doesn't (METHOD_NOT_IMPLEMENTED), restart the worker so it picks + // up the new config on re-initialize. If no worker is running, skip. + if (bridgeDeps?.workerManager.isRunning(plugin.id)) { try { await bridgeDeps.workerManager.call( plugin.id, "configChanged", - { config: configJson }, + { config: body.configJson }, ); } catch (rpcErr) { if ( diff --git a/server/src/services/plugin-host-services.ts b/server/src/services/plugin-host-services.ts index 4ea90454..7c2a9156 100644 --- a/server/src/services/plugin-host-services.ts +++ b/server/src/services/plugin-host-services.ts @@ -489,7 +489,7 @@ export function buildHostServices( const registry = pluginRegistryService(db); const stateStore = pluginStateStore(db); const pluginDb = pluginDatabaseService(db); - const secretsHandler = createPluginSecretsHandler({ db, pluginId, manifest: options.manifest }); + const secretsHandler = createPluginSecretsHandler({ db, pluginId }); const companies = companyService(db); const agents = agentService(db); const managedAgents = pluginManagedAgentService(db, { @@ -1053,8 +1053,8 @@ export function buildHostServices( return { config: { - async get(params) { - const configRow = await registry.getConfig(pluginId, params?.companyId ?? null); + async get() { + const configRow = await registry.getConfig(pluginId); return configRow?.configJson ?? {}; }, }, diff --git a/server/src/services/plugin-lifecycle.ts b/server/src/services/plugin-lifecycle.ts index ae9de136..24fa13e7 100644 --- a/server/src/services/plugin-lifecycle.ts +++ b/server/src/services/plugin-lifecycle.ts @@ -267,8 +267,6 @@ export interface PluginLifecycleManager { export interface PluginLifecycleManagerOptions { /** Plugin loader instance. Falls back to the default if omitted. */ loader?: PluginLoader; - /** Resolve the loader lazily for bootstrap paths with circular wiring. */ - resolveLoader?: () => PluginLoader | undefined; /** * Worker process manager. When provided, lifecycle transitions that bring @@ -310,7 +308,6 @@ export function pluginLifecycleManager( // Support the legacy signature: pluginLifecycleManager(db, loader) // as well as the new options object form. let loaderArg: PluginLoader | undefined; - let resolveLoader: (() => PluginLoader | undefined) | undefined; let workerManager: PluginWorkerManager | undefined; if (options && typeof options === "object" && "discoverAll" in options) { @@ -319,12 +316,11 @@ export function pluginLifecycleManager( } else if (options && typeof options === "object") { const opts = options as PluginLifecycleManagerOptions; loaderArg = opts.loader; - resolveLoader = opts.resolveLoader; workerManager = opts.workerManager; } const registry = pluginRegistryService(db); - const fallbackLoader = loaderArg ?? pluginLoader(db); + const pluginLoaderInstance = loaderArg ?? pluginLoader(db); const emitter = new EventEmitter(); emitter.setMaxListeners(100); // plugins may have many listeners; 100 is a safe upper bound @@ -390,10 +386,6 @@ export function pluginLifecycleManager( emitter.emit(event, payload); } - function currentLoader(): PluginLoader { - return resolveLoader?.() ?? loaderArg ?? fallbackLoader; - } - // ----------------------------------------------------------------------- // Worker management helpers // ----------------------------------------------------------------------- @@ -423,15 +415,14 @@ export function pluginLifecycleManager( } async function activateReadyPlugin(pluginId: string): Promise { - const loader = currentLoader(); const supportsRuntimeActivation = - typeof loader.hasRuntimeServices === "function" - && typeof loader.loadSingle === "function"; - if (!supportsRuntimeActivation || !loader.hasRuntimeServices()) { + typeof pluginLoaderInstance.hasRuntimeServices === "function" + && typeof pluginLoaderInstance.loadSingle === "function"; + if (!supportsRuntimeActivation || !pluginLoaderInstance.hasRuntimeServices()) { return; } - const loadResult = await loader.loadSingle(pluginId); + const loadResult = await pluginLoaderInstance.loadSingle(pluginId); if (!loadResult.success) { throw new Error( loadResult.error @@ -444,13 +435,12 @@ export function pluginLifecycleManager( pluginId: string, pluginKey: string, ): Promise { - const loader = currentLoader(); const supportsRuntimeDeactivation = - typeof loader.hasRuntimeServices === "function" - && typeof loader.unloadSingle === "function"; + typeof pluginLoaderInstance.hasRuntimeServices === "function" + && typeof pluginLoaderInstance.unloadSingle === "function"; - if (supportsRuntimeDeactivation && loader.hasRuntimeServices()) { - await loader.unloadSingle(pluginId, pluginKey); + if (supportsRuntimeDeactivation && pluginLoaderInstance.hasRuntimeServices()) { + await pluginLoaderInstance.unloadSingle(pluginId, pluginKey); return; } @@ -551,7 +541,7 @@ export function pluginLifecycleManager( // If already uninstalled and removeData, hard-delete if (plugin.status === "uninstalled") { if (removeData) { - await currentLoader().cleanupInstallArtifacts(plugin); + await pluginLoaderInstance.cleanupInstallArtifacts(plugin); const deleted = await registry.uninstall(pluginId, true); log.info( { pluginId, pluginKey: plugin.pluginKey }, @@ -571,7 +561,7 @@ export function pluginLifecycleManager( } await deactivatePluginRuntime(pluginId, plugin.pluginKey); - await currentLoader().cleanupInstallArtifacts(plugin); + await pluginLoaderInstance.cleanupInstallArtifacts(plugin); // Perform the uninstall via registry (handles soft/hard delete) const result = await registry.uninstall(pluginId, removeData); @@ -666,7 +656,7 @@ export function pluginLifecycleManager( // 1. Download and validate new package via loader const { oldManifest, newManifest, discovered } = - await currentLoader().upgradePlugin(pluginId, { version }); + await pluginLoaderInstance.upgradePlugin(pluginId, { version }); log.info( { @@ -787,10 +777,10 @@ export function pluginLifecycleManager( } const supportsRuntimeActivation = - typeof currentLoader().hasRuntimeServices === "function" - && typeof currentLoader().loadSingle === "function" - && typeof currentLoader().unloadSingle === "function" - && currentLoader().hasRuntimeServices(); + typeof pluginLoaderInstance.hasRuntimeServices === "function" + && typeof pluginLoaderInstance.loadSingle === "function" + && typeof pluginLoaderInstance.unloadSingle === "function" + && pluginLoaderInstance.hasRuntimeServices(); if (supportsRuntimeActivation) { log.info( diff --git a/server/src/services/plugin-registry.ts b/server/src/services/plugin-registry.ts index 355717e3..ce544a9c 100644 --- a/server/src/services/plugin-registry.ts +++ b/server/src/services/plugin-registry.ts @@ -1,4 +1,4 @@ -import { asc, eq, ne, sql, and, isNull } from "drizzle-orm"; +import { asc, eq, ne, sql, and } from "drizzle-orm"; import type { Db } from "@paperclipai/db"; import { plugins, @@ -44,13 +44,6 @@ function isPluginKeyConflict(error: unknown): boolean { return err.code === "23505" && constraint === "plugins_plugin_key_idx"; } -function pluginConfigExactScopeCondition(pluginId: string, companyId?: string | null) { - return and( - eq(pluginConfig.pluginId, pluginId), - companyId ? eq(pluginConfig.companyId, companyId) : isNull(pluginConfig.companyId), - ); -} - // --------------------------------------------------------------------------- // Service // --------------------------------------------------------------------------- @@ -287,37 +280,27 @@ export function pluginRegistryService(db: Db) { // ----- Config --------------------------------------------------------- - /** Retrieve a plugin's company-scoped config, or the legacy global fallback. */ - getConfig: async (pluginId: string, companyId?: string | null) => { - if (companyId) { - const scoped = await db - .select() - .from(pluginConfig) - .where(pluginConfigExactScopeCondition(pluginId, companyId)) - .then((rows) => rows[0] ?? null); - if (scoped) return scoped; - } - - return db + /** Retrieve a plugin's instance configuration. */ + getConfig: (pluginId: string) => + db .select() .from(pluginConfig) - .where(pluginConfigExactScopeCondition(pluginId, null)) - .then((rows) => rows[0] ?? null); - }, + .where(eq(pluginConfig.pluginId, pluginId)) + .then((rows) => rows[0] ?? null), /** * Create or fully replace a plugin's instance configuration. * If a config row already exists for the plugin it is replaced; * otherwise a new row is inserted. */ - upsertConfig: async (pluginId: string, input: UpsertPluginConfig, companyId?: string | null) => { + upsertConfig: async (pluginId: string, input: UpsertPluginConfig) => { const plugin = await getById(pluginId); if (!plugin) throw notFound("Plugin not found"); const existing = await db .select() .from(pluginConfig) - .where(pluginConfigExactScopeCondition(pluginId, companyId)) + .where(eq(pluginConfig.pluginId, pluginId)) .then((rows) => rows[0] ?? null); if (existing) { @@ -328,7 +311,7 @@ export function pluginRegistryService(db: Db) { lastError: null, updatedAt: new Date(), }) - .where(pluginConfigExactScopeCondition(pluginId, companyId)) + .where(eq(pluginConfig.pluginId, pluginId)) .returning() .then((rows) => rows[0]); } @@ -337,7 +320,6 @@ export function pluginRegistryService(db: Db) { .insert(pluginConfig) .values({ pluginId, - companyId: companyId ?? null, configJson: input.configJson, }) .returning() @@ -348,14 +330,14 @@ export function pluginRegistryService(db: Db) { * Partially update a plugin's instance configuration via shallow merge. * If no config row exists yet one is created with the supplied values. */ - patchConfig: async (pluginId: string, input: PatchPluginConfig, companyId?: string | null) => { + patchConfig: async (pluginId: string, input: PatchPluginConfig) => { const plugin = await getById(pluginId); if (!plugin) throw notFound("Plugin not found"); const existing = await db .select() .from(pluginConfig) - .where(pluginConfigExactScopeCondition(pluginId, companyId)) + .where(eq(pluginConfig.pluginId, pluginId)) .then((rows) => rows[0] ?? null); if (existing) { @@ -367,7 +349,7 @@ export function pluginRegistryService(db: Db) { lastError: null, updatedAt: new Date(), }) - .where(pluginConfigExactScopeCondition(pluginId, companyId)) + .where(eq(pluginConfig.pluginId, pluginId)) .returning() .then((rows) => rows[0]); } @@ -376,7 +358,6 @@ export function pluginRegistryService(db: Db) { .insert(pluginConfig) .values({ pluginId, - companyId: companyId ?? null, configJson: input.configJson, }) .returning() @@ -387,11 +368,11 @@ export function pluginRegistryService(db: Db) { * Record an error against a plugin's config (e.g. validation failure * against the plugin's instanceConfigSchema). */ - setConfigError: async (pluginId: string, lastError: string | null, companyId?: string | null) => { + setConfigError: async (pluginId: string, lastError: string | null) => { const rows = await db .update(pluginConfig) .set({ lastError, updatedAt: new Date() }) - .where(pluginConfigExactScopeCondition(pluginId, companyId)) + .where(eq(pluginConfig.pluginId, pluginId)) .returning(); if (rows.length === 0) throw notFound("Plugin config not found"); @@ -399,10 +380,10 @@ export function pluginRegistryService(db: Db) { }, /** Delete a plugin's config row. */ - deleteConfig: async (pluginId: string, companyId?: string | null) => { + deleteConfig: async (pluginId: string) => { const rows = await db .delete(pluginConfig) - .where(pluginConfigExactScopeCondition(pluginId, companyId)) + .where(eq(pluginConfig.pluginId, pluginId)) .returning(); return rows[0] ?? null; diff --git a/server/src/services/plugin-secrets-handler.ts b/server/src/services/plugin-secrets-handler.ts index cadb33c7..ccc5878a 100644 --- a/server/src/services/plugin-secrets-handler.ts +++ b/server/src/services/plugin-secrets-handler.ts @@ -34,17 +34,14 @@ */ import type { Db } from "@paperclipai/db"; -import type { PaperclipPluginManifestV1 } from "@paperclipai/shared"; import { collectSecretRefPaths, isUuidSecretRef, readConfigValueAtPath, } from "./json-schema-secret-refs.js"; -import { pluginRegistryService } from "./plugin-registry.js"; -import { secretService } from "./secrets.js"; -export const PLUGIN_SECRET_REFS_REQUIRE_COMPANY_MESSAGE = - "Plugin secret references require an active company-scoped runtime context"; +export const PLUGIN_SECRET_REFS_DISABLED_MESSAGE = + "Plugin secret references are disabled until company-scoped plugin config lands"; // --------------------------------------------------------------------------- // Error helpers @@ -128,8 +125,6 @@ export function extractSecretRefPathsFromConfig( export interface PluginSecretsResolveParams { /** The secret reference string (a secret UUID). */ secretRef: string; - /** The company whose scoped plugin config is active for this invocation. */ - companyId?: string | null; } /** @@ -144,8 +139,6 @@ export interface PluginSecretsHandlerOptions { * that reach the plugin worker. */ pluginId: string; - /** Plugin manifest, used to extract schema-declared secret-ref paths. */ - manifest?: PaperclipPluginManifestV1 | null; } /** @@ -206,17 +199,24 @@ function createRateLimiter(maxAttempts: number, windowMs: number) { export function createPluginSecretsHandler( options: PluginSecretsHandlerOptions, ): PluginSecretsService { - const { pluginId, manifest } = options; - const registry = pluginRegistryService(options.db); - const secrets = secretService(options.db); + const { pluginId } = options; - // Rate limit: max 30 resolution attempts per plugin+company per minute. + // Rate limit: max 30 resolution attempts per plugin per minute const rateLimiter = createRateLimiter(30, 60_000); return { async resolve(params: PluginSecretsResolveParams): Promise { const { secretRef } = params; + // --------------------------------------------------------------- + // 0. Rate limiting — prevent brute-force UUID enumeration + // --------------------------------------------------------------- + if (!rateLimiter.check(pluginId)) { + const err = new Error("Rate limit exceeded for secret resolution"); + err.name = "RateLimitExceededError"; + throw err; + } + // --------------------------------------------------------------- // 1. Validate the ref format // --------------------------------------------------------------- @@ -230,41 +230,9 @@ export function createPluginSecretsHandler( throw invalidSecretRef(trimmedRef); } - const companyId = typeof params.companyId === "string" ? params.companyId.trim() : ""; - const rateLimitKey = `${pluginId}:${companyId || "__no_company__"}`; - if (!rateLimiter.check(rateLimitKey)) { - const err = new Error("Rate limit exceeded for secret resolution"); - err.name = "RateLimitExceededError"; - throw err; - } - - if (!companyId) { - throw new Error(PLUGIN_SECRET_REFS_REQUIRE_COMPANY_MESSAGE); - } - - const configRow = await registry.getConfig(pluginId, companyId); - const refsBySecret = extractSecretRefPathsFromConfig( - configRow?.configJson ?? {}, - manifest?.instanceConfigSchema, - ); - const paths = [...(refsBySecret.get(trimmedRef) ?? [])]; - if (paths.length === 0) { - throw new Error("Secret is not referenced by this company's plugin config"); - } - if (paths.length > 1) { - throw new Error( - `Secret reference is ambiguous in this company's plugin config at: ${paths.join(", ")}`, - ); - } - - return secrets.resolveSecretValue(companyId, trimmedRef, "latest", { - consumerType: "plugin", - consumerId: pluginId, - configPath: paths[0], - actorType: "plugin", - actorId: pluginId, - pluginId, - }); + // Fail closed until plugin config and worker runtime both carry an + // explicit company scope for secret bindings and resolution. + throw new Error(PLUGIN_SECRET_REFS_DISABLED_MESSAGE); }, }; } diff --git a/server/src/services/secrets.ts b/server/src/services/secrets.ts index 751558fd..327b250e 100644 --- a/server/src/services/secrets.ts +++ b/server/src/services/secrets.ts @@ -2034,7 +2034,6 @@ export function secretService(db: Db) { required?: boolean; label?: string | null; }>, - options?: { db?: SecretBindingDb }, ) => { const normalizedRefs: Array<{ secretId: string; @@ -2043,9 +2042,8 @@ export function secretService(db: Db) { required: boolean; label: string | null; }> = []; - const bindingDb = options?.db ?? db; for (const ref of refs) { - await assertSecretInCompany(companyId, ref.secretId, bindingDb); + await assertSecretInCompany(companyId, ref.secretId); normalizedRefs.push({ secretId: ref.secretId, configPath: ref.configPath, @@ -2057,10 +2055,10 @@ export function secretService(db: Db) { const pathPrefixes = [...new Set(normalizedRefs.map((ref) => ref.configPath.split(".")[0]))]; - const writeBindings = async (targetDb: SecretBindingDb) => { + await db.transaction(async (tx) => { if (pathPrefixes.length > 0) { for (const pathPrefix of pathPrefixes) { - await targetDb + await tx .delete(companySecretBindings) .where( and( @@ -2072,7 +2070,7 @@ export function secretService(db: Db) { ); } } else { - await targetDb + await tx .delete(companySecretBindings) .where( and( @@ -2083,7 +2081,7 @@ export function secretService(db: Db) { ); } if (normalizedRefs.length === 0) return; - await targetDb.insert(companySecretBindings).values( + await tx.insert(companySecretBindings).values( normalizedRefs.map((ref) => ({ companyId, secretId: ref.secretId, @@ -2095,13 +2093,7 @@ export function secretService(db: Db) { label: ref.label, })), ); - }; - - if (options?.db) { - await writeBindings(options.db); - } else { - await db.transaction(async (tx) => writeBindings(tx)); - } + }); return normalizedRefs; }, diff --git a/ui/src/api/plugins.ts b/ui/src/api/plugins.ts index 1572ff11..b0187560 100644 --- a/ui/src/api/plugins.ts +++ b/ui/src/api/plugins.ts @@ -357,10 +357,8 @@ export const pluginsApi = { * * @param pluginId - UUID of the plugin. */ - getConfig: (pluginId: string, companyId?: string | null) => { - const qs = companyId ? `?companyId=${encodeURIComponent(companyId)}` : ""; - return api.get(`/plugins/${pluginId}/config${qs}`); - }, + getConfig: (pluginId: string) => + api.get(`/plugins/${pluginId}/config`), /** * Save (create or update) the configuration for a plugin. @@ -371,8 +369,8 @@ export const pluginsApi = { * @param pluginId - UUID of the plugin. * @param configJson - Configuration values matching the plugin's `instanceConfigSchema`. */ - saveConfig: (pluginId: string, configJson: Record, companyId?: string | null) => - api.post(`/plugins/${pluginId}/config`, { configJson, companyId }), + saveConfig: (pluginId: string, configJson: Record) => + api.post(`/plugins/${pluginId}/config`, { configJson }), /** * Call the plugin's `validateConfig` RPC method to test the configuration diff --git a/ui/src/lib/queryKeys.ts b/ui/src/lib/queryKeys.ts index 7b4aac75..a5517f34 100644 --- a/ui/src/lib/queryKeys.ts +++ b/ui/src/lib/queryKeys.ts @@ -199,8 +199,7 @@ export const queryKeys = { detail: (pluginId: string) => ["plugins", pluginId] as const, health: (pluginId: string) => ["plugins", pluginId, "health"] as const, uiContributions: ["plugins", "ui-contributions"] as const, - config: (pluginId: string, companyId?: string | null) => - ["plugins", pluginId, "config", companyId ?? null] as const, + config: (pluginId: string) => ["plugins", pluginId, "config"] as const, localFolders: (pluginId: string, companyId: string) => ["plugins", pluginId, "companies", companyId, "local-folders"] as const, dashboard: (pluginId: string) => ["plugins", pluginId, "dashboard"] as const, diff --git a/ui/src/pages/PluginSettings.tsx b/ui/src/pages/PluginSettings.tsx index 9e671c28..996b8f8f 100644 --- a/ui/src/pages/PluginSettings.tsx +++ b/ui/src/pages/PluginSettings.tsx @@ -47,8 +47,8 @@ import { * - `GET /api/plugins/:pluginId/health` — health diagnostics (polling). * Only fetched when `plugin.status === "ready"`. * - `GET /api/plugins/:pluginId/dashboard` — aggregated runtime dashboard data (polling). - * - `GET /api/plugins/:pluginId/config?companyId=...` — current company config values. - * - `POST /api/plugins/:pluginId/config` — save company config values. + * - `GET /api/plugins/:pluginId/config` — current config values. + * - `POST /api/plugins/:pluginId/config` — save config values. * - `POST /api/plugins/:pluginId/config/test` — test configuration. * * URL params: @@ -97,9 +97,9 @@ export function PluginSettings() { const hasConfigSchema = configSchema && configSchema.properties && Object.keys(configSchema.properties).length > 0; const { data: configData, isLoading: configLoading } = useQuery({ - queryKey: queryKeys.plugins.config(pluginId!, selectedCompanyId), - queryFn: () => pluginsApi.getConfig(pluginId!, selectedCompanyId), - enabled: !!pluginId && !!hasConfigSchema && !!selectedCompanyId, + queryKey: queryKeys.plugins.config(pluginId!), + queryFn: () => pluginsApi.getConfig(pluginId!), + enabled: !!pluginId && !!hasConfigSchema, }); const { slots } = usePluginSlots({ @@ -245,7 +245,6 @@ export function PluginSettings() { ) : hasConfigSchema ? ( ; isLoading?: boolean; @@ -937,7 +935,7 @@ interface PluginConfigFormProps { * Separated from PluginSettings to isolate re-render scope — only the form * re-renders on field changes, not the entire page. */ -function PluginConfigForm({ pluginId, companyId, schema, initialValues, isLoading, pluginStatus, supportsConfigTest }: PluginConfigFormProps) { +function PluginConfigForm({ pluginId, schema, initialValues, isLoading, pluginStatus, supportsConfigTest }: PluginConfigFormProps) { const queryClient = useQueryClient(); // Form values: start with saved values, fall back to schema defaults @@ -973,11 +971,11 @@ function PluginConfigForm({ pluginId, companyId, schema, initialValues, isLoadin // Save mutation const saveMutation = useMutation({ mutationFn: (configJson: Record) => - pluginsApi.saveConfig(pluginId, configJson, companyId), + pluginsApi.saveConfig(pluginId, configJson), onSuccess: () => { setSaveMessage({ type: "success", text: "Configuration saved." }); setTestResult(null); - queryClient.invalidateQueries({ queryKey: queryKeys.plugins.config(pluginId, companyId) }); + queryClient.invalidateQueries({ queryKey: queryKeys.plugins.config(pluginId) }); // Clear success message after 3s setTimeout(() => setSaveMessage(null), 3000); },