⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.
TypeScript agenticagileai-agentsbug-reportingbug-trackerganttissue-trackerjirajira-alternativekanbanlinearlinear-alternativeopen-sourceproduct-managementproject-managementroadmapself-hostedsprint-planningteam-collaborationtrello-alternative
feat: give agent schedules a permission of their own (#809)
Croff7185052d090a
diff --git a/apps/api/src/modules/agents/core/__tests__/integration/ai-agents.test.ts b/apps/api/src/modules/agents/core/__tests__/integration/ai-agents.test.tsindex 6a90fb49..a6959e27 100644--- a/apps/api/src/modules/agents/core/__tests__/integration/ai-agents.test.ts+++ b/apps/api/src/modules/agents/core/__tests__/integration/ai-agents.test.ts@@ -1130,6 +1130,7 @@ describe('ai agents', () => {'GET /teams/:teamId/ai-agents/:agentId/runs','GET /teams/:teamId/ai-agents/:agentId/traces','GET /teams/:teamId/ai-agents/:agentId/traces/:traceId',+ 'GET /projects/:projectKey/ai-agents/options','POST /projects/:projectKey/ai-agents/:agentId/run/stream','GET /projects/:projectKey/ai-agents/:agentId/threads','PUT /projects/:projectKey/ai-agents/:agentId/threads/:threadId/favorite',diff --git a/apps/api/src/modules/agents/core/__tests__/integration/project-agents.test.ts b/apps/api/src/modules/agents/core/__tests__/integration/project-agents.test.tsnew file mode 100644index 00000000..929d2de9--- /dev/null+++ b/apps/api/src/modules/agents/core/__tests__/integration/project-agents.test.ts@@ -0,0 +1,41 @@+import { beforeEach, describe, expect, it } from 'bun:test';+import { createAgent } from '#tests/helpers/agents';+import { authedApi, createProject, type Api } from '#tests/helpers/app';+import { signUpTestUser } from '#tests/helpers/auth';+import { resetDb } from '#tests/helpers/db';+import { addProjectMember } from '#tests/helpers/members';+import { createRole } from '#tests/helpers/roles';++const agents = (api: Api) => api.projects({ projectKey: 'MKT' })['ai-agents'].options.get();++describe('GET /projects/:projectKey/ai-agents/options', () => {+ let owner: Api;++ beforeEach(async () => {+ await resetDb();+ owner = authedApi((await signUpTestUser()).cookie);+ await createProject(owner, { key: 'MKT', name: 'Marketing' });+ await createProject(owner, { key: 'OPS', name: 'Operations' });+ await createAgent(owner, 'MKT', { name: 'Writer', username: 'writer', kind: 'external' });+ await createAgent(owner, 'OPS', { name: 'Runner', username: 'runner', kind: 'external' });+ });++ it('names the agents of the project to a member who may not read them', async () => {+ const role = await createRole(owner, 'MKT', {+ name: 'No agents',+ permissions: { ai_agents: { read: false } },+ });+ const member = await addProjectMember(owner, 'MKT', role.data!.id);++ const { status, data } = await agents(member);+ expect(status).toBe(200);+ expect(data).toEqual([+ { id: expect.any(Number), name: 'Writer', kind: 'external', model: null },+ ]);+ });++ it('is closed to someone outside the project', async () => {+ const stranger = authedApi((await signUpTestUser()).cookie);+ expect((await agents(stranger)).status).toBe(403);+ });+});diff --git a/apps/api/src/modules/agents/core/index.ts b/apps/api/src/modules/agents/core/index.tsindex 6b5d38a9..80f4eaa2 100644--- a/apps/api/src/modules/agents/core/index.ts+++ b/apps/api/src/modules/agents/core/index.ts@@ -12,6 +12,7 @@ import { runsTeam } from '#modules/teams/service';import { paginate } from '#shared/pagination';import {listAgents,+ listProjectAgents,createAgent,updateAgent,deleteAgent,@@ -31,6 +32,7 @@ import {AgentTraceDetailResponse,AgentTracePageResponse,AiAgentListResponse,+ ProjectAgentListResponse,AiAgentResponse,ChatMessagesResponse,ChatThreadListResponse,@@ -513,6 +515,15 @@ export const aiAgentRoutes = new Elysia({ name: 'ai-agents', detail: { tags: ['A},)+ .get('/projects/:projectKey/ai-agents/options', ({ project }) => listProjectAgents(project.id), {+ projectMember: true,+ response: { 200: ProjectAgentListResponse, ...accessErrors },+ detail: {+ summary: "List a project's agents",+ description: 'Their id, name, kind and model, for any member of the project.',+ },+ })+// The agent is built from its stored model configuration (Mastra) and works in the// project of this path, which it has to be a member of..post(diff --git a/apps/api/src/modules/agents/core/model.ts b/apps/api/src/modules/agents/core/model.tsindex bccbeeae..673984a0 100644--- a/apps/api/src/modules/agents/core/model.ts+++ b/apps/api/src/modules/agents/core/model.ts@@ -298,6 +298,11 @@ export const ChatMessagesResponse = t.Object({export const AiAgentListResponse = t.Array(AiAgentResponse);+// What a screen needs to name an agent, for a member who may not read its configuration.+export const ProjectAgentListResponse = t.Array(+ t.Pick(AiAgentResponse, ['id', 'name', 'kind', 'model']),+);+// One page of a caller's chat threads with an agent (ChatThreadPage).export const ChatThreadListResponse = t.Object({items: t.Array(ChatThreadResponse),diff --git a/apps/api/src/modules/agents/core/service.ts b/apps/api/src/modules/agents/core/service.tsindex 1d56bfd3..ed8380e7 100644--- a/apps/api/src/modules/agents/core/service.ts+++ b/apps/api/src/modules/agents/core/service.ts@@ -14,7 +14,7 @@ import {customField,integrationCredential,} from '@repo/db';-import { and, eq, inArray, ne, notInArray, sql } from 'drizzle-orm';+import { and, asc, eq, inArray, ne, notInArray, sql } from 'drizzle-orm';import { auth } from '@repo/auth';import { iso, HttpError, rethrowDuplicate } from '#shared/lib';import { getCredentialById } from '../integrations/service';@@ -336,6 +336,16 @@ function sharesProjectWith(userId: string) {return sql`exists (select 1 from ${projectMember} pm join ${projectMember} mine on mine.project_id = pm.project_id and mine.user_id = ${userId} where pm.user_id = ${aiAgent.userId})`;}+export async function listProjectAgents(projectId: number) {+ const rows = await db+ .select({ id: aiAgent.id, name: user.name, kind: aiAgent.kind, model: aiAgent.model })+ .from(aiAgent)+ .innerJoin(user, eq(user.id, aiAgent.userId))+ .where(inProject(projectId))+ .orderBy(asc(user.name));+ return rows.map((row) => ({ ...row, kind: row.kind as AgentKind }));+}+// The agents of the team, or only the ones working in one of its projects when// projectId is given. visibleTo narrows the list to the agents working in a project// that user belongs to; the callers who run the team pass nothing and see them all.diff --git a/apps/api/src/modules/agents/schedules/__tests__/integration/agent-schedules.test.ts b/apps/api/src/modules/agents/schedules/__tests__/integration/agent-schedules.test.tsindex 6434ac44..4a9a736d 100644--- a/apps/api/src/modules/agents/schedules/__tests__/integration/agent-schedules.test.ts+++ b/apps/api/src/modules/agents/schedules/__tests__/integration/agent-schedules.test.ts@@ -8,7 +8,7 @@ import { clearLimits, setLimits } from '#tests/helpers/limits';// A schedule sends a fixed task to an internal agent on a cron, in UTC. The worker// picks up the queued runs, so a run created here stays pending. Access is the-// ai_agents permission resource.+// agent_schedules permission resource.const schedules = (api: Api, projectKey = 'MKT') => api.projects({ projectKey })['agent-schedules'];diff --git a/apps/api/src/modules/agents/schedules/__tests__/integration/schedule-permissions.test.ts b/apps/api/src/modules/agents/schedules/__tests__/integration/schedule-permissions.test.tsnew file mode 100644index 00000000..9722a2ec--- /dev/null+++ b/apps/api/src/modules/agents/schedules/__tests__/integration/schedule-permissions.test.ts@@ -0,0 +1,59 @@+import { beforeEach, describe, expect, it } from 'bun:test';+import { createAgent } from '#tests/helpers/agents';+import { authedApi, createProject, type Api } from '#tests/helpers/app';+import { signUpTestUser } from '#tests/helpers/auth';+import { resetDb } from '#tests/helpers/db';+import { addProjectMember } from '#tests/helpers/members';+import { createRole } from '#tests/helpers/roles';++const allow = { create: true, edit: true, read: true, delete: true };++describe('agent schedule permissions', () => {+ let owner: Api;+ let agentId: number;++ beforeEach(async () => {+ await resetDb();+ owner = authedApi((await signUpTestUser()).cookie);+ await createProject(owner, { key: 'MKT', name: 'Marketing' });+ const created = await createAgent(owner, 'MKT', {+ name: 'Writer',+ username: 'writer',+ kind: 'external',+ });+ agentId = created.data!.agent.id;+ });++ const schedules = (api: Api) => api.projects({ projectKey: 'MKT' })['agent-schedules'];+ const memberWith = async (name: string, permissions: unknown) =>+ addProjectMember(+ owner,+ 'MKT',+ (await createRole(owner, 'MKT', { name, permissions })).data!.id,+ );++ it('reads schedules with agent_schedules, not with ai_agents', async () => {+ const agents = await memberWith('Agents', { ai_agents: allow });+ const planner = await memberWith('Planner', { agent_schedules: { read: true } });++ expect((await schedules(agents).get()).status).toBe(403);+ expect((await schedules(planner).get()).status).toBe(200);+ });++ it('refuses a write the role does not hold', async () => {+ const reader = await memberWith('Reader', { agent_schedules: { read: true } });+ const created = await schedules(reader).post({+ name: 'Nightly',+ agentId,+ type: 'cron',+ cron: '0 3 * * *',+ prompt: 'Run',+ });+ expect(created.status).toBe(403);+ });++ it('lets the default role read them', async () => {+ const member = await addProjectMember(owner, 'MKT');+ expect((await schedules(member).get()).status).toBe(200);+ });+});diff --git a/apps/api/src/modules/agents/schedules/index.ts b/apps/api/src/modules/agents/schedules/index.tsindex cbadc5c0..9eb9feaf 100644--- a/apps/api/src/modules/agents/schedules/index.ts+++ b/apps/api/src/modules/agents/schedules/index.ts@@ -46,7 +46,7 @@ export const agentScheduleRoutes = new Elysia({({ project, user, query }) =>paginate(query, (window) => listAgentSchedules(project.id, requireUser(user).id, window)),{- permission: ['ai_agents', 'read'],+ permission: ['agent_schedules', 'read'],query: agentSchedulePageQuery,response: { 200: AgentSchedulePageResponse, ...accessErrors },detail: {@@ -90,7 +90,7 @@ export const agentScheduleRoutes = new Elysia({},{body: createScheduleBody,- permission: ['ai_agents', 'create'],+ permission: ['agent_schedules', 'create'],response: { 201: AgentScheduleResponse, ...commonErrors, ...errors(409) },detail: {summary: 'Create an agent schedule',@@ -150,7 +150,7 @@ export const agentScheduleRoutes = new Elysia({{params: scheduleParams,body: updateScheduleBody,- permission: ['ai_agents', 'edit'],+ permission: ['agent_schedules', 'edit'],response: { 200: AgentScheduleResponse, ...commonErrors, ...errors(409) },detail: {summary: 'Update an agent schedule',@@ -171,7 +171,7 @@ export const agentScheduleRoutes = new Elysia({},{params: scheduleParams,- permission: ['ai_agents', 'delete'],+ permission: ['agent_schedules', 'delete'],response: { 204: t.Void(), ...commonErrors },detail: {summary: 'Delete an agent schedule',@@ -194,7 +194,7 @@ export const agentScheduleRoutes = new Elysia({},{params: scheduleParams,- permission: ['ai_agents', 'edit'],+ permission: ['agent_schedules', 'edit'],response: { 202: QueuedRunResponse, ...commonErrors },detail: {summary: 'Run an agent schedule now',@@ -219,7 +219,7 @@ export const agentScheduleRoutes = new Elysia({},{params: scheduleParams,- permission: ['ai_agents', 'edit'],+ permission: ['agent_schedules', 'edit'],response: { 200: CanceledRunsResponse, ...commonErrors },detail: {summary: 'End the pending runs of an agent schedule',@@ -245,7 +245,7 @@ export const agentScheduleRoutes = new Elysia({},{params: scheduleRunParams,- permission: ['ai_agents', 'edit'],+ permission: ['agent_schedules', 'edit'],response: { 200: CanceledRunsResponse, ...commonErrors },detail: {summary: 'End one pending run of an agent schedule',@@ -263,7 +263,7 @@ export const agentScheduleRoutes = new Elysia({},{params: scheduleParams,- permission: ['ai_agents', 'read'],+ permission: ['agent_schedules', 'read'],response: { 200: ScheduleRunListResponse, ...commonErrors },detail: {summary: 'List agent schedule runs',diff --git a/apps/api/src/modules/roles/__tests__/integration/permission-extensions.test.ts b/apps/api/src/modules/roles/__tests__/integration/permission-extensions.test.tsnew file mode 100644index 00000000..5b4b3d7b--- /dev/null+++ b/apps/api/src/modules/roles/__tests__/integration/permission-extensions.test.ts@@ -0,0 +1,51 @@+import { afterEach, beforeEach, describe, expect, it } from 'bun:test';+import { authedApi, createProject, type Api } from '#tests/helpers/app';+import { signUpTestUser } from '#tests/helpers/auth';+import { resetDb } from '#tests/helpers/db';+import { createRole, listProjectRoles } from '#tests/helpers/roles';+import { setPermissionExtensions } from '#shared/permissions';++type Matrix = Record<string, Record<string, boolean>>;++describe('permission extensions', () => {+ let owner: Api;++ beforeEach(async () => {+ await resetDb();+ owner = authedApi((await signUpTestUser()).cookie);+ await createProject(owner, { key: 'MKT', name: 'Marketing' });+ });++ afterEach(() => setPermissionExtensions());++ it('lists the resource in the catalog with the one it comes from', async () => {+ setPermissionExtensions([{ resource: 'agent_extra', from: 'ai_agents' }]);+ const { data } = await owner['permission-catalog'].get();+ expect(data!.resources.find((one) => one.key === 'agent_extra')).toMatchObject({+ from: 'ai_agents',+ actions: ['create', 'edit', 'read', 'delete'],+ });+ });++ it('reads a role saved before the resource as the one it comes from', async () => {+ const created = await createRole(owner, 'MKT', {+ name: 'Agents',+ permissions: { ai_agents: { read: true } },+ });+ setPermissionExtensions([{ resource: 'agent_extra', from: 'ai_agents' }]);+ const roles = await listProjectRoles(owner, 'MKT');+ const role = roles.data!.find((one) => one.id === created.data!.id)!;+ expect((role.permissions as Matrix).agent_extra.read).toBe(true);+ });++ it('keeps what a role saves of the resource', async () => {+ setPermissionExtensions([{ resource: 'agent_extra', from: 'ai_agents' }]);+ const created = await createRole(owner, 'MKT', {+ name: 'Extra',+ permissions: { agent_extra: { edit: true } },+ });+ const permissions = created.data!.permissions as Matrix;+ expect(permissions.agent_extra.edit).toBe(true);+ expect(permissions.ai_agents.edit).toBe(false);+ });+});diff --git a/apps/api/src/modules/roles/index.ts b/apps/api/src/modules/roles/index.tsindex f1e79020..f3a5bda0 100644--- a/apps/api/src/modules/roles/index.ts+++ b/apps/api/src/modules/roles/index.ts@@ -4,7 +4,12 @@ import { noContent } from '#shared/http';import { guards } from '#shared/guards';import { paginate } from '#shared/pagination';import { HttpError, rethrowDuplicate } from '#shared/lib';-import { PERMISSION_RESOURCES, PERMISSION_ACTIONS, resourceActions } from '#shared/permissions';+import {+ PERMISSION_RESOURCES,+ PERMISSION_ACTIONS,+ extendedFrom,+ resourceActions,+} from '#shared/permissions';import { accessErrors, commonErrors, errors } from '#shared/responses';import {listRoles,@@ -43,7 +48,11 @@ export const roleRoutes = new Elysia({ name: 'roles', detail: { tags: ['Roles'].get('/permission-catalog',() => ({- resources: PERMISSION_RESOURCES.map((key) => ({ key, actions: [...resourceActions(key)] })),+ resources: PERMISSION_RESOURCES.map((key) => ({+ key,+ actions: [...resourceActions(key)],+ from: extendedFrom(key),+ })),actions: [...PERMISSION_ACTIONS],}),{diff --git a/apps/api/src/modules/roles/model.ts b/apps/api/src/modules/roles/model.tsindex 21a3cf59..0a440a5e 100644--- a/apps/api/src/modules/roles/model.ts+++ b/apps/api/src/modules/roles/model.ts@@ -54,6 +54,12 @@ export const RoleUsageResponse = t.Object({export const PermissionCatalogResponse = t.Object({// `actions` is the full action set, in the order a matrix renders its columns;// each resource names the subset it supports.- resources: t.Array(t.Object({ key: t.String(), actions: t.Array(t.String()) })),+ resources: t.Array(+ t.Object({+ key: t.String(),+ actions: t.Array(t.String()),+ from: t.Optional(t.String({ description: 'The resource it was split out of, if any.' })),+ }),+ ),actions: t.Array(t.String()),});diff --git a/apps/api/src/shared/__tests__/unit/permissions.test.ts b/apps/api/src/shared/__tests__/unit/permissions.test.tsindex 520ba01c..62a1717c 100644--- a/apps/api/src/shared/__tests__/unit/permissions.test.ts+++ b/apps/api/src/shared/__tests__/unit/permissions.test.ts@@ -1,11 +1,17 @@-import { describe, it, expect } from 'bun:test';+import { afterEach, describe, it, expect } from 'bun:test';import {+ PERMISSION_RESOURCES,emptyPermissions,fullPermissions,defaultMemberPermissions,+ extendedFrom,hasPermission,normalizePermissions,+ resourceActions,+ setPermissionExtensions,+ type PermissionResource,} from '../../permissions';+import { mergePermissions, readOnlyPermissions, workspaceRoleGrant } from '../../workspace-roles';// Unit test: the permission matrix is a set of pure functions with no session,// no HTTP, and no database, so they are tested directly (no Eden Treaty). This@@ -65,3 +71,66 @@ describe('normalizePermissions', () => {expect(hasPermission(p, 'work_items', 'delete')).toBe(false);});});++describe('setPermissionExtensions', () => {+ const first = 'agent_first' as PermissionResource;+ const second = 'agent_second' as PermissionResource;+ const extend = () =>+ setPermissionExtensions([+ { resource: first, from: 'ai_agents' },+ { resource: second, from: 'ai_agents', actions: ['read'] },+ ]);++ afterEach(() => setPermissionExtensions());++ it('lists the resources after the one they come from, in the order given', () => {+ extend();+ const at = PERMISSION_RESOURCES.indexOf('ai_agents');+ expect(PERMISSION_RESOURCES.slice(at, at + 3)).toEqual(['ai_agents', first, second]);+ expect(extendedFrom(first)).toBe('ai_agents');+ expect(extendedFrom('ai_agents')).toBeUndefined();+ });++ it('takes the actions of the resource it comes from, unless it names its own', () => {+ setPermissionExtensions([{ resource: first, from: 'agent_usage' }]);+ expect(resourceActions(first)).toEqual(['read']);+ extend();+ expect(resourceActions(first)).toEqual(resourceActions('ai_agents'));+ expect(resourceActions(second)).toEqual(['read']);+ expect(fullPermissions()[second]).toEqual({+ create: false,+ edit: false,+ read: true,+ delete: false,+ });+ });++ it('gives a role saved before it what the role holds of its parent, until it is saved', () => {+ extend();+ const saved = { ai_agents: { read: true, edit: true } };+ expect(normalizePermissions(saved)[first]).toMatchObject({ read: true, edit: true });+ expect(normalizePermissions(saved)[second]).toMatchObject({ read: true, edit: false });+ const own = { ...saved, [first]: { read: false } };+ expect(normalizePermissions(own)[first].read).toBe(false);+ });++ it('gives the default role what it holds of the parent', () => {+ extend();+ expect(defaultMemberPermissions()[first]).toEqual(defaultMemberPermissions().ai_agents);+ });++ it('reaches a workspace admin, whose matrix is built when it is read', () => {+ extend();+ const grant = workspaceRoleGrant('admin');+ if (grant === 'owner' || grant === null) throw new Error('admin grants a matrix');+ expect(grant[first].read).toBe(true);+ expect(mergePermissions(grant, readOnlyPermissions())[first].edit).toBe(false);+ });++ it('puts the core matrix back when called with nothing', () => {+ extend();+ setPermissionExtensions();+ expect(PERMISSION_RESOURCES).not.toContain(first);+ expect(extendedFrom(first)).toBeUndefined();+ });+});diff --git a/apps/api/src/shared/permissions.ts b/apps/api/src/shared/permissions.tsindex 2b06e2b1..1ed72def 100644--- a/apps/api/src/shared/permissions.ts+++ b/apps/api/src/shared/permissions.ts@@ -11,12 +11,15 @@ export {normalizePermissions,hasPermission,resourceActions,+ extendedFrom,+ setPermissionExtensions,} from '@repo/db';export type {PermissionResource,PermissionAction,ResourcePermissions,Permissions,+ PermissionExtension,} from '@repo/db';// The matrix as it crosses the API. Kept as an open record rather than a schemadiff --git a/apps/api/src/shared/workspace-roles.ts b/apps/api/src/shared/workspace-roles.tsindex d1b9a47a..c2f23d1a 100644--- a/apps/api/src/shared/workspace-roles.ts+++ b/apps/api/src/shared/workspace-roles.ts@@ -29,9 +29,10 @@ export function readOnlyPermissions(): Permissions {return matrix;}-const grants = new Map<string, WorkspaceGrant>([+// The admin's matrix is built when it is read, so it holds the resources a build adds.+const grants = new Map<string, WorkspaceGrant | (() => Permissions)>([['owner', 'owner'],- ['admin', readOnlyPermissions()],+ ['admin', readOnlyPermissions],]);// Sets what a workspace role grants, or with null that it grants nothing. A build that@@ -42,7 +43,8 @@ export function setWorkspaceRoleGrant(role: string, grant: WorkspaceGrant | null}export function workspaceRoleGrant(role: string): WorkspaceGrant | null {- return grants.get(role) ?? null;+ const grant = grants.get(role) ?? null;+ return typeof grant === 'function' ? grant() : grant;}export function mergePermissions(...matrices: (Permissions | null | undefined)[]): Permissions {diff --git a/apps/web/messages/ar/permissions.json b/apps/web/messages/ar/permissions.jsonindex b350e1b3..3752ae74 100644--- a/apps/web/messages/ar/permissions.json+++ b/apps/web/messages/ar/permissions.json@@ -14,6 +14,7 @@"issue_types": "أنواع المهام","labels": "الوسوم","ai_agents": "وكلاء الذكاء الاصطناعي (AI agents)",+ "agent_schedules": "جدولات الوكلاء (agent schedules)","integrations": "التكاملات (integrations)","agent_skills": "مهارات الوكلاء (agent skills)","agent_tools": "أدوات الوكلاء (agent tools)",diff --git a/apps/web/messages/en/permissions.json b/apps/web/messages/en/permissions.jsonindex bd4c6c4e..292ba948 100644--- a/apps/web/messages/en/permissions.json+++ b/apps/web/messages/en/permissions.json@@ -14,6 +14,7 @@"issue_types": "Issue types","labels": "Labels","ai_agents": "AI agents",+ "agent_schedules": "Agent schedules","integrations": "Integrations","agent_skills": "Agent skills","agent_tools": "Agent tools",diff --git a/apps/web/messages/es-ES/permissions.json b/apps/web/messages/es-ES/permissions.jsonindex 5d2ab060..5c2d0722 100644--- a/apps/web/messages/es-ES/permissions.json+++ b/apps/web/messages/es-ES/permissions.json@@ -14,6 +14,7 @@"issue_types": "Tipos de ticket","labels": "Etiquetas","ai_agents": "Agentes de IA",+ "agent_schedules": "Tareas programadas de agentes","integrations": "Integraciones","agent_skills": "Habilidades del agente","agent_tools": "Herramientas del agente",diff --git a/apps/web/messages/fa/permissions.json b/apps/web/messages/fa/permissions.jsonindex 5e560506..bd170780 100644--- a/apps/web/messages/fa/permissions.json+++ b/apps/web/messages/fa/permissions.json@@ -14,6 +14,7 @@"issue_types": "انواع تسک","labels": "برچسبها","ai_agents": "ایجنتهای AI",+ "agent_schedules": "زمانبندیهای ایجنت","integrations": "یکپارچهسازیها","agent_skills": "مهارتهای ایجنت","agent_tools": "ابزارهای ایجنت",diff --git a/apps/web/messages/fr/permissions.json b/apps/web/messages/fr/permissions.jsonindex bed4ab0e..c87a9c6e 100644--- a/apps/web/messages/fr/permissions.json+++ b/apps/web/messages/fr/permissions.json@@ -14,6 +14,7 @@"issue_types": "Types de tickets","labels": "Étiquettes","ai_agents": "Agents IA",+ "agent_schedules": "Planifications des agents","integrations": "Intégrations","agent_skills": "Compétences des agents","agent_tools": "Outils des agents",diff --git a/apps/web/messages/id/permissions.json b/apps/web/messages/id/permissions.jsonindex 33acefa3..4fe44f32 100644--- a/apps/web/messages/id/permissions.json+++ b/apps/web/messages/id/permissions.json@@ -14,6 +14,7 @@"issue_types": "Jenis issue","labels": "Label","ai_agents": "Agen AI",+ "agent_schedules": "Jadwal agen","integrations": "Integrasi","agent_skills": "Keahlian agen","agent_tools": "Alat agen",diff --git a/apps/web/messages/ko/permissions.json b/apps/web/messages/ko/permissions.jsonindex b5c7d804..b3596434 100644--- a/apps/web/messages/ko/permissions.json+++ b/apps/web/messages/ko/permissions.json@@ -14,6 +14,7 @@"issue_types": "이슈 유형","labels": "라벨","ai_agents": "AI 에이전트",+ "agent_schedules": "AI 에이전트 일정","integrations": "연동","agent_skills": "AI 에이전트 스킬","agent_tools": "AI 에이전트 도구",diff --git a/apps/web/messages/pt-BR/permissions.json b/apps/web/messages/pt-BR/permissions.jsonindex bb6321b6..a3e99c42 100644--- a/apps/web/messages/pt-BR/permissions.json+++ b/apps/web/messages/pt-BR/permissions.json@@ -14,6 +14,7 @@"issue_types": "Tipos de issue","labels": "Etiquetas","ai_agents": "Agentes de IA",+ "agent_schedules": "Agendamentos de agentes","integrations": "Integrações","agent_skills": "Habilidades de agente","agent_tools": "Ferramentas de agente",diff --git a/apps/web/messages/ru/permissions.json b/apps/web/messages/ru/permissions.jsonindex 1e7c045d..17fac57c 100644--- a/apps/web/messages/ru/permissions.json+++ b/apps/web/messages/ru/permissions.json@@ -14,6 +14,7 @@"issue_types": "Типы задач","labels": "Метки","ai_agents": "AI-агенты",+ "agent_schedules": "Расписания агентов","integrations": "Интеграции","agent_skills": "Навыки агентов","agent_tools": "Инструменты агентов",diff --git a/apps/web/messages/tr/permissions.json b/apps/web/messages/tr/permissions.jsonindex f68e110b..3413db60 100644--- a/apps/web/messages/tr/permissions.json+++ b/apps/web/messages/tr/permissions.json@@ -14,6 +14,7 @@"issue_types": "İş türleri","labels": "Etiketler","ai_agents": "Yapay zekâ ajanları",+ "agent_schedules": "Ajan zamanlamaları","integrations": "Entegrasyonlar","agent_skills": "Ajan yetenekleri","agent_tools": "Ajan araçları",diff --git a/apps/web/messages/uk/permissions.json b/apps/web/messages/uk/permissions.jsonindex 8dbfd35e..79d81f41 100644--- a/apps/web/messages/uk/permissions.json+++ b/apps/web/messages/uk/permissions.json@@ -14,6 +14,7 @@"issue_types": "Типи задач","labels": "Мітки","ai_agents": "AI-агенти",+ "agent_schedules": "Розклади агентів","integrations": "Інтеграції","agent_skills": "Навички агентів","agent_tools": "Інструменти агентів",diff --git a/apps/web/messages/zh-CN/permissions.json b/apps/web/messages/zh-CN/permissions.jsonindex de5c9526..2ed795d2 100644--- a/apps/web/messages/zh-CN/permissions.json+++ b/apps/web/messages/zh-CN/permissions.json@@ -14,6 +14,7 @@"issue_types": "工作项类型","labels": "标签","ai_agents": "AI 代理",+ "agent_schedules": "代理定时任务","integrations": "集成","agent_skills": "代理技能","agent_tools": "代理工具",diff --git a/apps/web/messages/zh-TW/permissions.json b/apps/web/messages/zh-TW/permissions.jsonindex e036375a..a8446bc9 100644--- a/apps/web/messages/zh-TW/permissions.json+++ b/apps/web/messages/zh-TW/permissions.json@@ -14,6 +14,7 @@"issue_types": "工作項目類型","labels": "標籤","ai_agents": "AI 代理",+ "agent_schedules": "代理排程","integrations": "整合","agent_skills": "代理技能","agent_tools": "代理工具",diff --git a/apps/web/src/components/common/permissions/PermissionMatrix.tsx b/apps/web/src/components/common/permissions/PermissionMatrix.tsxindex de7e29d0..7f758ad0 100644--- a/apps/web/src/components/common/permissions/PermissionMatrix.tsx+++ b/apps/web/src/components/common/permissions/PermissionMatrix.tsx@@ -21,7 +21,11 @@ export default function PermissionMatrix({const { actionLabel, resourceLabel, groupLabel } = usePermissionLabels();const supports = useMemo(() => catalogSupport(catalog), [catalog]);const groups = useMemo(- () => groupResources(catalog.resources.map((r) => r.key)),+ () =>+ groupResources(+ catalog.resources.map((r) => r.key),+ catalog.resources,+ ),[catalog.resources],);const actions = useMemo(() => orderActions(catalog.actions), [catalog.actions]);diff --git a/apps/web/src/components/common/permissions/PermissionsPopover.tsx b/apps/web/src/components/common/permissions/PermissionsPopover.tsxindex 750ec996..63500ff7 100644--- a/apps/web/src/components/common/permissions/PermissionsPopover.tsx+++ b/apps/web/src/components/common/permissions/PermissionsPopover.tsx@@ -6,6 +6,7 @@ import { useTranslations } from 'next-intl';import type { PermissionResource, Permissions } from '@/lib/api/endpoints/roles';import { ACTION_ORDER, groupResources } from '@/utils/permissions';import { usePermissionLabels } from '@/hooks/usePermissionLabels';+import { usePermissionCatalogQuery } from '@/services/roles.service';import { Button } from '@/components/ui/button';import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';@@ -20,6 +21,7 @@ export function PermissionsPopover({}) {const t = useTranslations('permissions');const { actionLabel, resourceLabel, groupLabel } = usePermissionLabels();+ const catalog = usePermissionCatalogQuery().data;const resources = Object.keys(permissions) as PermissionResource[];const total = resources.reduce((sum, r) => sum + ACTION_ORDER.filter((a) => permissions[r]?.[a]).length,@@ -28,7 +30,7 @@ export function PermissionsPopover({if (total === 0) return <span className="text-xs text-muted-foreground">{t('none')}</span>;- const groups = groupResources(resources);+ const groups = groupResources(resources, catalog?.resources);const triggerLabel = label ?? t('grantedCount', { count: total });return (diff --git a/apps/web/src/components/common/permissions/RoleEditorPanel.tsx b/apps/web/src/components/common/permissions/RoleEditorPanel.tsxindex db3c5907..6033bfc2 100644--- a/apps/web/src/components/common/permissions/RoleEditorPanel.tsx+++ b/apps/web/src/components/common/permissions/RoleEditorPanel.tsx@@ -58,7 +58,10 @@ export default function RoleEditorPanel({const supports = useMemo(() => catalogSupport(catalog), [catalog]);const resourceKeys = useMemo(() => catalog.resources.map((r) => r.key), [catalog.resources]);- const groups = useMemo(() => groupResources(resourceKeys), [resourceKeys]);+ const groups = useMemo(+ () => groupResources(resourceKeys, catalog.resources),+ [resourceKeys, catalog.resources],+ );const actions = useMemo(() => orderActions(catalog.actions), [catalog.actions]);// Set `value` on every supported (resource, action) pair in the given sets.diff --git a/apps/web/src/features/settings/SettingsSchedulesPage.tsx b/apps/web/src/features/settings/SettingsSchedulesPage.tsxindex c8bda990..0e374277 100644--- a/apps/web/src/features/settings/SettingsSchedulesPage.tsx+++ b/apps/web/src/features/settings/SettingsSchedulesPage.tsx@@ -6,7 +6,7 @@ import { settingsSection } from '@/utils/settingsSections';import { useSettingsSectionText } from '@/hooks/useSectionLabels';import SectionPageView from '@/components/common/page/SectionPageView';import RequirePermission from '@/components/common/permissions/RequirePermission';-import { useProjectAgents } from '@/hooks/useProjectAgents';+import { useAgentDirectory } from '@/hooks/useProjectAgents';import { SettingsResourceProvider } from './context/settingsPermission';import { SettingsHeaderAddButton } from './components/crud/SettingsHeaderAddButton';import SettingsSchedules from './components/schedules/SettingsSchedules';@@ -21,7 +21,7 @@ export default function SettingsSchedulesPage() {const sectionText = useSettingsSectionText()(section.slug);const { project } = useShell();const [addNew, setAddNew] = useState(false);- const agents = useProjectAgents().data ?? [];+ const agents = useAgentDirectory().data ?? [];if (!project) return null;return (<SectionPageViewdiff --git a/apps/web/src/features/settings/components/schedules/SettingsScheduleDialog.tsx b/apps/web/src/features/settings/components/schedules/SettingsScheduleDialog.tsxindex 4b62cea7..86d272a3 100644--- a/apps/web/src/features/settings/components/schedules/SettingsScheduleDialog.tsx+++ b/apps/web/src/features/settings/components/schedules/SettingsScheduleDialog.tsx@@ -1,5 +1,5 @@import { useState } from 'react';-import type { AiAgent } from '@/lib/api/endpoints/agents';+import type { ProjectAgent } from '@/lib/api/endpoints/agents';import type { Column } from '@/lib/api/endpoints/columns';import type {AgentSchedule,@@ -36,7 +36,7 @@ export function SettingsScheduleDialog({onClose,}: {projectKey: string;- agents: AiAgent[];+ agents: ProjectAgent[];columns: Column[];initial?: AgentSchedule;saving: boolean;@@ -139,8 +139,8 @@ export function SettingsScheduleDialog({</SettingsScheduleField></div>- {selectedAgent?.kind === 'external' && !selectedAgent.invocationUrl && (- <SettingsScheduleRunnerHint agent={selectedAgent} />+ {selectedAgent?.kind === 'external' && (+ <SettingsScheduleRunnerHint agentId={selectedAgent.id} />)}{!initial && <SettingsScheduleTypeField value={type} onChange={setType} />}diff --git a/apps/web/src/features/settings/components/schedules/SettingsScheduleRunnerHint.tsx b/apps/web/src/features/settings/components/schedules/SettingsScheduleRunnerHint.tsxindex ebc3b5ee..01069539 100644--- a/apps/web/src/features/settings/components/schedules/SettingsScheduleRunnerHint.tsx+++ b/apps/web/src/features/settings/components/schedules/SettingsScheduleRunnerHint.tsx@@ -1,10 +1,17 @@import { Terminal } from 'lucide-react';-import type { AiAgent } from '@/lib/api/endpoints/agents';import { AgentRunnerStatus } from '@/components/common/agent-chat/AgentRunnerStatus';+import { usePermissions } from '@/hooks/usePermissions';+import { useProjectAgents } from '@/hooks/useProjectAgents';import { useTranslations } from 'next-intl';-export function SettingsScheduleRunnerHint({ agent }: { agent: AiAgent }) {+// The state of an external agent's runner is part of its configuration, so only a reader of+// the agents gets it.+export function SettingsScheduleRunnerHint({ agentId }: { agentId: number }) {const t = useTranslations('settings.schedules');+ const { can } = usePermissions();+ const agents = useProjectAgents(can('ai_agents', 'read'));+ const agent = agents.data?.find((one) => one.id === agentId);+ if (!agent || agent.invocationUrl) return null;return (<div className="flex items-start gap-2.5 rounded-md border border-border/60 bg-muted/30 px-3 py-2.5"><Terminal className="mt-0.5 size-4 shrink-0 text-muted-foreground" />diff --git a/apps/web/src/features/settings/components/schedules/SettingsSchedules.tsx b/apps/web/src/features/settings/components/schedules/SettingsSchedules.tsxindex da851fd1..94d92322 100644--- a/apps/web/src/features/settings/components/schedules/SettingsSchedules.tsx+++ b/apps/web/src/features/settings/components/schedules/SettingsSchedules.tsx@@ -17,7 +17,7 @@ import {useRunAgentSchedule,useUpdateAgentSchedule,} from '@/services/agentSchedules.service';-import { useProjectAgents } from '@/hooks/useProjectAgents';+import { useAgentDirectory } from '@/hooks/useProjectAgents';import { useSettingsCan } from '../../context/settingsPermission';import SettingsConfirmDeleteDialog from '../crud/SettingsConfirmDeleteDialog';import { SettingsScheduleRunsSheet } from './SettingsScheduleRunsSheet';@@ -38,7 +38,7 @@ export default function SettingsSchedules({const can = useSettingsCan();const paging = usePaging();const schedulesQuery = useAgentSchedules(projectKey, paging.params);- const agentsQuery = useProjectAgents();+ const agentsQuery = useAgentDirectory();const schedules = schedulesQuery.data?.items ?? [];const total = schedulesQuery.data?.total ?? 0;const agents = agentsQuery.data ?? [];diff --git a/apps/web/src/hooks/useProjectAgents.ts b/apps/web/src/hooks/useProjectAgents.tsindex c7594c4a..5b368723 100644--- a/apps/web/src/hooks/useProjectAgents.ts+++ b/apps/web/src/hooks/useProjectAgents.ts@@ -2,13 +2,19 @@import { useContext } from 'react';import { ShellCtx } from '@/context/shellContext';-import { useAiAgentsQuery } from '@/services/aiAgents.service';+import { useAgentDirectoryQuery, useAiAgentsQuery } from '@/services/aiAgents.service';// The agents working in the open project. An agent belongs to a team and reaches the// projects it is attached to, so the list is read from that team and narrowed to this// project — the screens inside a project (its chat panel, its schedules, its read-only// agent list) all want exactly those.-export function useProjectAgents() {+export function useProjectAgents(enabled = true) {const project = useContext(ShellCtx)?.project?.project ?? null;- return useAiAgentsQuery(project?.teamId ?? null, project?.id);+ return useAiAgentsQuery(enabled ? (project?.teamId ?? null) : null, project?.id);+}++// The agents of the open project by name, kind and model, for a screen that only picks or+// names one. Any member reads it, without the `ai_agents` permission useProjectAgents needs.+export function useAgentDirectory() {+ return useAgentDirectoryQuery(useContext(ShellCtx)?.project?.project ?? null);}diff --git a/apps/web/src/lib/api/endpoints/agents.ts b/apps/web/src/lib/api/endpoints/agents.tsindex 7741156b..1bf739e3 100644--- a/apps/web/src/lib/api/endpoints/agents.ts+++ b/apps/web/src/lib/api/endpoints/agents.ts@@ -207,6 +207,12 @@ export const listAiAgents = (teamId: number, projectId?: number) =>`/teams/${teamId}/ai-agents${projectId != null ? `?projectId=${projectId}` : ''}`,);+// What a screen needs to name an agent; any member of the project reads it.+export type ProjectAgent = Pick<AiAgent, 'id' | 'name' | 'kind' | 'model'>;++export const listProjectAgents = (projectKey: string) =>+ request<ProjectAgent[]>(`/projects/${projectKey}/ai-agents/options`);+export const listAgentTools = (teamId: number) =>request<AgentTool[]>(`/teams/${teamId}/ai-agents/tools`);diff --git a/apps/web/src/lib/api/endpoints/roles.ts b/apps/web/src/lib/api/endpoints/roles.tsindex 6a50d54a..09545432 100644--- a/apps/web/src/lib/api/endpoints/roles.ts+++ b/apps/web/src/lib/api/endpoints/roles.ts@@ -18,6 +18,7 @@ export type PermissionResource =| 'issue_types'| 'labels'| 'ai_agents'+ | 'agent_schedules'| 'integrations'| 'agent_skills'| 'agent_tools'@@ -70,6 +71,7 @@ export interface RoleUsage {export interface PermissionCatalogResource {key: PermissionResource;actions: PermissionAction[];+ from?: PermissionResource;}export interface PermissionCatalog {diff --git a/apps/web/src/services/agentSchedules.service.ts b/apps/web/src/services/agentSchedules.service.tsindex ce712aa3..e5427a55 100644--- a/apps/web/src/services/agentSchedules.service.ts+++ b/apps/web/src/services/agentSchedules.service.ts@@ -11,6 +11,7 @@ import {import type { PageParams } from '@/lib/api/core/paging';import { qk } from '@/services/queryKeys';import { useLiveRefresh } from '@/hooks/useLiveRefresh';+import { usePermissions } from '@/hooks/usePermissions';import { revScope } from '@/utils/revScopes';// One page of the project's schedules. A page with a run still going is polled, so the@@ -27,15 +28,21 @@ export function useAgentSchedules(projectKey: string, params: PageParams) {});}+// The runner queue's marker names the agents and their runners, so it goes to readers of the+// agents only. Anyone else polls.export function useAgentScheduleRuns(projectKey: string, scheduleId: number | null) {+ const { can } = usePermissions();+ const readsAgents = can('ai_agents', 'read');useLiveRefresh({scope: scheduleId == null ? null : revScope.runnerQueue,targets: [qk.agentScheduleRuns(projectKey, scheduleId ?? 0)],+ enabled: readsAgents,});return useQuery({queryKey: qk.agentScheduleRuns(projectKey, scheduleId ?? 0),queryFn: () => listAgentScheduleRuns(projectKey, scheduleId!),enabled: scheduleId != null,+ refetchInterval: readsAgents ? false : 5_000,});}diff --git a/apps/web/src/services/aiAgents.service.ts b/apps/web/src/services/aiAgents.service.tsindex d535fb30..055486ba 100644--- a/apps/web/src/services/aiAgents.service.ts+++ b/apps/web/src/services/aiAgents.service.ts@@ -25,6 +25,7 @@ import {} from '@/lib/api/endpoints/agentChat';import {listAiAgents,+ listProjectAgents,listAgentRuns,listAgentTools,createAiAgent,@@ -52,6 +53,16 @@ export function useAiAgentsQuery(teamId: number | null, projectId?: number) {});}+export function useAgentDirectoryQuery(+ project: { id: number; ref: string; teamId: number } | null,+) {+ return useQuery({+ queryKey: qk.agentDirectory(project?.teamId ?? 0, project?.id ?? 0),+ queryFn: () => listProjectAgents(project!.ref),+ enabled: project != null,+ });+}+// An agent's triggered run history for the runs sidebar, paginated 25 at a time. Only// fetched when agentId is set, so the query runs when the sidebar opens.export function useAgentRuns(teamId: number | null, agentId: number | null) {diff --git a/apps/web/src/services/queryKeys.ts b/apps/web/src/services/queryKeys.tsindex 9036b277..52e6defd 100644--- a/apps/web/src/services/queryKeys.ts+++ b/apps/web/src/services/queryKeys.ts@@ -199,6 +199,8 @@ export const qk = {// API, so it hangs off the same key with a 'tools' tail.aiAgents: (teamId: number, projectId?: number) =>['aiAgents', teamId, projectId ?? 'all'] as const,+ agentDirectory: (teamId: number, projectId: number) =>+ ['aiAgents', teamId, projectId, 'directory'] as const,anyAiAgents: ['aiAgents'] as const,teamAiAgents: (teamId: number) => ['aiAgents', teamId] as const,agentTools: (teamId: number) => ['aiAgents', teamId, 'tools'] as const,diff --git a/apps/web/src/utils/permissions.test.ts b/apps/web/src/utils/permissions.test.tsnew file mode 100644index 00000000..bca8a0c2--- /dev/null+++ b/apps/web/src/utils/permissions.test.ts@@ -0,0 +1,54 @@+import assert from 'node:assert/strict';+import { describe, it } from 'node:test';+import type {+ PermissionCatalog,+ PermissionCatalogResource,+ PermissionResource,+} from '@/lib/api/endpoints/roles';+import { groupResources, matrixFromCatalog } from './permissions';++const added = 'agent_added' as PermissionResource;+const loose = 'agent_loose' as PermissionResource;++describe('groupResources', () => {+ it('puts a resource after the one it was split out of', () => {+ const catalog: PermissionCatalogResource[] = [+ { key: 'ai_agents', actions: ['read'] },+ { key: added, actions: ['read'], from: 'ai_agents' },+ { key: 'integrations', actions: ['read'] },+ ];+ const groups = groupResources(+ catalog.map((one) => one.key),+ catalog,+ );+ assert.deepEqual(groups, [{ key: 'ai', resources: ['ai_agents', added, 'integrations'] }]);+ });++ it('leaves a resource no group knows in Other', () => {+ assert.deepEqual(groupResources([loose]), [{ key: 'other', resources: [loose] }]);+ });+});++describe('matrixFromCatalog', () => {+ const catalog = {+ resources: [+ { key: 'ai_agents', actions: ['read', 'edit'] },+ { key: added, actions: ['read', 'edit'], from: 'ai_agents' },+ ],+ actions: ['read', 'edit'],+ } as PermissionCatalog;++ it('reads a role saved before a resource as the one it was split out of', () => {+ const matrix = matrixFromCatalog(catalog, { ai_agents: { read: true } });+ assert.equal(matrix[added].read, true);+ assert.equal(matrix[added].edit, false);+ });++ it('keeps what the role saved of the resource', () => {+ const matrix = matrixFromCatalog(catalog, {+ ai_agents: { read: true },+ [added]: { read: false },+ });+ assert.equal(matrix[added].read, false);+ });+});diff --git a/apps/web/src/utils/permissions.ts b/apps/web/src/utils/permissions.tsindex ccf582d4..6ad4ef72 100644--- a/apps/web/src/utils/permissions.ts+++ b/apps/web/src/utils/permissions.ts@@ -1,6 +1,7 @@import type {PermissionAction,PermissionCatalog,+ PermissionCatalogResource,PermissionResource,Permissions,} from '@/lib/api/endpoints/roles';@@ -35,9 +36,10 @@ export function matrixFromCatalog(catalog: PermissionCatalog, source: unknown):>;const out = {} as Permissions;for (const resource of catalog.resources) {+ const entry = src[resource.key] ?? (resource.from && src[resource.from]);const row = {} as Record<PermissionAction, boolean>;for (const action of catalog.actions) {- row[action] = resource.actions.includes(action) && src[resource.key]?.[action] === true;+ row[action] = resource.actions.includes(action) && entry?.[action] === true;}out[resource.key] = row;}@@ -86,7 +88,14 @@ const GROUP_DEFS: PermissionGroup[] = [{ key: 'notes', resources: ['note_boards'] },{key: 'ai',- resources: ['ai_agents', 'integrations', 'agent_skills', 'agent_tools', 'agent_usage'],+ resources: [+ 'ai_agents',+ 'agent_schedules',+ 'integrations',+ 'agent_skills',+ 'agent_tools',+ 'agent_usage',+ ],},{key: 'configuration',@@ -106,17 +115,23 @@ const GROUP_DEFS: PermissionGroup[] = [{ key: 'project', resources: ['danger_zone'] },];-// Order the catalog's resources into display groups. A resource not covered by-// GROUP_DEFS (e.g. one added on the API) falls into a trailing "Other" group, so-// nothing silently disappears from the editor.-export function groupResources(resources: PermissionResource[]): PermissionGroup[] {+// Order the catalog's resources into display groups. A resource split out of another+// sits right after it. Any other resource not covered by GROUP_DEFS (e.g. one added on+// the API) falls into a trailing "Other" group, so nothing silently disappears from the+// editor.+export function groupResources(+ resources: PermissionResource[],+ catalog: PermissionCatalogResource[] = [],+): PermissionGroup[] {const present = new Set(resources);- const known = new Set(GROUP_DEFS.flatMap((g) => g.resources));const groups = GROUP_DEFS.map((g) => ({key: g.key,- resources: g.resources.filter((r) => present.has(r)),+ resources: g.resources+ .flatMap((r) => [r, ...catalog.filter((one) => one.from === r).map((one) => one.key)])+ .filter((r) => present.has(r)),})).filter((g) => g.resources.length > 0);- const other = resources.filter((r) => !known.has(r));+ const placed = new Set(groups.flatMap((g) => g.resources));+ const other = resources.filter((r) => !placed.has(r));if (other.length) groups.push({ key: 'other', resources: other });return groups;}diff --git a/apps/web/src/utils/settingsSections.ts b/apps/web/src/utils/settingsSections.tsindex 708a6fb2..2f8fa16e 100644--- a/apps/web/src/utils/settingsSections.ts+++ b/apps/web/src/utils/settingsSections.ts@@ -98,7 +98,7 @@ export const SETTINGS_SECTIONS: SettingsSection[] = [{slug: 'schedules',icon: Clock3,- resource: 'ai_agents',+ resource: 'agent_schedules',group: 'ai-team',},{diff --git a/packages/db/drizzle/0174_agent_schedules_permission.sql b/packages/db/drizzle/0174_agent_schedules_permission.sqlnew file mode 100644index 00000000..8c0bcb51--- /dev/null+++ b/packages/db/drizzle/0174_agent_schedules_permission.sql@@ -0,0 +1,5 @@+-- Schedules get a resource of their own. Every role keeps what it could do with them: it+-- holds in agent_schedules exactly what it holds in ai_agents.+UPDATE "team_role"+ SET "permissions" = jsonb_set("permissions", '{agent_schedules}', "permissions" -> 'ai_agents')+ WHERE "permissions" -> 'ai_agents' IS NOT NULL;diff --git a/packages/db/drizzle/meta/0174_snapshot.json b/packages/db/drizzle/meta/0174_snapshot.jsonnew file mode 100644index 00000000..0f482f19--- /dev/null+++ b/packages/db/drizzle/meta/0174_snapshot.json@@ -0,0 +1,13121 @@+{+ "id": "4cf98670-cd5f-426f-958b-f467ce4d6eb2",+ "prevId": "3dec5873-79d6-437e-8e01-6cfc581b1999",+ "version": "7",+ "dialect": "postgresql",+ "tables": {+ "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",+ "primaryKey": false,+ "notNull": false+ },+ "refresh_token_expires_at": {+ "name": "refresh_token_expires_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "scope": {+ "name": "scope",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "password": {+ "name": "password",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "account_userId_idx": {+ "name": "account_userId_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "account_user_id_user_id_fk": {+ "name": "account_user_id_user_id_fk",+ "tableFrom": "account",+ "columnsFrom": [+ "user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.apikey": {+ "name": "apikey",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "config_id": {+ "name": "config_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'default'"+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "start": {+ "name": "start",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "reference_id": {+ "name": "reference_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "prefix": {+ "name": "prefix",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "refill_interval": {+ "name": "refill_interval",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "refill_amount": {+ "name": "refill_amount",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "last_refill_at": {+ "name": "last_refill_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ },+ "rate_limit_enabled": {+ "name": "rate_limit_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ },+ "rate_limit_time_window": {+ "name": "rate_limit_time_window",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "default": 1000+ },+ "rate_limit_max": {+ "name": "rate_limit_max",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "default": 100+ },+ "request_count": {+ "name": "request_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "default": 0+ },+ "remaining": {+ "name": "remaining",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "last_request": {+ "name": "last_request",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "permissions": {+ "name": "permissions",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "apikey_configId_idx": {+ "name": "apikey_configId_idx",+ "columns": [+ {+ "expression": "config_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "apikey_referenceId_idx": {+ "name": "apikey_referenceId_idx",+ "columns": [+ {+ "expression": "reference_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "apikey_key_idx": {+ "name": "apikey_key_idx",+ "columns": [+ {+ "expression": "key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.jwks": {+ "name": "jwks",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "public_key": {+ "name": "public_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "private_key": {+ "name": "private_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "alg": {+ "name": "alg",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "crv": {+ "name": "crv",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.oauth_access_token": {+ "name": "oauth_access_token",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "token": {+ "name": "token",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "session_id": {+ "name": "session_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "reference_id": {+ "name": "reference_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "authorization_code_id": {+ "name": "authorization_code_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "resources": {+ "name": "resources",+ "type": "text[]",+ "primaryKey": false,+ "notNull": false+ },+ "requested_user_info_claims": {+ "name": "requested_user_info_claims",+ "type": "text[]",+ "primaryKey": false,+ "notNull": false+ },+ "refresh_id": {+ "name": "refresh_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "revoked": {+ "name": "revoked",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "confirmation": {+ "name": "confirmation",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "scopes": {+ "name": "scopes",+ "type": "text[]",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "oauthAccessToken_clientId_idx": {+ "name": "oauthAccessToken_clientId_idx",+ "columns": [+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "oauthAccessToken_sessionId_idx": {+ "name": "oauthAccessToken_sessionId_idx",+ "columns": [+ {+ "expression": "session_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "oauthAccessToken_userId_idx": {+ "name": "oauthAccessToken_userId_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "oauthAccessToken_authorizationCodeId_idx": {+ "name": "oauthAccessToken_authorizationCodeId_idx",+ "columns": [+ {+ "expression": "authorization_code_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "oauthAccessToken_refreshId_idx": {+ "name": "oauthAccessToken_refreshId_idx",+ "columns": [+ {+ "expression": "refresh_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "oauth_access_token_client_id_oauth_client_client_id_fk": {+ "name": "oauth_access_token_client_id_oauth_client_client_id_fk",+ "tableFrom": "oauth_access_token",+ "columnsFrom": [+ "client_id"+ ],+ "tableTo": "oauth_client",+ "columnsTo": [+ "client_id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "oauth_access_token_session_id_session_id_fk": {+ "name": "oauth_access_token_session_id_session_id_fk",+ "tableFrom": "oauth_access_token",+ "columnsFrom": [+ "session_id"+ ],+ "tableTo": "session",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "oauth_access_token_user_id_user_id_fk": {+ "name": "oauth_access_token_user_id_user_id_fk",+ "tableFrom": "oauth_access_token",+ "columnsFrom": [+ "user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "oauth_access_token_refresh_id_oauth_refresh_token_id_fk": {+ "name": "oauth_access_token_refresh_id_oauth_refresh_token_id_fk",+ "tableFrom": "oauth_access_token",+ "columnsFrom": [+ "refresh_id"+ ],+ "tableTo": "oauth_refresh_token",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "oauth_access_token_token_unique": {+ "name": "oauth_access_token_token_unique",+ "columns": [+ "token"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.oauth_client": {+ "name": "oauth_client",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "client_secret": {+ "name": "client_secret",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "client_discovery_id": {+ "name": "client_discovery_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "disabled": {+ "name": "disabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "skip_consent": {+ "name": "skip_consent",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false+ },+ "enable_end_session": {+ "name": "enable_end_session",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false+ },+ "subject_type": {+ "name": "subject_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "scopes": {+ "name": "scopes",+ "type": "text[]",+ "primaryKey": false,+ "notNull": false+ },+ "client_credentials_scopes": {+ "name": "client_credentials_scopes",+ "type": "text[]",+ "primaryKey": false,+ "notNull": false,+ "default": "'{}'"+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "uri": {+ "name": "uri",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "icon": {+ "name": "icon",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "contacts": {+ "name": "contacts",+ "type": "text[]",+ "primaryKey": false,+ "notNull": false+ },+ "tos": {+ "name": "tos",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "policy": {+ "name": "policy",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "software_id": {+ "name": "software_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "software_version": {+ "name": "software_version",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "software_statement": {+ "name": "software_statement",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "redirect_uris": {+ "name": "redirect_uris",+ "type": "text[]",+ "primaryKey": false,+ "notNull": true+ },+ "post_logout_redirect_uris": {+ "name": "post_logout_redirect_uris",+ "type": "text[]",+ "primaryKey": false,+ "notNull": false+ },+ "backchannel_logout_uri": {+ "name": "backchannel_logout_uri",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "backchannel_logout_session_required": {+ "name": "backchannel_logout_session_required",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false+ },+ "token_endpoint_auth_method": {+ "name": "token_endpoint_auth_method",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "application_type": {+ "name": "application_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "jwks": {+ "name": "jwks",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "jwks_uri": {+ "name": "jwks_uri",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "grant_types": {+ "name": "grant_types",+ "type": "text[]",+ "primaryKey": false,+ "notNull": false+ },+ "response_types": {+ "name": "response_types",+ "type": "text[]",+ "primaryKey": false,+ "notNull": false+ },+ "require_pkce": {+ "name": "require_pkce",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false+ },+ "dpop_bound_access_tokens": {+ "name": "dpop_bound_access_tokens",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "reference_id": {+ "name": "reference_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "oauthClient_userId_idx": {+ "name": "oauthClient_userId_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "oauth_client_user_id_user_id_fk": {+ "name": "oauth_client_user_id_user_id_fk",+ "tableFrom": "oauth_client",+ "columnsFrom": [+ "user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "oauth_client_client_id_unique": {+ "name": "oauth_client_client_id_unique",+ "columns": [+ "client_id"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.oauth_client_assertion": {+ "name": "oauth_client_assertion",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.oauth_client_resource": {+ "name": "oauth_client_resource",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "resource_id": {+ "name": "resource_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "oauthClientResource_clientId_resourceId_uidx": {+ "name": "oauthClientResource_clientId_resourceId_uidx",+ "columns": [+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "resource_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "oauthClientResource_clientId_idx": {+ "name": "oauthClientResource_clientId_idx",+ "columns": [+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "oauthClientResource_resourceId_idx": {+ "name": "oauthClientResource_resourceId_idx",+ "columns": [+ {+ "expression": "resource_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "oauth_client_resource_client_id_oauth_client_client_id_fk": {+ "name": "oauth_client_resource_client_id_oauth_client_client_id_fk",+ "tableFrom": "oauth_client_resource",+ "columnsFrom": [+ "client_id"+ ],+ "tableTo": "oauth_client",+ "columnsTo": [+ "client_id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "oauth_client_resource_resource_id_oauth_resource_identifier_fk": {+ "name": "oauth_client_resource_resource_id_oauth_resource_identifier_fk",+ "tableFrom": "oauth_client_resource",+ "columnsFrom": [+ "resource_id"+ ],+ "tableTo": "oauth_resource",+ "columnsTo": [+ "identifier"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.oauth_consent": {+ "name": "oauth_consent",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "reference_id": {+ "name": "reference_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "resources": {+ "name": "resources",+ "type": "text[]",+ "primaryKey": false,+ "notNull": false+ },+ "requested_user_info_claims": {+ "name": "requested_user_info_claims",+ "type": "text[]",+ "primaryKey": false,+ "notNull": false+ },+ "scopes": {+ "name": "scopes",+ "type": "text[]",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "oauthConsent_clientId_idx": {+ "name": "oauthConsent_clientId_idx",+ "columns": [+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "oauthConsent_userId_idx": {+ "name": "oauthConsent_userId_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "oauth_consent_client_id_oauth_client_client_id_fk": {+ "name": "oauth_consent_client_id_oauth_client_client_id_fk",+ "tableFrom": "oauth_consent",+ "columnsFrom": [+ "client_id"+ ],+ "tableTo": "oauth_client",+ "columnsTo": [+ "client_id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "oauth_consent_user_id_user_id_fk": {+ "name": "oauth_consent_user_id_user_id_fk",+ "tableFrom": "oauth_consent",+ "columnsFrom": [+ "user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.oauth_refresh_token": {+ "name": "oauth_refresh_token",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "token": {+ "name": "token",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "session_id": {+ "name": "session_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "reference_id": {+ "name": "reference_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "authorization_code_id": {+ "name": "authorization_code_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "resources": {+ "name": "resources",+ "type": "text[]",+ "primaryKey": false,+ "notNull": false+ },+ "requested_user_info_claims": {+ "name": "requested_user_info_claims",+ "type": "text[]",+ "primaryKey": false,+ "notNull": false+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "revoked": {+ "name": "revoked",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "rotated_at": {+ "name": "rotated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "rotation_replay_response": {+ "name": "rotation_replay_response",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "rotation_replay_expires_at": {+ "name": "rotation_replay_expires_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "auth_time": {+ "name": "auth_time",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "confirmation": {+ "name": "confirmation",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "scopes": {+ "name": "scopes",+ "type": "text[]",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "oauthRefreshToken_clientId_idx": {+ "name": "oauthRefreshToken_clientId_idx",+ "columns": [+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "oauthRefreshToken_sessionId_idx": {+ "name": "oauthRefreshToken_sessionId_idx",+ "columns": [+ {+ "expression": "session_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "oauthRefreshToken_userId_idx": {+ "name": "oauthRefreshToken_userId_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "oauthRefreshToken_authorizationCodeId_idx": {+ "name": "oauthRefreshToken_authorizationCodeId_idx",+ "columns": [+ {+ "expression": "authorization_code_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "oauth_refresh_token_client_id_oauth_client_client_id_fk": {+ "name": "oauth_refresh_token_client_id_oauth_client_client_id_fk",+ "tableFrom": "oauth_refresh_token",+ "columnsFrom": [+ "client_id"+ ],+ "tableTo": "oauth_client",+ "columnsTo": [+ "client_id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "oauth_refresh_token_session_id_session_id_fk": {+ "name": "oauth_refresh_token_session_id_session_id_fk",+ "tableFrom": "oauth_refresh_token",+ "columnsFrom": [+ "session_id"+ ],+ "tableTo": "session",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "oauth_refresh_token_user_id_user_id_fk": {+ "name": "oauth_refresh_token_user_id_user_id_fk",+ "tableFrom": "oauth_refresh_token",+ "columnsFrom": [+ "user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "oauth_refresh_token_token_unique": {+ "name": "oauth_refresh_token_token_unique",+ "columns": [+ "token"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.oauth_resource": {+ "name": "oauth_resource",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "identifier": {+ "name": "identifier",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "access_token_ttl": {+ "name": "access_token_ttl",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "refresh_token_ttl": {+ "name": "refresh_token_ttl",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "signing_algorithm": {+ "name": "signing_algorithm",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "signing_key_id": {+ "name": "signing_key_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "allowed_scopes": {+ "name": "allowed_scopes",+ "type": "text[]",+ "primaryKey": false,+ "notNull": false+ },+ "custom_claims": {+ "name": "custom_claims",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "dpop_bound_access_tokens_required": {+ "name": "dpop_bound_access_tokens_required",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "disabled": {+ "name": "disabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "policy_version": {+ "name": "policy_version",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "default": 1+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "oauth_resource_identifier_unique": {+ "name": "oauth_resource_identifier_unique",+ "columns": [+ "identifier"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.passkey": {+ "name": "passkey",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "public_key": {+ "name": "public_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "credential_id": {+ "name": "credential_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "counter": {+ "name": "counter",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "device_type": {+ "name": "device_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "backed_up": {+ "name": "backed_up",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true+ },+ "transports": {+ "name": "transports",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "aaguid": {+ "name": "aaguid",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "passkey_userId_idx": {+ "name": "passkey_userId_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "passkey_credentialID_idx": {+ "name": "passkey_credentialID_idx",+ "columns": [+ {+ "expression": "credential_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "passkey_user_id_user_id_fk": {+ "name": "passkey_user_id_user_id_fk",+ "tableFrom": "passkey",+ "columnsFrom": [+ "user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "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",+ "primaryKey": false,+ "notNull": true+ },+ "token": {+ "name": "token",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "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": {+ "session_userId_idx": {+ "name": "session_userId_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "session_user_id_user_id_fk": {+ "name": "session_user_id_user_id_fk",+ "tableFrom": "session",+ "columnsFrom": [+ "user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "session_token_unique": {+ "name": "session_token_unique",+ "columns": [+ "token"+ ],+ "nullsNotDistinct": false+ }+ },+ "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",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "username": {+ "name": "username",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "display_username": {+ "name": "display_username",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "default": "'user'"+ },+ "active": {+ "name": "active",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ },+ "last_seen_at": {+ "name": "last_seen_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "user_email_unique": {+ "name": "user_email_unique",+ "columns": [+ "email"+ ],+ "nullsNotDistinct": false+ },+ "user_username_unique": {+ "name": "user_username_unique",+ "columns": [+ "username"+ ],+ "nullsNotDistinct": false+ }+ },+ "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",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "verification_identifier_idx": {+ "name": "verification_identifier_idx",+ "columns": [+ {+ "expression": "identifier",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_chat_event": {+ "name": "agent_chat_event",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "bigserial",+ "primaryKey": true,+ "notNull": true+ },+ "message_id": {+ "name": "message_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "payload": {+ "name": "payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_chat_event_message_idx": {+ "name": "agent_chat_event_message_idx",+ "columns": [+ {+ "expression": "message_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "agent_chat_event_message_id_agent_chat_message_id_fk": {+ "name": "agent_chat_event_message_id_agent_chat_message_id_fk",+ "tableFrom": "agent_chat_event",+ "columnsFrom": [+ "message_id"+ ],+ "tableTo": "agent_chat_message",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_chat_favorite": {+ "name": "agent_chat_favorite",+ "schema": "",+ "columns": {+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "thread_id": {+ "name": "thread_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "agent_chat_favorite_user_id_user_id_fk": {+ "name": "agent_chat_favorite_user_id_user_id_fk",+ "tableFrom": "agent_chat_favorite",+ "columnsFrom": [+ "user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "agent_chat_favorite_agent_id_ai_agent_id_fk": {+ "name": "agent_chat_favorite_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_chat_favorite",+ "columnsFrom": [+ "agent_id"+ ],+ "tableTo": "ai_agent",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {+ "agent_chat_favorite_user_id_thread_id_pk": {+ "name": "agent_chat_favorite_user_id_thread_id_pk",+ "columns": [+ "user_id",+ "thread_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_chat_message": {+ "name": "agent_chat_message",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "thread_id": {+ "name": "thread_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "attempts": {+ "name": "attempts",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "next_attempt_at": {+ "name": "next_attempt_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "last_error": {+ "name": "last_error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "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": {+ "agent_chat_message_thread_idx": {+ "name": "agent_chat_message_thread_idx",+ "columns": [+ {+ "expression": "thread_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "agent_chat_message_due_idx": {+ "name": "agent_chat_message_due_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "next_attempt_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "where": "\"agent_chat_message\".\"status\" IN ('pending', 'streaming')",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "agent_chat_message_thread_id_agent_chat_thread_id_fk": {+ "name": "agent_chat_message_thread_id_agent_chat_thread_id_fk",+ "tableFrom": "agent_chat_message",+ "columnsFrom": [+ "thread_id"+ ],+ "tableTo": "agent_chat_thread",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "agent_chat_message_agent_id_ai_agent_id_fk": {+ "name": "agent_chat_message_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_chat_message",+ "columnsFrom": [+ "agent_id"+ ],+ "tableTo": "ai_agent",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "agent_chat_message_role_check": {+ "name": "agent_chat_message_role_check",+ "value": "\"agent_chat_message\".\"role\" IN ('user', 'assistant')"+ },+ "agent_chat_message_status_check": {+ "name": "agent_chat_message_status_check",+ "value": "\"agent_chat_message\".\"status\" IN ('pending', 'streaming', 'success', 'failed', 'canceled')"+ }+ },+ "isRLSEnabled": false+ },+ "public.agent_chat_thread": {+ "name": "agent_chat_thread",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "cli_session_id": {+ "name": "cli_session_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": {+ "agent_chat_thread_agent_user_idx": {+ "name": "agent_chat_thread_agent_user_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "agent_chat_thread_agent_id_ai_agent_id_fk": {+ "name": "agent_chat_thread_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_chat_thread",+ "columnsFrom": [+ "agent_id"+ ],+ "tableTo": "ai_agent",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "agent_chat_thread_user_id_user_id_fk": {+ "name": "agent_chat_thread_user_id_user_id_fk",+ "tableFrom": "agent_chat_thread",+ "columnsFrom": [+ "user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_chat_usage": {+ "name": "agent_chat_usage",+ "schema": "",+ "columns": {+ "thread_id": {+ "name": "thread_id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "input_tokens": {+ "name": "input_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "output_tokens": {+ "name": "output_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_chat_usage_agent_idx": {+ "name": "agent_chat_usage_agent_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "agent_chat_usage_agent_id_ai_agent_id_fk": {+ "name": "agent_chat_usage_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_chat_usage",+ "columnsFrom": [+ "agent_id"+ ],+ "tableTo": "ai_agent",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_field_trigger": {+ "name": "agent_field_trigger",+ "schema": "",+ "columns": {+ "agent_id": {+ "name": "agent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "field_id": {+ "name": "field_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "delay_sec": {+ "name": "delay_sec",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 120+ }+ },+ "indexes": {+ "agent_field_trigger_field_idx": {+ "name": "agent_field_trigger_field_idx",+ "columns": [+ {+ "expression": "field_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "agent_field_trigger_agent_id_ai_agent_id_fk": {+ "name": "agent_field_trigger_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_field_trigger",+ "columnsFrom": [+ "agent_id"+ ],+ "tableTo": "ai_agent",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "agent_field_trigger_field_id_custom_field_id_fk": {+ "name": "agent_field_trigger_field_id_custom_field_id_fk",+ "tableFrom": "agent_field_trigger",+ "columnsFrom": [+ "field_id"+ ],+ "tableTo": "custom_field",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {+ "agent_field_trigger_agent_id_field_id_pk": {+ "name": "agent_field_trigger_agent_id_field_id_pk",+ "columns": [+ "agent_id",+ "field_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "agent_field_trigger_delay_check": {+ "name": "agent_field_trigger_delay_check",+ "value": "\"agent_field_trigger\".\"delay_sec\" >= 0 AND \"agent_field_trigger\".\"delay_sec\" <= 86400"+ }+ },+ "isRLSEnabled": false+ },+ "public.agent_run": {+ "name": "agent_run",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "schedule_id": {+ "name": "schedule_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "trigger": {+ "name": "trigger",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'delegation'"+ },+ "scheduled_for": {+ "name": "scheduled_for",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "source_activity_id": {+ "name": "source_activity_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "document_id": {+ "name": "document_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "source_document_comment_id": {+ "name": "source_document_comment_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "prompt": {+ "name": "prompt",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "attempts": {+ "name": "attempts",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "next_attempt_at": {+ "name": "next_attempt_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "last_error": {+ "name": "last_error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "output": {+ "name": "output",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "input_tokens": {+ "name": "input_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "output_tokens": {+ "name": "output_tokens",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "execution_started_at": {+ "name": "execution_started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "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+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_run_schedule_fire_uq": {+ "name": "agent_run_schedule_fire_uq",+ "columns": [+ {+ "expression": "schedule_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "scheduled_for",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "agent_run_due_idx": {+ "name": "agent_run_due_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "next_attempt_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "agent_run_schedule_idx": {+ "name": "agent_run_schedule_idx",+ "columns": [+ {+ "expression": "schedule_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "agent_run_project_idx": {+ "name": "agent_run_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "agent_run_issue_idx": {+ "name": "agent_run_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "where": "\"agent_run\".\"issue_id\" IS NOT NULL",+ "concurrently": false+ },+ "agent_run_source_activity_idx": {+ "name": "agent_run_source_activity_idx",+ "columns": [+ {+ "expression": "source_activity_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "where": "\"agent_run\".\"source_activity_id\" IS NOT NULL",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "agent_run_agent_id_ai_agent_id_fk": {+ "name": "agent_run_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_run",+ "columnsFrom": [+ "agent_id"+ ],+ "tableTo": "ai_agent",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "agent_run_project_id_project_id_fk": {+ "name": "agent_run_project_id_project_id_fk",+ "tableFrom": "agent_run",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "project",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "agent_run_issue_id_issue_id_fk": {+ "name": "agent_run_issue_id_issue_id_fk",+ "tableFrom": "agent_run",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issue",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "agent_run_schedule_id_agent_schedule_id_fk": {+ "name": "agent_run_schedule_id_agent_schedule_id_fk",+ "tableFrom": "agent_run",+ "columnsFrom": [+ "schedule_id"+ ],+ "tableTo": "agent_schedule",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "agent_run_source_activity_id_issue_activity_id_fk": {+ "name": "agent_run_source_activity_id_issue_activity_id_fk",+ "tableFrom": "agent_run",+ "columnsFrom": [+ "source_activity_id"+ ],+ "tableTo": "issue_activity",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "agent_run_document_id_project_document_id_fk": {+ "name": "agent_run_document_id_project_document_id_fk",+ "tableFrom": "agent_run",+ "columnsFrom": [+ "document_id"+ ],+ "tableTo": "project_document",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "agent_run_source_document_comment_id_document_comment_id_fk": {+ "name": "agent_run_source_document_comment_id_document_comment_id_fk",+ "tableFrom": "agent_run",+ "columnsFrom": [+ "source_document_comment_id"+ ],+ "tableTo": "document_comment",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "agent_run_status_check": {+ "name": "agent_run_status_check",+ "value": "\"agent_run\".\"status\" IN ('pending', 'success', 'failed', 'canceled')"+ },+ "agent_run_trigger_check": {+ "name": "agent_run_trigger_check",+ "value": "\"agent_run\".\"trigger\" IN ('mention', 'delegation', 'field', 'schedule', 'manual', 'status', 'event')"+ }+ },+ "isRLSEnabled": false+ },+ "public.agent_run_trace": {+ "name": "agent_run_trace",+ "schema": "",+ "columns": {+ "run_id": {+ "name": "run_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "attempt": {+ "name": "attempt",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "session_id": {+ "name": "session_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "events": {+ "name": "events",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "next_offset": {+ "name": "next_offset",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "truncated": {+ "name": "truncated",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "agent_run_trace_run_id_agent_run_id_fk": {+ "name": "agent_run_trace_run_id_agent_run_id_fk",+ "tableFrom": "agent_run_trace",+ "columnsFrom": [+ "run_id"+ ],+ "tableTo": "agent_run",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {+ "agent_run_trace_run_id_attempt_pk": {+ "name": "agent_run_trace_run_id_attempt_pk",+ "columns": [+ "run_id",+ "attempt"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_schedule": {+ "name": "agent_schedule",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "prompt": {+ "name": "prompt",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'cron'"+ },+ "cron": {+ "name": "cron",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "timezone": {+ "name": "timezone",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "next_run_at": {+ "name": "next_run_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "column_id": {+ "name": "column_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "delay_sec": {+ "name": "delay_sec",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "options": {+ "name": "options",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "last_run_at": {+ "name": "last_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": {+ "agent_schedule_due_idx": {+ "name": "agent_schedule_due_idx",+ "columns": [+ {+ "expression": "status",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "next_run_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "agent_schedule_agent_idx": {+ "name": "agent_schedule_agent_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "agent_schedule_project_idx": {+ "name": "agent_schedule_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "agent_schedule_column_idx": {+ "name": "agent_schedule_column_idx",+ "columns": [+ {+ "expression": "column_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "agent_schedule_agent_id_ai_agent_id_fk": {+ "name": "agent_schedule_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_schedule",+ "columnsFrom": [+ "agent_id"+ ],+ "tableTo": "ai_agent",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "agent_schedule_project_id_project_id_fk": {+ "name": "agent_schedule_project_id_project_id_fk",+ "tableFrom": "agent_schedule",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "project",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "agent_schedule_column_id_project_column_id_fk": {+ "name": "agent_schedule_column_id_project_column_id_fk",+ "tableFrom": "agent_schedule",+ "columnsFrom": [+ "column_id"+ ],+ "tableTo": "project_column",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "agent_schedule_project_id_agent_id_name_unique": {+ "name": "agent_schedule_project_id_agent_id_name_unique",+ "columns": [+ "project_id",+ "agent_id",+ "name"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {+ "agent_schedule_status_check": {+ "name": "agent_schedule_status_check",+ "value": "\"agent_schedule\".\"status\" IN ('active', 'paused')"+ },+ "agent_schedule_type_check": {+ "name": "agent_schedule_type_check",+ "value": "(\"agent_schedule\".\"type\" = 'cron' AND \"agent_schedule\".\"cron\" IS NOT NULL AND \"agent_schedule\".\"next_run_at\" IS NOT NULL AND \"agent_schedule\".\"column_id\" IS NULL)\n OR (\"agent_schedule\".\"type\" = 'status' AND \"agent_schedule\".\"column_id\" IS NOT NULL AND \"agent_schedule\".\"cron\" IS NULL AND \"agent_schedule\".\"next_run_at\" IS NULL)\n OR (\"agent_schedule\".\"type\" NOT IN ('cron', 'status') AND \"agent_schedule\".\"cron\" IS NULL AND \"agent_schedule\".\"next_run_at\" IS NULL AND \"agent_schedule\".\"column_id\" IS NULL)"+ },+ "agent_schedule_delay_check": {+ "name": "agent_schedule_delay_check",+ "value": "\"agent_schedule\".\"delay_sec\" >= 0 AND \"agent_schedule\".\"delay_sec\" <= 86400"+ }+ },+ "isRLSEnabled": false+ },+ "public.agent_skill": {+ "name": "agent_skill",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "team_id": {+ "name": "team_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "source": {+ "name": "source",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source_url": {+ "name": "source_url",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "s3_prefix": {+ "name": "s3_prefix",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "files": {+ "name": "files",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_skill_team_idx": {+ "name": "agent_skill_team_idx",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "agent_skill_team_id_team_id_fk": {+ "name": "agent_skill_team_id_team_id_fk",+ "tableFrom": "agent_skill",+ "columnsFrom": [+ "team_id"+ ],+ "tableTo": "team",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "agent_skill_team_id_name_unique": {+ "name": "agent_skill_team_id_name_unique",+ "columns": [+ "team_id",+ "name"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {+ "agent_skill_source_check": {+ "name": "agent_skill_source_check",+ "value": "\"agent_skill\".\"source\" IN ('upload', 'inline', 'github')"+ }+ },+ "isRLSEnabled": false+ },+ "public.agent_skill_link": {+ "name": "agent_skill_link",+ "schema": "",+ "columns": {+ "agent_id": {+ "name": "agent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "skill_id": {+ "name": "skill_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "agent_skill_link_skill_idx": {+ "name": "agent_skill_link_skill_idx",+ "columns": [+ {+ "expression": "skill_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "agent_skill_link_agent_id_ai_agent_id_fk": {+ "name": "agent_skill_link_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_skill_link",+ "columnsFrom": [+ "agent_id"+ ],+ "tableTo": "ai_agent",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "agent_skill_link_skill_id_agent_skill_id_fk": {+ "name": "agent_skill_link_skill_id_agent_skill_id_fk",+ "tableFrom": "agent_skill_link",+ "columnsFrom": [+ "skill_id"+ ],+ "tableTo": "agent_skill",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {+ "agent_skill_link_agent_id_skill_id_pk": {+ "name": "agent_skill_link_agent_id_skill_id_pk",+ "columns": [+ "agent_id",+ "skill_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_tool": {+ "name": "agent_tool",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "team_id": {+ "name": "team_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "tool_key": {+ "name": "tool_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "credential_id": {+ "name": "credential_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_tool_team_tool_keyless_uq": {+ "name": "agent_tool_team_tool_keyless_uq",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "tool_key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"agent_tool\".\"credential_id\" IS NULL",+ "concurrently": false+ },+ "agent_tool_team_idx": {+ "name": "agent_tool_team_idx",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "agent_tool_credential_idx": {+ "name": "agent_tool_credential_idx",+ "columns": [+ {+ "expression": "credential_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "agent_tool_team_id_team_id_fk": {+ "name": "agent_tool_team_id_team_id_fk",+ "tableFrom": "agent_tool",+ "columnsFrom": [+ "team_id"+ ],+ "tableTo": "team",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "agent_tool_credential_id_integration_credential_id_fk": {+ "name": "agent_tool_credential_id_integration_credential_id_fk",+ "tableFrom": "agent_tool",+ "columnsFrom": [+ "credential_id"+ ],+ "tableTo": "integration_credential",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "agent_tool_team_id_tool_key_credential_id_unique": {+ "name": "agent_tool_team_id_tool_key_credential_id_unique",+ "columns": [+ "team_id",+ "tool_key",+ "credential_id"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_tool_link": {+ "name": "agent_tool_link",+ "schema": "",+ "columns": {+ "agent_id": {+ "name": "agent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "agent_tool_id": {+ "name": "agent_tool_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "agent_tool_link_tool_idx": {+ "name": "agent_tool_link_tool_idx",+ "columns": [+ {+ "expression": "agent_tool_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "agent_tool_link_agent_id_ai_agent_id_fk": {+ "name": "agent_tool_link_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_tool_link",+ "columnsFrom": [+ "agent_id"+ ],+ "tableTo": "ai_agent",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "agent_tool_link_agent_tool_id_agent_tool_id_fk": {+ "name": "agent_tool_link_agent_tool_id_agent_tool_id_fk",+ "tableFrom": "agent_tool_link",+ "columnsFrom": [+ "agent_tool_id"+ ],+ "tableTo": "agent_tool",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {+ "agent_tool_link_agent_id_agent_tool_id_pk": {+ "name": "agent_tool_link_agent_id_agent_tool_id_pk",+ "columns": [+ "agent_id",+ "agent_tool_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.ai_agent": {+ "name": "ai_agent",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "team_id": {+ "name": "team_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "username": {+ "name": "username",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "model_credential_id": {+ "name": "model_credential_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "model": {+ "name": "model",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "instructions": {+ "name": "instructions",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "tools": {+ "name": "tools",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "temperature": {+ "name": "temperature",+ "type": "double precision",+ "primaryKey": false,+ "notNull": false+ },+ "reasoning_effort": {+ "name": "reasoning_effort",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "max_steps": {+ "name": "max_steps",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "run_timeout_sec": {+ "name": "run_timeout_sec",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "trigger_on_mention": {+ "name": "trigger_on_mention",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "trigger_on_assign": {+ "name": "trigger_on_assign",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "chat_enabled": {+ "name": "chat_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "delegation_delay_sec": {+ "name": "delegation_delay_sec",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 120+ },+ "api_key_ciphertext": {+ "name": "api_key_ciphertext",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "api_key_iv": {+ "name": "api_key_iv",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "api_key_auth_tag": {+ "name": "api_key_auth_tag",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "memory_enabled": {+ "name": "memory_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "memory_last_messages": {+ "name": "memory_last_messages",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "owner_user_id": {+ "name": "owner_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "runner_scope": {+ "name": "runner_scope",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'team'"+ },+ "last_seen_at": {+ "name": "last_seen_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "invocation_url": {+ "name": "invocation_url",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "invocation_secret_ciphertext": {+ "name": "invocation_secret_ciphertext",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "invocation_secret_iv": {+ "name": "invocation_secret_iv",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "invocation_secret_auth_tag": {+ "name": "invocation_secret_auth_tag",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "ai_agent_team_username_uq": {+ "name": "ai_agent_team_username_uq",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "lower(\"username\")",+ "isExpression": true,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "ai_agent_team_idx": {+ "name": "ai_agent_team_idx",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "ai_agent_team_id_team_id_fk": {+ "name": "ai_agent_team_id_team_id_fk",+ "tableFrom": "ai_agent",+ "columnsFrom": [+ "team_id"+ ],+ "tableTo": "team",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "ai_agent_user_id_user_id_fk": {+ "name": "ai_agent_user_id_user_id_fk",+ "tableFrom": "ai_agent",+ "columnsFrom": [+ "user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "ai_agent_model_credential_id_integration_credential_id_fk": {+ "name": "ai_agent_model_credential_id_integration_credential_id_fk",+ "tableFrom": "ai_agent",+ "columnsFrom": [+ "model_credential_id"+ ],+ "tableTo": "integration_credential",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "ai_agent_owner_user_id_user_id_fk": {+ "name": "ai_agent_owner_user_id_user_id_fk",+ "tableFrom": "ai_agent",+ "columnsFrom": [+ "owner_user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "ai_agent_user_id_unique": {+ "name": "ai_agent_user_id_unique",+ "columns": [+ "user_id"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {+ "ai_agent_kind_check": {+ "name": "ai_agent_kind_check",+ "value": "\"ai_agent\".\"kind\" IN ('external', 'internal')"+ },+ "ai_agent_runner_scope_check": {+ "name": "ai_agent_runner_scope_check",+ "value": "\"ai_agent\".\"runner_scope\" IN ('owner', 'team')"+ },+ "ai_agent_reasoning_effort_check": {+ "name": "ai_agent_reasoning_effort_check",+ "value": "\"ai_agent\".\"reasoning_effort\" IN ('low', 'medium', 'high')"+ },+ "ai_agent_delegation_delay_check": {+ "name": "ai_agent_delegation_delay_check",+ "value": "\"ai_agent\".\"delegation_delay_sec\" >= 0 AND \"ai_agent\".\"delegation_delay_sec\" <= 86400"+ }+ },+ "isRLSEnabled": false+ },+ "public.app_secret": {+ "name": "app_secret",+ "schema": "",+ "columns": {+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "ciphertext": {+ "name": "ciphertext",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "iv": {+ "name": "iv",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "auth_tag": {+ "name": "auth_tag",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "redacted": {+ "name": "redacted",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.app_setting": {+ "name": "app_setting",+ "schema": "",+ "columns": {+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "value": {+ "name": "value",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.chat_attachment": {+ "name": "chat_attachment",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "public_id": {+ "name": "public_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "uploaded_by_user_id": {+ "name": "uploaded_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "s3_key": {+ "name": "s3_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "filename": {+ "name": "filename",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "content_type": {+ "name": "content_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "size_bytes": {+ "name": "size_bytes",+ "type": "bigint",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "chat_attachment_project_idx": {+ "name": "chat_attachment_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "chat_attachment_project_id_project_id_fk": {+ "name": "chat_attachment_project_id_project_id_fk",+ "tableFrom": "chat_attachment",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "project",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "chat_attachment_uploaded_by_user_id_user_id_fk": {+ "name": "chat_attachment_uploaded_by_user_id_user_id_fk",+ "tableFrom": "chat_attachment",+ "columnsFrom": [+ "uploaded_by_user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "chat_attachment_public_id_unique": {+ "name": "chat_attachment_public_id_unique",+ "columns": [+ "public_id"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.custom_field": {+ "name": "custom_field",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "issue_type_id": {+ "name": "issue_type_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "field_type": {+ "name": "field_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "member_scope": {+ "name": "member_scope",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "show_in_body": {+ "name": "show_in_body",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "position": {+ "name": "position",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "custom_field_project_id_project_id_fk": {+ "name": "custom_field_project_id_project_id_fk",+ "tableFrom": "custom_field",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "project",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "custom_field_issue_type_id_issue_type_id_fk": {+ "name": "custom_field_issue_type_id_issue_type_id_fk",+ "tableFrom": "custom_field",+ "columnsFrom": [+ "issue_type_id"+ ],+ "tableTo": "issue_type",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "custom_field_field_type_check": {+ "name": "custom_field_field_type_check",+ "value": "\"custom_field\".\"field_type\" IN ('text', 'markdown', 'url', 'number', 'boolean', 'date', 'datetime', 'datetime_range', 'select', 'multi_select', 'member')"+ },+ "custom_field_member_scope_check": {+ "name": "custom_field_member_scope_check",+ "value": "(\"custom_field\".\"field_type\" = 'member') = (\"custom_field\".\"member_scope\" IS NOT NULL) AND (\"custom_field\".\"member_scope\" IS NULL OR \"custom_field\".\"member_scope\" IN ('all', 'humans', 'agents'))"+ }+ },+ "isRLSEnabled": false+ },+ "public.custom_field_option": {+ "name": "custom_field_option",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "field_id": {+ "name": "field_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "value": {+ "name": "value",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'#6b7280'"+ },+ "position": {+ "name": "position",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ }+ },+ "indexes": {},+ "foreignKeys": {+ "custom_field_option_field_id_custom_field_id_fk": {+ "name": "custom_field_option_field_id_custom_field_id_fk",+ "tableFrom": "custom_field_option",+ "columnsFrom": [+ "field_id"+ ],+ "tableTo": "custom_field",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "custom_field_option_field_id_value_unique": {+ "name": "custom_field_option_field_id_value_unique",+ "columns": [+ "field_id",+ "value"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.cycle": {+ "name": "cycle",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "goal": {+ "name": "goal",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "start_date": {+ "name": "start_date",+ "type": "date",+ "primaryKey": false,+ "notNull": true+ },+ "end_date": {+ "name": "end_date",+ "type": "date",+ "primaryKey": false,+ "notNull": true+ },+ "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": {+ "cycle_project_idx": {+ "name": "cycle_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "start_date",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "cycle_project_id_project_id_fk": {+ "name": "cycle_project_id_project_id_fk",+ "tableFrom": "cycle",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "project",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "cycle_dates_check": {+ "name": "cycle_dates_check",+ "value": "\"cycle\".\"end_date\" >= \"cycle\".\"start_date\""+ }+ },+ "isRLSEnabled": false+ },+ "public.document_asset": {+ "name": "document_asset",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "public_id": {+ "name": "public_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "document_id": {+ "name": "document_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "uploaded_by_user_id": {+ "name": "uploaded_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "s3_key": {+ "name": "s3_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "filename": {+ "name": "filename",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "content_type": {+ "name": "content_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "size_bytes": {+ "name": "size_bytes",+ "type": "bigint",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "document_asset_document_idx": {+ "name": "document_asset_document_idx",+ "columns": [+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "document_asset_document_id_project_document_id_fk": {+ "name": "document_asset_document_id_project_document_id_fk",+ "tableFrom": "document_asset",+ "columnsFrom": [+ "document_id"+ ],+ "tableTo": "project_document",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "document_asset_uploaded_by_user_id_user_id_fk": {+ "name": "document_asset_uploaded_by_user_id_user_id_fk",+ "tableFrom": "document_asset",+ "columnsFrom": [+ "uploaded_by_user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "document_asset_public_id_unique": {+ "name": "document_asset_public_id_unique",+ "columns": [+ "public_id"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.document_collaboration": {+ "name": "document_collaboration",+ "schema": "",+ "columns": {+ "document_id": {+ "name": "document_id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true+ },+ "epoch": {+ "name": "epoch",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "version": {+ "name": "version",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "content_json": {+ "name": "content_json",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "document_collaboration_document_id_project_document_id_fk": {+ "name": "document_collaboration_document_id_project_document_id_fk",+ "tableFrom": "document_collaboration",+ "columnsFrom": [+ "document_id"+ ],+ "tableTo": "project_document",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.document_comment": {+ "name": "document_comment",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "document_id": {+ "name": "document_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "parent_id": {+ "name": "parent_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "author_id": {+ "name": "author_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "body": {+ "name": "body",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "quote": {+ "name": "quote",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "selection_from": {+ "name": "selection_from",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "selection_to": {+ "name": "selection_to",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "orphaned": {+ "name": "orphaned",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": 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_comment_document_idx": {+ "name": "document_comment_document_idx",+ "columns": [+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "document_comment_document_id_project_document_id_fk": {+ "name": "document_comment_document_id_project_document_id_fk",+ "tableFrom": "document_comment",+ "columnsFrom": [+ "document_id"+ ],+ "tableTo": "project_document",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "document_comment_parent_id_document_comment_id_fk": {+ "name": "document_comment_parent_id_document_comment_id_fk",+ "tableFrom": "document_comment",+ "columnsFrom": [+ "parent_id"+ ],+ "tableTo": "document_comment",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "document_comment_author_id_user_id_fk": {+ "name": "document_comment_author_id_user_id_fk",+ "tableFrom": "document_comment",+ "columnsFrom": [+ "author_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.document_step": {+ "name": "document_step",+ "schema": "",+ "columns": {+ "document_id": {+ "name": "document_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "version": {+ "name": "version",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "client_id": {+ "name": "client_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "step": {+ "name": "step",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "document_step_document_id_project_document_id_fk": {+ "name": "document_step_document_id_project_document_id_fk",+ "tableFrom": "document_step",+ "columnsFrom": [+ "document_id"+ ],+ "tableTo": "project_document",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {+ "document_step_document_id_version_pk": {+ "name": "document_step_document_id_version_pk",+ "columns": [+ "document_id",+ "version"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.git_managed_repository": {+ "name": "git_managed_repository",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "connection_id": {+ "name": "connection_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "external_id": {+ "name": "external_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "full_name": {+ "name": "full_name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "web_url": {+ "name": "web_url",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "webhook_external_id": {+ "name": "webhook_external_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'connected'"+ },+ "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": {+ "git_managed_repository_project_connection_idx": {+ "name": "git_managed_repository_project_connection_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "connection_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "git_managed_repository_project_id_project_id_fk": {+ "name": "git_managed_repository_project_id_project_id_fk",+ "tableFrom": "git_managed_repository",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "project",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "git_managed_repository_connection_id_git_provider_connection_id_fk": {+ "name": "git_managed_repository_connection_id_git_provider_connection_id_fk",+ "tableFrom": "git_managed_repository",+ "columnsFrom": [+ "connection_id"+ ],+ "tableTo": "git_provider_connection",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "git_managed_repository_project_connection_external_unique": {+ "name": "git_managed_repository_project_connection_external_unique",+ "columns": [+ "project_id",+ "connection_id",+ "external_id"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.git_provider_connection": {+ "name": "git_provider_connection",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "team_id": {+ "name": "team_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "base_url": {+ "name": "base_url",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "account_login": {+ "name": "account_login",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "ciphertext": {+ "name": "ciphertext",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "iv": {+ "name": "iv",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "auth_tag": {+ "name": "auth_tag",+ "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": {+ "git_provider_connection_team_idx": {+ "name": "git_provider_connection_team_idx",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "git_provider_connection_team_id_team_id_fk": {+ "name": "git_provider_connection_team_id_team_id_fk",+ "tableFrom": "git_provider_connection",+ "columnsFrom": [+ "team_id"+ ],+ "tableTo": "team",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.import_job": {+ "name": "import_job",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source": {+ "name": "source",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "phase": {+ "name": "phase",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'discover'"+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "cursor": {+ "name": "cursor",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "credential_ciphertext": {+ "name": "credential_ciphertext",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "credential_iv": {+ "name": "credential_iv",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "credential_auth_tag": {+ "name": "credential_auth_tag",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "attempts": {+ "name": "attempts",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "next_attempt_at": {+ "name": "next_attempt_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "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": {+ "import_job_project_idx": {+ "name": "import_job_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "import_job_due_idx": {+ "name": "import_job_due_idx",+ "columns": [+ {+ "expression": "next_attempt_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "where": "\"import_job\".\"status\" = 'pending'",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "import_job_project_id_project_id_fk": {+ "name": "import_job_project_id_project_id_fk",+ "tableFrom": "import_job",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "project",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "import_job_created_by_user_id_user_id_fk": {+ "name": "import_job_created_by_user_id_user_id_fk",+ "tableFrom": "import_job",+ "columnsFrom": [+ "created_by_user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "import_job_phase_check": {+ "name": "import_job_phase_check",+ "value": "\"import_job\".\"phase\" IN ('discover', 'create', 'link', 'rewrite', 'attachments', 'done')"+ },+ "import_job_status_check": {+ "name": "import_job_status_check",+ "value": "\"import_job\".\"status\" IN ('pending', 'running', 'paused', 'completed', 'failed')"+ }+ },+ "isRLSEnabled": false+ },+ "public.import_record": {+ "name": "import_record",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "import_job_id": {+ "name": "import_job_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "source_entity_type": {+ "name": "source_entity_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source_id": {+ "name": "source_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "source_display_id": {+ "name": "source_display_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "local_entity_type": {+ "name": "local_entity_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "local_id": {+ "name": "local_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "import_record_job_source_uq": {+ "name": "import_record_job_source_uq",+ "columns": [+ {+ "expression": "import_job_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_entity_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "import_record_job_local_idx": {+ "name": "import_record_job_local_idx",+ "columns": [+ {+ "expression": "import_job_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "local_entity_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "local_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "import_record_job_display_idx": {+ "name": "import_record_job_display_idx",+ "columns": [+ {+ "expression": "import_job_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_entity_type",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "source_display_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "import_record_import_job_id_import_job_id_fk": {+ "name": "import_record_import_job_id_import_job_id_fk",+ "tableFrom": "import_record",+ "columnsFrom": [+ "import_job_id"+ ],+ "tableTo": "import_job",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "import_record_source_entity_type_check": {+ "name": "import_record_source_entity_type_check",+ "value": "\"import_record\".\"source_entity_type\" IN ('issue', 'comment', 'label', 'state', 'cycle', 'attachment', 'checklist', 'custom_field')"+ },+ "import_record_local_entity_type_check": {+ "name": "import_record_local_entity_type_check",+ "value": "\"import_record\".\"local_entity_type\" IS NULL OR \"import_record\".\"local_entity_type\" IN ('issue', 'comment', 'label', 'state', 'cycle', 'attachment', 'checklist', 'custom_field')"+ }+ },+ "isRLSEnabled": false+ },+ "public.initiative": {+ "name": "initiative",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'planned'"+ },+ "owner_user_id": {+ "name": "owner_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "priority": {+ "name": "priority",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "start_date": {+ "name": "start_date",+ "type": "date",+ "primaryKey": false,+ "notNull": false+ },+ "target_date": {+ "name": "target_date",+ "type": "date",+ "primaryKey": false,+ "notNull": false+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "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": {+ "initiative_project_idx": {+ "name": "initiative_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "initiative_project_id_project_id_fk": {+ "name": "initiative_project_id_project_id_fk",+ "tableFrom": "initiative",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "project",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "initiative_owner_user_id_user_id_fk": {+ "name": "initiative_owner_user_id_user_id_fk",+ "tableFrom": "initiative",+ "columnsFrom": [+ "owner_user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "initiative_status_check": {+ "name": "initiative_status_check",+ "value": "\"initiative\".\"status\" IN ('proposed', 'planned', 'active', 'completed', 'canceled')"+ }+ },+ "isRLSEnabled": false+ },+ "public.initiative_attachment": {+ "name": "initiative_attachment",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "public_id": {+ "name": "public_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "initiative_id": {+ "name": "initiative_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "s3_key": {+ "name": "s3_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "filename": {+ "name": "filename",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "content_type": {+ "name": "content_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "size_bytes": {+ "name": "size_bytes",+ "type": "bigint",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "initiative_attachment_initiative_idx": {+ "name": "initiative_attachment_initiative_idx",+ "columns": [+ {+ "expression": "initiative_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "initiative_attachment_initiative_id_initiative_id_fk": {+ "name": "initiative_attachment_initiative_id_initiative_id_fk",+ "tableFrom": "initiative_attachment",+ "columnsFrom": [+ "initiative_id"+ ],+ "tableTo": "initiative",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "initiative_attachment_public_id_unique": {+ "name": "initiative_attachment_public_id_unique",+ "columns": [+ "public_id"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.initiative_label": {+ "name": "initiative_label",+ "schema": "",+ "columns": {+ "initiative_id": {+ "name": "initiative_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "label_id": {+ "name": "label_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "initiative_label_initiative_id_initiative_id_fk": {+ "name": "initiative_label_initiative_id_initiative_id_fk",+ "tableFrom": "initiative_label",+ "columnsFrom": [+ "initiative_id"+ ],+ "tableTo": "initiative",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "initiative_label_label_id_label_id_fk": {+ "name": "initiative_label_label_id_label_id_fk",+ "tableFrom": "initiative_label",+ "columnsFrom": [+ "label_id"+ ],+ "tableTo": "label",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {+ "initiative_label_initiative_id_label_id_pk": {+ "name": "initiative_label_initiative_id_label_id_pk",+ "columns": [+ "initiative_id",+ "label_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.integration_credential": {+ "name": "integration_credential",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "team_id": {+ "name": "team_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "integration_key": {+ "name": "integration_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "label": {+ "name": "label",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "ciphertext": {+ "name": "ciphertext",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "iv": {+ "name": "iv",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "auth_tag": {+ "name": "auth_tag",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "redacted": {+ "name": "redacted",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "integration_credential_team_idx": {+ "name": "integration_credential_team_idx",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "integration_credential_team_id_team_id_fk": {+ "name": "integration_credential_team_id_team_id_fk",+ "tableFrom": "integration_credential",+ "columnsFrom": [+ "team_id"+ ],+ "tableTo": "team",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue": {+ "name": "issue",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "sequence_number": {+ "name": "sequence_number",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "type_id": {+ "name": "type_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "initiative_id": {+ "name": "initiative_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "cycle_id": {+ "name": "cycle_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "column_id": {+ "name": "column_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "parent_id": {+ "name": "parent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "assignee_user_id": {+ "name": "assignee_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "delegate_user_id": {+ "name": "delegate_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "priority": {+ "name": "priority",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "estimate_points": {+ "name": "estimate_points",+ "type": "numeric",+ "primaryKey": false,+ "notNull": false+ },+ "estimate_minutes": {+ "name": "estimate_minutes",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "start_date": {+ "name": "start_date",+ "type": "date",+ "primaryKey": false,+ "notNull": false+ },+ "due_date": {+ "name": "due_date",+ "type": "date",+ "primaryKey": false,+ "notNull": false+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "archived_at": {+ "name": "archived_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "share_token": {+ "name": "share_token",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "share_extended": {+ "name": "share_extended",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "share_expires_at": {+ "name": "share_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()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_project_active_idx": {+ "name": "issue_project_active_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "column_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "where": "\"issue\".\"archived_at\" IS NULL",+ "concurrently": false+ },+ "issue_project_title_idx": {+ "name": "issue_project_title_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "lower(btrim(\"title\"))",+ "isExpression": true,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_parent_idx": {+ "name": "issue_parent_idx",+ "columns": [+ {+ "expression": "parent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "where": "\"issue\".\"parent_id\" IS NOT NULL",+ "concurrently": false+ },+ "issue_cycle_idx": {+ "name": "issue_cycle_idx",+ "columns": [+ {+ "expression": "cycle_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "where": "\"issue\".\"cycle_id\" IS NOT NULL",+ "concurrently": false+ },+ "issue_initiative_idx": {+ "name": "issue_initiative_idx",+ "columns": [+ {+ "expression": "initiative_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "where": "\"issue\".\"initiative_id\" IS NOT NULL",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issue_project_id_project_id_fk": {+ "name": "issue_project_id_project_id_fk",+ "tableFrom": "issue",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "project",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_type_id_issue_type_id_fk": {+ "name": "issue_type_id_issue_type_id_fk",+ "tableFrom": "issue",+ "columnsFrom": [+ "type_id"+ ],+ "tableTo": "issue_type",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_initiative_id_initiative_id_fk": {+ "name": "issue_initiative_id_initiative_id_fk",+ "tableFrom": "issue",+ "columnsFrom": [+ "initiative_id"+ ],+ "tableTo": "initiative",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_cycle_id_cycle_id_fk": {+ "name": "issue_cycle_id_cycle_id_fk",+ "tableFrom": "issue",+ "columnsFrom": [+ "cycle_id"+ ],+ "tableTo": "cycle",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_column_id_project_column_id_fk": {+ "name": "issue_column_id_project_column_id_fk",+ "tableFrom": "issue",+ "columnsFrom": [+ "column_id"+ ],+ "tableTo": "project_column",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "no action"+ },+ "issue_parent_id_issue_id_fk": {+ "name": "issue_parent_id_issue_id_fk",+ "tableFrom": "issue",+ "columnsFrom": [+ "parent_id"+ ],+ "tableTo": "issue",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_assignee_user_id_user_id_fk": {+ "name": "issue_assignee_user_id_user_id_fk",+ "tableFrom": "issue",+ "columnsFrom": [+ "assignee_user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_delegate_user_id_user_id_fk": {+ "name": "issue_delegate_user_id_user_id_fk",+ "tableFrom": "issue",+ "columnsFrom": [+ "delegate_user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_share_token_unique": {+ "name": "issue_share_token_unique",+ "columns": [+ "share_token"+ ],+ "nullsNotDistinct": false+ },+ "issue_project_id_sequence_number_unique": {+ "name": "issue_project_id_sequence_number_unique",+ "columns": [+ "project_id",+ "sequence_number"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {+ "issue_estimate_points_check": {+ "name": "issue_estimate_points_check",+ "value": "\"issue\".\"estimate_points\" >= 0"+ },+ "issue_estimate_minutes_check": {+ "name": "issue_estimate_minutes_check",+ "value": "\"issue\".\"estimate_minutes\" >= 0"+ }+ },+ "isRLSEnabled": false+ },+ "public.issue_activity": {+ "name": "issue_activity",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "initiative_id": {+ "name": "initiative_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "reply_to_id": {+ "name": "reply_to_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "actor_user_id": {+ "name": "actor_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "actor_name": {+ "name": "actor_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "body": {+ "name": "body",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "action": {+ "name": "action",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "payload": {+ "name": "payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "edited_at": {+ "name": "edited_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": {+ "issue_activity_issue_idx": {+ "name": "issue_activity_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_activity_reply_idx": {+ "name": "issue_activity_reply_idx",+ "columns": [+ {+ "expression": "reply_to_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_activity_initiative_idx": {+ "name": "issue_activity_initiative_idx",+ "columns": [+ {+ "expression": "initiative_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issue_activity_issue_id_issue_id_fk": {+ "name": "issue_activity_issue_id_issue_id_fk",+ "tableFrom": "issue_activity",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issue",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_activity_initiative_id_initiative_id_fk": {+ "name": "issue_activity_initiative_id_initiative_id_fk",+ "tableFrom": "issue_activity",+ "columnsFrom": [+ "initiative_id"+ ],+ "tableTo": "initiative",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_activity_reply_to_id_issue_activity_id_fk": {+ "name": "issue_activity_reply_to_id_issue_activity_id_fk",+ "tableFrom": "issue_activity",+ "columnsFrom": [+ "reply_to_id"+ ],+ "tableTo": "issue_activity",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_activity_actor_user_id_user_id_fk": {+ "name": "issue_activity_actor_user_id_user_id_fk",+ "tableFrom": "issue_activity",+ "columnsFrom": [+ "actor_user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "issue_activity_kind_check": {+ "name": "issue_activity_kind_check",+ "value": "\"issue_activity\".\"kind\" IN ('comment', 'activity')"+ },+ "issue_activity_owner_check": {+ "name": "issue_activity_owner_check",+ "value": "(\"issue_activity\".\"issue_id\" IS NOT NULL) <> (\"issue_activity\".\"initiative_id\" IS NOT NULL)"+ }+ },+ "isRLSEnabled": false+ },+ "public.issue_attachment": {+ "name": "issue_attachment",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "public_id": {+ "name": "public_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "s3_key": {+ "name": "s3_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "filename": {+ "name": "filename",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "content_type": {+ "name": "content_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "size_bytes": {+ "name": "size_bytes",+ "type": "bigint",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_attachment_issue_idx": {+ "name": "issue_attachment_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issue_attachment_issue_id_issue_id_fk": {+ "name": "issue_attachment_issue_id_issue_id_fk",+ "tableFrom": "issue_attachment",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issue",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_attachment_public_id_unique": {+ "name": "issue_attachment_public_id_unique",+ "columns": [+ "public_id"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_checklist": {+ "name": "issue_checklist",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_checklist_issue_idx": {+ "name": "issue_checklist_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issue_checklist_issue_id_issue_id_fk": {+ "name": "issue_checklist_issue_id_issue_id_fk",+ "tableFrom": "issue_checklist",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issue",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_checklist_item": {+ "name": "issue_checklist_item",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "checklist_id": {+ "name": "checklist_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "done": {+ "name": "done",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_checklist_item_checklist_idx": {+ "name": "issue_checklist_item_checklist_idx",+ "columns": [+ {+ "expression": "checklist_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issue_checklist_item_checklist_id_issue_checklist_id_fk": {+ "name": "issue_checklist_item_checklist_id_issue_checklist_id_fk",+ "tableFrom": "issue_checklist_item",+ "columnsFrom": [+ "checklist_id"+ ],+ "tableTo": "issue_checklist",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_cycle": {+ "name": "issue_cycle",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "cycle_id": {+ "name": "cycle_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "entered_at": {+ "name": "entered_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "left_at": {+ "name": "left_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "issue_cycle_issue_idx": {+ "name": "issue_cycle_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "entered_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_cycle_cycle_idx": {+ "name": "issue_cycle_cycle_idx",+ "columns": [+ {+ "expression": "cycle_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_cycle_open_idx": {+ "name": "issue_cycle_open_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "cycle_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"issue_cycle\".\"left_at\" IS NULL",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issue_cycle_issue_id_issue_id_fk": {+ "name": "issue_cycle_issue_id_issue_id_fk",+ "tableFrom": "issue_cycle",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issue",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_cycle_cycle_id_cycle_id_fk": {+ "name": "issue_cycle_cycle_id_cycle_id_fk",+ "tableFrom": "issue_cycle",+ "columnsFrom": [+ "cycle_id"+ ],+ "tableTo": "cycle",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_development_check": {+ "name": "issue_development_check",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "development_link_id": {+ "name": "development_link_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "external_id": {+ "name": "external_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "app_id": {+ "name": "app_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "url": {+ "name": "url",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "head_sha": {+ "name": "head_sha",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_development_check_link_sha_idx": {+ "name": "issue_development_check_link_sha_idx",+ "columns": [+ {+ "expression": "development_link_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "head_sha",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issue_development_check_development_link_id_issue_development_link_id_fk": {+ "name": "issue_development_check_development_link_id_issue_development_link_id_fk",+ "tableFrom": "issue_development_check",+ "columnsFrom": [+ "development_link_id"+ ],+ "tableTo": "issue_development_link",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_development_check_development_link_id_app_id_name_unique": {+ "name": "issue_development_check_development_link_id_app_id_name_unique",+ "columns": [+ "development_link_id",+ "app_id",+ "name"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_development_link": {+ "name": "issue_development_link",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "repository": {+ "name": "repository",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pull_request'"+ },+ "external_key": {+ "name": "external_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "number": {+ "name": "number",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "url": {+ "name": "url",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "state": {+ "name": "state",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "draft": {+ "name": "draft",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "source_branch": {+ "name": "source_branch",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "target_branch": {+ "name": "target_branch",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "head_sha": {+ "name": "head_sha",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "pipeline_status": {+ "name": "pipeline_status",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "pipeline_url": {+ "name": "pipeline_url",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_development_link_issue_idx": {+ "name": "issue_development_link_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_development_link_pr_idx": {+ "name": "issue_development_link_pr_idx",+ "columns": [+ {+ "expression": "provider",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "repository",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "number",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_development_link_sha_idx": {+ "name": "issue_development_link_sha_idx",+ "columns": [+ {+ "expression": "provider",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "repository",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "head_sha",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issue_development_link_issue_id_issue_id_fk": {+ "name": "issue_development_link_issue_id_issue_id_fk",+ "tableFrom": "issue_development_link",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issue",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_development_link_issue_id_provider_repository_external_key_unique": {+ "name": "issue_development_link_issue_id_provider_repository_external_key_unique",+ "columns": [+ "issue_id",+ "provider",+ "repository",+ "external_key"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_field_option": {+ "name": "issue_field_option",+ "schema": "",+ "columns": {+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "field_id": {+ "name": "field_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "option_id": {+ "name": "option_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "issue_field_option_issue_id_issue_id_fk": {+ "name": "issue_field_option_issue_id_issue_id_fk",+ "tableFrom": "issue_field_option",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issue",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_field_option_field_id_custom_field_id_fk": {+ "name": "issue_field_option_field_id_custom_field_id_fk",+ "tableFrom": "issue_field_option",+ "columnsFrom": [+ "field_id"+ ],+ "tableTo": "custom_field",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_field_option_option_id_custom_field_option_id_fk": {+ "name": "issue_field_option_option_id_custom_field_option_id_fk",+ "tableFrom": "issue_field_option",+ "columnsFrom": [+ "option_id"+ ],+ "tableTo": "custom_field_option",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {+ "issue_field_option_issue_id_field_id_option_id_pk": {+ "name": "issue_field_option_issue_id_field_id_option_id_pk",+ "columns": [+ "issue_id",+ "field_id",+ "option_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_field_value": {+ "name": "issue_field_value",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "field_id": {+ "name": "field_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "value_text": {+ "name": "value_text",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "value_number": {+ "name": "value_number",+ "type": "numeric",+ "primaryKey": false,+ "notNull": false+ },+ "value_bool": {+ "name": "value_bool",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false+ },+ "value_date": {+ "name": "value_date",+ "type": "date",+ "primaryKey": false,+ "notNull": false+ },+ "value_datetime": {+ "name": "value_datetime",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "value_datetime_end": {+ "name": "value_datetime_end",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "value_user_id": {+ "name": "value_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "issue_field_value_issue_id_issue_id_fk": {+ "name": "issue_field_value_issue_id_issue_id_fk",+ "tableFrom": "issue_field_value",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issue",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_field_value_field_id_custom_field_id_fk": {+ "name": "issue_field_value_field_id_custom_field_id_fk",+ "tableFrom": "issue_field_value",+ "columnsFrom": [+ "field_id"+ ],+ "tableTo": "custom_field",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_field_value_value_user_id_user_id_fk": {+ "name": "issue_field_value_value_user_id_user_id_fk",+ "tableFrom": "issue_field_value",+ "columnsFrom": [+ "value_user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_field_value_issue_id_field_id_unique": {+ "name": "issue_field_value_issue_id_field_id_unique",+ "columns": [+ "issue_id",+ "field_id"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_import": {+ "name": "issue_import",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "public_id": {+ "name": "public_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "attachment_id": {+ "name": "attachment_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'mapped'"+ },+ "mapping": {+ "name": "mapping",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "error_text": {+ "name": "error_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_import_project_idx": {+ "name": "issue_import_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issue_import_project_id_project_id_fk": {+ "name": "issue_import_project_id_project_id_fk",+ "tableFrom": "issue_import",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "project",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_import_attachment_id_chat_attachment_id_fk": {+ "name": "issue_import_attachment_id_chat_attachment_id_fk",+ "tableFrom": "issue_import",+ "columnsFrom": [+ "attachment_id"+ ],+ "tableTo": "chat_attachment",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_import_public_id_unique": {+ "name": "issue_import_public_id_unique",+ "columns": [+ "public_id"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_key_alias": {+ "name": "issue_key_alias",+ "schema": "",+ "columns": {+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "sequence_number": {+ "name": "sequence_number",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "issue_key_alias_issue_idx": {+ "name": "issue_key_alias_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issue_key_alias_project_id_project_id_fk": {+ "name": "issue_key_alias_project_id_project_id_fk",+ "tableFrom": "issue_key_alias",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "project",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_key_alias_issue_id_issue_id_fk": {+ "name": "issue_key_alias_issue_id_issue_id_fk",+ "tableFrom": "issue_key_alias",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issue",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {+ "issue_key_alias_project_id_sequence_number_pk": {+ "name": "issue_key_alias_project_id_sequence_number_pk",+ "columns": [+ "project_id",+ "sequence_number"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_label": {+ "name": "issue_label",+ "schema": "",+ "columns": {+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "label_id": {+ "name": "label_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "issue_label_issue_id_issue_id_fk": {+ "name": "issue_label_issue_id_issue_id_fk",+ "tableFrom": "issue_label",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issue",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_label_label_id_label_id_fk": {+ "name": "issue_label_label_id_label_id_fk",+ "tableFrom": "issue_label",+ "columnsFrom": [+ "label_id"+ ],+ "tableTo": "label",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {+ "issue_label_issue_id_label_id_pk": {+ "name": "issue_label_issue_id_label_id_pk",+ "columns": [+ "issue_id",+ "label_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_link": {+ "name": "issue_link",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "source_issue_id": {+ "name": "source_issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "target_issue_id": {+ "name": "target_issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_link_pair_kind_idx": {+ "name": "issue_link_pair_kind_idx",+ "columns": [+ {+ "expression": "least(\"source_issue_id\", \"target_issue_id\")",+ "isExpression": true,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "greatest(\"source_issue_id\", \"target_issue_id\")",+ "isExpression": true,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_link_source_idx": {+ "name": "issue_link_source_idx",+ "columns": [+ {+ "expression": "source_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_link_target_idx": {+ "name": "issue_link_target_idx",+ "columns": [+ {+ "expression": "target_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issue_link_source_issue_id_issue_id_fk": {+ "name": "issue_link_source_issue_id_issue_id_fk",+ "tableFrom": "issue_link",+ "columnsFrom": [+ "source_issue_id"+ ],+ "tableTo": "issue",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_link_target_issue_id_issue_id_fk": {+ "name": "issue_link_target_issue_id_issue_id_fk",+ "tableFrom": "issue_link",+ "columnsFrom": [+ "target_issue_id"+ ],+ "tableTo": "issue",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "issue_link_kind_check": {+ "name": "issue_link_kind_check",+ "value": "\"issue_link\".\"kind\" IN ('blocks', 'relates', 'duplicates')"+ },+ "issue_link_self_check": {+ "name": "issue_link_self_check",+ "value": "\"issue_link\".\"source_issue_id\" <> \"issue_link\".\"target_issue_id\""+ }+ },+ "isRLSEnabled": false+ },+ "public.issue_status": {+ "name": "issue_status",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "column_id": {+ "name": "column_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "column_name": {+ "name": "column_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "state_type": {+ "name": "state_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "entered_at": {+ "name": "entered_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "left_at": {+ "name": "left_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "issue_status_issue_idx": {+ "name": "issue_status_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "entered_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "issue_status_column_idx": {+ "name": "issue_status_column_idx",+ "columns": [+ {+ "expression": "column_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "where": "\"issue_status\".\"column_id\" IS NOT NULL",+ "concurrently": false+ },+ "issue_status_open_idx": {+ "name": "issue_status_open_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"issue_status\".\"left_at\" IS NULL",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issue_status_issue_id_issue_id_fk": {+ "name": "issue_status_issue_id_issue_id_fk",+ "tableFrom": "issue_status",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issue",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_status_column_id_project_column_id_fk": {+ "name": "issue_status_column_id_project_column_id_fk",+ "tableFrom": "issue_status",+ "columnsFrom": [+ "column_id"+ ],+ "tableTo": "project_column",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_template": {+ "name": "issue_template",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "title_template": {+ "name": "title_template",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "description_template": {+ "name": "description_template",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "type_id": {+ "name": "type_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "column_id": {+ "name": "column_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "priority": {+ "name": "priority",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "assignee_user_id": {+ "name": "assignee_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": {},+ "foreignKeys": {+ "issue_template_project_id_project_id_fk": {+ "name": "issue_template_project_id_project_id_fk",+ "tableFrom": "issue_template",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "project",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_template_type_id_issue_type_id_fk": {+ "name": "issue_template_type_id_issue_type_id_fk",+ "tableFrom": "issue_template",+ "columnsFrom": [+ "type_id"+ ],+ "tableTo": "issue_type",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_template_column_id_project_column_id_fk": {+ "name": "issue_template_column_id_project_column_id_fk",+ "tableFrom": "issue_template",+ "columnsFrom": [+ "column_id"+ ],+ "tableTo": "project_column",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "issue_template_assignee_user_id_user_id_fk": {+ "name": "issue_template_assignee_user_id_user_id_fk",+ "tableFrom": "issue_template",+ "columnsFrom": [+ "assignee_user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_template_project_id_name_unique": {+ "name": "issue_template_project_id_name_unique",+ "columns": [+ "project_id",+ "name"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_template_label": {+ "name": "issue_template_label",+ "schema": "",+ "columns": {+ "template_id": {+ "name": "template_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "label_id": {+ "name": "label_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "issue_template_label_template_id_issue_template_id_fk": {+ "name": "issue_template_label_template_id_issue_template_id_fk",+ "tableFrom": "issue_template_label",+ "columnsFrom": [+ "template_id"+ ],+ "tableTo": "issue_template",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_template_label_label_id_label_id_fk": {+ "name": "issue_template_label_label_id_label_id_fk",+ "tableFrom": "issue_template_label",+ "columnsFrom": [+ "label_id"+ ],+ "tableTo": "label",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {+ "issue_template_label_template_id_label_id_pk": {+ "name": "issue_template_label_template_id_label_id_pk",+ "columns": [+ "template_id",+ "label_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_type": {+ "name": "issue_type",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "icon": {+ "name": "icon",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'#6b7280'"+ },+ "is_default": {+ "name": "is_default",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "position": {+ "name": "position",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "issue_type_project_id_project_id_fk": {+ "name": "issue_type_project_id_project_id_fk",+ "tableFrom": "issue_type",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "project",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_type_project_id_name_unique": {+ "name": "issue_type_project_id_name_unique",+ "columns": [+ "project_id",+ "name"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_watcher": {+ "name": "issue_watcher",+ "schema": "",+ "columns": {+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "subscribed": {+ "name": "subscribed",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "issue_watcher_issue_id_issue_id_fk": {+ "name": "issue_watcher_issue_id_issue_id_fk",+ "tableFrom": "issue_watcher",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issue",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_watcher_user_id_user_id_fk": {+ "name": "issue_watcher_user_id_user_id_fk",+ "tableFrom": "issue_watcher",+ "columnsFrom": [+ "user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {+ "issue_watcher_issue_id_user_id_pk": {+ "name": "issue_watcher_issue_id_user_id_pk",+ "columns": [+ "issue_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_worklog": {+ "name": "issue_worklog",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "minutes": {+ "name": "minutes",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "spent_on": {+ "name": "spent_on",+ "type": "date",+ "primaryKey": false,+ "notNull": true+ },+ "note": {+ "name": "note",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_worklog_issue_idx": {+ "name": "issue_worklog_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "spent_on",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "issue_worklog_issue_id_issue_id_fk": {+ "name": "issue_worklog_issue_id_issue_id_fk",+ "tableFrom": "issue_worklog",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issue",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "issue_worklog_user_id_user_id_fk": {+ "name": "issue_worklog_user_id_user_id_fk",+ "tableFrom": "issue_worklog",+ "columnsFrom": [+ "user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "issue_worklog_minutes_check": {+ "name": "issue_worklog_minutes_check",+ "value": "\"issue_worklog\".\"minutes\" > 0"+ }+ },+ "isRLSEnabled": false+ },+ "public.label": {+ "name": "label",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "group_id": {+ "name": "group_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'#6b7280'"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "label_project_id_project_id_fk": {+ "name": "label_project_id_project_id_fk",+ "tableFrom": "label",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "project",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "label_group_id_label_group_id_fk": {+ "name": "label_group_id_label_group_id_fk",+ "tableFrom": "label",+ "columnsFrom": [+ "group_id"+ ],+ "tableTo": "label_group",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "label_project_id_name_unique": {+ "name": "label_project_id_name_unique",+ "columns": [+ "project_id",+ "name"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.label_group": {+ "name": "label_group",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'#6b7280'"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "label_group_project_id_project_id_fk": {+ "name": "label_group_project_id_project_id_fk",+ "tableFrom": "label_group",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "project",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "label_group_project_id_name_unique": {+ "name": "label_group_project_id_name_unique",+ "columns": [+ "project_id",+ "name"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.model_price": {+ "name": "model_price",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "model": {+ "name": "model",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "input": {+ "name": "input",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true+ },+ "output": {+ "name": "output",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true+ },+ "cache_read": {+ "name": "cache_read",+ "type": "double precision",+ "primaryKey": false,+ "notNull": false+ },+ "cache_write": {+ "name": "cache_write",+ "type": "double precision",+ "primaryKey": false,+ "notNull": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "model_price_workspace_id_workspace_id_fk": {+ "name": "model_price_workspace_id_workspace_id_fk",+ "tableFrom": "model_price",+ "columnsFrom": [+ "workspace_id"+ ],+ "tableTo": "workspace",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "model_price_workspace_id_provider_model_unique": {+ "name": "model_price_workspace_id_provider_model_unique",+ "columns": [+ "workspace_id",+ "provider",+ "model"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {+ "model_price_rates_check": {+ "name": "model_price_rates_check",+ "value": "\"model_price\".\"input\" >= 0 AND \"model_price\".\"output\" >= 0 AND coalesce(\"model_price\".\"cache_read\", 0) >= 0 AND coalesce(\"model_price\".\"cache_write\", 0) >= 0"+ }+ },+ "isRLSEnabled": false+ },+ "public.note_board": {+ "name": "note_board",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "owner_user_id": {+ "name": "owner_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "canvas": {+ "name": "canvas",+ "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": {+ "note_board_project_idx": {+ "name": "note_board_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "note_board_project_id_project_id_fk": {+ "name": "note_board_project_id_project_id_fk",+ "tableFrom": "note_board",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "project",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "note_board_owner_user_id_user_id_fk": {+ "name": "note_board_owner_user_id_user_id_fk",+ "tableFrom": "note_board",+ "columnsFrom": [+ "owner_user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "note_board_created_by_user_id_user_id_fk": {+ "name": "note_board_created_by_user_id_user_id_fk",+ "tableFrom": "note_board",+ "columnsFrom": [+ "created_by_user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.note_board_member": {+ "name": "note_board_member",+ "schema": "",+ "columns": {+ "board_id": {+ "name": "board_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "note_board_member_user_idx": {+ "name": "note_board_member_user_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "note_board_member_board_id_note_board_id_fk": {+ "name": "note_board_member_board_id_note_board_id_fk",+ "tableFrom": "note_board_member",+ "columnsFrom": [+ "board_id"+ ],+ "tableTo": "note_board",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "note_board_member_user_id_user_id_fk": {+ "name": "note_board_member_user_id_user_id_fk",+ "tableFrom": "note_board_member",+ "columnsFrom": [+ "user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {+ "note_board_member_board_id_user_id_pk": {+ "name": "note_board_member_board_id_user_id_pk",+ "columns": [+ "board_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.notification": {+ "name": "notification",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "source_activity_id": {+ "name": "source_activity_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "document_id": {+ "name": "document_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "document_comment_id": {+ "name": "document_comment_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "actor_user_id": {+ "name": "actor_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "actor_name": {+ "name": "actor_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "read_at": {+ "name": "read_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "snoozed_until": {+ "name": "snoozed_until",+ "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": {+ "notification_user_idx": {+ "name": "notification_user_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "notification_user_unread_idx": {+ "name": "notification_user_unread_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "where": "\"notification\".\"read_at\" IS NULL",+ "concurrently": false+ },+ "notification_issue_idx": {+ "name": "notification_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "where": "\"notification\".\"issue_id\" IS NOT NULL",+ "concurrently": false+ },+ "notification_source_activity_idx": {+ "name": "notification_source_activity_idx",+ "columns": [+ {+ "expression": "source_activity_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "where": "\"notification\".\"source_activity_id\" IS NOT NULL",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "notification_user_id_user_id_fk": {+ "name": "notification_user_id_user_id_fk",+ "tableFrom": "notification",+ "columnsFrom": [+ "user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "notification_project_id_project_id_fk": {+ "name": "notification_project_id_project_id_fk",+ "tableFrom": "notification",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "project",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "notification_issue_id_issue_id_fk": {+ "name": "notification_issue_id_issue_id_fk",+ "tableFrom": "notification",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issue",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "notification_source_activity_id_issue_activity_id_fk": {+ "name": "notification_source_activity_id_issue_activity_id_fk",+ "tableFrom": "notification",+ "columnsFrom": [+ "source_activity_id"+ ],+ "tableTo": "issue_activity",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "notification_document_id_project_document_id_fk": {+ "name": "notification_document_id_project_document_id_fk",+ "tableFrom": "notification",+ "columnsFrom": [+ "document_id"+ ],+ "tableTo": "project_document",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "notification_document_comment_id_document_comment_id_fk": {+ "name": "notification_document_comment_id_document_comment_id_fk",+ "tableFrom": "notification",+ "columnsFrom": [+ "document_comment_id"+ ],+ "tableTo": "document_comment",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "notification_actor_user_id_user_id_fk": {+ "name": "notification_actor_user_id_user_id_fk",+ "tableFrom": "notification",+ "columnsFrom": [+ "actor_user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "notification_type_check": {+ "name": "notification_type_check",+ "value": "\"notification\".\"type\" IN ('assigned', 'mentioned', 'commented', 'state_changed')"+ },+ "notification_target_check": {+ "name": "notification_target_check",+ "value": "(\"notification\".\"issue_id\" IS NULL) <> (\"notification\".\"document_id\" IS NULL)"+ }+ },+ "isRLSEnabled": false+ },+ "public.notification_delivery": {+ "name": "notification_delivery",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "channel": {+ "name": "channel",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "recipient": {+ "name": "recipient",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "payload": {+ "name": "payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "attempts": {+ "name": "attempts",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "next_attempt_at": {+ "name": "next_attempt_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "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()"+ }+ },+ "indexes": {+ "notification_delivery_due_idx": {+ "name": "notification_delivery_due_idx",+ "columns": [+ {+ "expression": "next_attempt_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "where": "\"notification_delivery\".\"status\" = 'pending'",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "notification_delivery_project_id_project_id_fk": {+ "name": "notification_delivery_project_id_project_id_fk",+ "tableFrom": "notification_delivery",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "project",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "notification_delivery_channel_check": {+ "name": "notification_delivery_channel_check",+ "value": "\"notification_delivery\".\"channel\" IN ('email', 'telegram')"+ }+ },+ "isRLSEnabled": false+ },+ "public.project": {+ "name": "project",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "team_id": {+ "name": "team_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "next_sequence": {+ "name": "next_sequence",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 1+ },+ "mcp_enabled": {+ "name": "mcp_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "initiatives_enabled": {+ "name": "initiatives_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "dashboards_enabled": {+ "name": "dashboards_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "documents_enabled": {+ "name": "documents_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "notes_enabled": {+ "name": "notes_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "cycles_enabled": {+ "name": "cycles_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "subtasks_enabled": {+ "name": "subtasks_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "checklists_enabled": {+ "name": "checklists_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "issue_stats_enabled": {+ "name": "issue_stats_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "points_estimate_enabled": {+ "name": "points_estimate_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "time_estimate_enabled": {+ "name": "time_estimate_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "time_logging_enabled": {+ "name": "time_logging_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": 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()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "project_team_id_team_id_fk": {+ "name": "project_team_id_team_id_fk",+ "tableFrom": "project",+ "columnsFrom": [+ "team_id"+ ],+ "tableTo": "team",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "project_team_key_uq": {+ "name": "project_team_key_uq",+ "columns": [+ "team_id",+ "key"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_action": {+ "name": "project_action",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "icon": {+ "name": "icon",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "condition": {+ "name": "condition",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "effect": {+ "name": "effect",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_action_project_idx": {+ "name": "project_action_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "project_action_project_id_project_id_fk": {+ "name": "project_action_project_id_project_id_fk",+ "tableFrom": "project_action",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "project",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_column": {+ "name": "project_column",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "state_type": {+ "name": "state_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'unstarted'"+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'#6b7280'"+ },+ "position": {+ "name": "position",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "wip_limit": {+ "name": "wip_limit",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "wip_mode": {+ "name": "wip_mode",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'soft'"+ },+ "auto_assign_user_id": {+ "name": "auto_assign_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": {},+ "foreignKeys": {+ "project_column_project_id_project_id_fk": {+ "name": "project_column_project_id_project_id_fk",+ "tableFrom": "project_column",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "project",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "project_column_auto_assign_user_id_user_id_fk": {+ "name": "project_column_auto_assign_user_id_user_id_fk",+ "tableFrom": "project_column",+ "columnsFrom": [+ "auto_assign_user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "project_column_project_id_position_unique": {+ "name": "project_column_project_id_position_unique",+ "columns": [+ "project_id",+ "position"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {+ "project_column_state_type_check": {+ "name": "project_column_state_type_check",+ "value": "\"project_column\".\"state_type\" IN ('backlog', 'unstarted', 'started', 'completed', 'canceled')"+ },+ "project_column_wip_mode_check": {+ "name": "project_column_wip_mode_check",+ "value": "\"project_column\".\"wip_mode\" IN ('soft', 'hard')"+ },+ "project_column_wip_limit_check": {+ "name": "project_column_wip_limit_check",+ "value": "\"project_column\".\"wip_limit\" IS NULL OR \"project_column\".\"wip_limit\" > 0"+ }+ },+ "isRLSEnabled": false+ },+ "public.project_dashboard": {+ "name": "project_dashboard",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "icon": {+ "name": "icon",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "layout": {+ "name": "layout",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_dashboard_project_idx": {+ "name": "project_dashboard_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "project_dashboard_project_id_project_id_fk": {+ "name": "project_dashboard_project_id_project_id_fk",+ "tableFrom": "project_dashboard",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "project",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_document": {+ "name": "project_document",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "parent_id": {+ "name": "parent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "content_json": {+ "name": "content_json",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "icon": {+ "name": "icon",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "full_width": {+ "name": "full_width",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "is_private": {+ "name": "is_private",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "is_locked": {+ "name": "is_locked",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "archived_at": {+ "name": "archived_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "archived_by_ancestor_id": {+ "name": "archived_by_ancestor_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "version": {+ "name": "version",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 1+ },+ "owner_user_id": {+ "name": "owner_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "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": {+ "project_document_project_tree_idx": {+ "name": "project_document_project_tree_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "parent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "project_document_owner_idx": {+ "name": "project_document_owner_idx",+ "columns": [+ {+ "expression": "owner_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "project_document_project_archive_idx": {+ "name": "project_document_project_archive_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "archived_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "project_document_project_id_project_id_fk": {+ "name": "project_document_project_id_project_id_fk",+ "tableFrom": "project_document",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "project",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "project_document_parent_id_project_document_id_fk": {+ "name": "project_document_parent_id_project_document_id_fk",+ "tableFrom": "project_document",+ "columnsFrom": [+ "parent_id"+ ],+ "tableTo": "project_document",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "project_document_archived_by_ancestor_id_project_document_id_fk": {+ "name": "project_document_archived_by_ancestor_id_project_document_id_fk",+ "tableFrom": "project_document",+ "columnsFrom": [+ "archived_by_ancestor_id"+ ],+ "tableTo": "project_document",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "project_document_owner_user_id_user_id_fk": {+ "name": "project_document_owner_user_id_user_id_fk",+ "tableFrom": "project_document",+ "columnsFrom": [+ "owner_user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "project_document_created_by_user_id_user_id_fk": {+ "name": "project_document_created_by_user_id_user_id_fk",+ "tableFrom": "project_document",+ "columnsFrom": [+ "created_by_user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "project_document_updated_by_user_id_user_id_fk": {+ "name": "project_document_updated_by_user_id_user_id_fk",+ "tableFrom": "project_document",+ "columnsFrom": [+ "updated_by_user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "project_document_version_check": {+ "name": "project_document_version_check",+ "value": "\"project_document\".\"version\" > 0"+ }+ },+ "isRLSEnabled": false+ },+ "public.project_document_initiative": {+ "name": "project_document_initiative",+ "schema": "",+ "columns": {+ "document_id": {+ "name": "document_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "initiative_id": {+ "name": "initiative_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "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()"+ }+ },+ "indexes": {+ "project_document_initiative_initiative_idx": {+ "name": "project_document_initiative_initiative_idx",+ "columns": [+ {+ "expression": "initiative_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "project_document_initiative_document_id_project_document_id_fk": {+ "name": "project_document_initiative_document_id_project_document_id_fk",+ "tableFrom": "project_document_initiative",+ "columnsFrom": [+ "document_id"+ ],+ "tableTo": "project_document",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "project_document_initiative_initiative_id_initiative_id_fk": {+ "name": "project_document_initiative_initiative_id_initiative_id_fk",+ "tableFrom": "project_document_initiative",+ "columnsFrom": [+ "initiative_id"+ ],+ "tableTo": "initiative",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "project_document_initiative_created_by_user_id_user_id_fk": {+ "name": "project_document_initiative_created_by_user_id_user_id_fk",+ "tableFrom": "project_document_initiative",+ "columnsFrom": [+ "created_by_user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {+ "project_document_initiative_document_id_initiative_id_pk": {+ "name": "project_document_initiative_document_id_initiative_id_pk",+ "columns": [+ "document_id",+ "initiative_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_document_issue": {+ "name": "project_document_issue",+ "schema": "",+ "columns": {+ "document_id": {+ "name": "document_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "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()"+ }+ },+ "indexes": {+ "project_document_issue_issue_idx": {+ "name": "project_document_issue_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "project_document_issue_document_id_project_document_id_fk": {+ "name": "project_document_issue_document_id_project_document_id_fk",+ "tableFrom": "project_document_issue",+ "columnsFrom": [+ "document_id"+ ],+ "tableTo": "project_document",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "project_document_issue_issue_id_issue_id_fk": {+ "name": "project_document_issue_issue_id_issue_id_fk",+ "tableFrom": "project_document_issue",+ "columnsFrom": [+ "issue_id"+ ],+ "tableTo": "issue",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "project_document_issue_created_by_user_id_user_id_fk": {+ "name": "project_document_issue_created_by_user_id_user_id_fk",+ "tableFrom": "project_document_issue",+ "columnsFrom": [+ "created_by_user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {+ "project_document_issue_document_id_issue_id_pk": {+ "name": "project_document_issue_document_id_issue_id_pk",+ "columns": [+ "document_id",+ "issue_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_document_preference": {+ "name": "project_document_preference",+ "schema": "",+ "columns": {+ "document_id": {+ "name": "document_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "is_favorite": {+ "name": "is_favorite",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_document_preference_user_idx": {+ "name": "project_document_preference_user_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "project_document_preference_document_id_project_document_id_fk": {+ "name": "project_document_preference_document_id_project_document_id_fk",+ "tableFrom": "project_document_preference",+ "columnsFrom": [+ "document_id"+ ],+ "tableTo": "project_document",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "project_document_preference_user_id_user_id_fk": {+ "name": "project_document_preference_user_id_user_id_fk",+ "tableFrom": "project_document_preference",+ "columnsFrom": [+ "user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {+ "project_document_preference_document_id_user_id_pk": {+ "name": "project_document_preference_document_id_user_id_pk",+ "columns": [+ "document_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_document_revision": {+ "name": "project_document_revision",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "document_id": {+ "name": "document_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "version": {+ "name": "version",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "parent_id": {+ "name": "parent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "content_json": {+ "name": "content_json",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "icon": {+ "name": "icon",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "full_width": {+ "name": "full_width",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "is_private": {+ "name": "is_private",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "is_locked": {+ "name": "is_locked",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "archived_at": {+ "name": "archived_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true+ },+ "owner_user_id": {+ "name": "owner_user_id",+ "type": "text",+ "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()"+ }+ },+ "indexes": {+ "project_document_revision_document_idx": {+ "name": "project_document_revision_document_idx",+ "columns": [+ {+ "expression": "document_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "version",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "project_document_revision_document_id_project_document_id_fk": {+ "name": "project_document_revision_document_id_project_document_id_fk",+ "tableFrom": "project_document_revision",+ "columnsFrom": [+ "document_id"+ ],+ "tableTo": "project_document",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "project_document_revision_owner_user_id_user_id_fk": {+ "name": "project_document_revision_owner_user_id_user_id_fk",+ "tableFrom": "project_document_revision",+ "columnsFrom": [+ "owner_user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "project_document_revision_created_by_user_id_user_id_fk": {+ "name": "project_document_revision_created_by_user_id_user_id_fk",+ "tableFrom": "project_document_revision",+ "columnsFrom": [+ "created_by_user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "project_document_revision_document_version_unique": {+ "name": "project_document_revision_document_version_unique",+ "columns": [+ "document_id",+ "version"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_member": {+ "name": "project_member",+ "schema": "",+ "columns": {+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'member'"+ },+ "role_id": {+ "name": "role_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "source": {+ "name": "source",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'invite'"+ },+ "is_favorite": {+ "name": "is_favorite",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "is_hidden": {+ "name": "is_hidden",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_member_user_idx": {+ "name": "project_member_user_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "project_member_project_id_project_id_fk": {+ "name": "project_member_project_id_project_id_fk",+ "tableFrom": "project_member",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "project",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "project_member_user_id_user_id_fk": {+ "name": "project_member_user_id_user_id_fk",+ "tableFrom": "project_member",+ "columnsFrom": [+ "user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "project_member_role_id_team_role_id_fk": {+ "name": "project_member_role_id_team_role_id_fk",+ "tableFrom": "project_member",+ "columnsFrom": [+ "role_id"+ ],+ "tableTo": "team_role",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {+ "project_member_project_id_user_id_pk": {+ "name": "project_member_project_id_user_id_pk",+ "columns": [+ "project_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "project_member_role_check": {+ "name": "project_member_role_check",+ "value": "\"project_member\".\"role\" IN ('owner', 'member')"+ },+ "project_member_source_check": {+ "name": "project_member_source_check",+ "value": "\"project_member\".\"source\" IN ('invite', 'scim')"+ }+ },+ "isRLSEnabled": false+ },+ "public.project_setting": {+ "name": "project_setting",+ "schema": "",+ "columns": {+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "value": {+ "name": "value",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "project_setting_project_id_project_id_fk": {+ "name": "project_setting_project_id_project_id_fk",+ "tableFrom": "project_setting",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "project",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {+ "project_setting_project_id_key_pk": {+ "name": "project_setting_project_id_key_pk",+ "columns": [+ "project_id",+ "key"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_template": {+ "name": "project_template",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "snapshot": {+ "name": "snapshot",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "all_teams": {+ "name": "all_teams",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "publication_id": {+ "name": "publication_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "publication_url": {+ "name": "publication_url",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "published_at": {+ "name": "published_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": {+ "project_template_workspace_idx": {+ "name": "project_template_workspace_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "project_template_workspace_id_workspace_id_fk": {+ "name": "project_template_workspace_id_workspace_id_fk",+ "tableFrom": "project_template",+ "columnsFrom": [+ "workspace_id"+ ],+ "tableTo": "workspace",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_template_team": {+ "name": "project_template_team",+ "schema": "",+ "columns": {+ "template_id": {+ "name": "template_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "team_id": {+ "name": "team_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "project_template_team_team_idx": {+ "name": "project_template_team_team_idx",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "project_template_team_template_id_project_template_id_fk": {+ "name": "project_template_team_template_id_project_template_id_fk",+ "tableFrom": "project_template_team",+ "columnsFrom": [+ "template_id"+ ],+ "tableTo": "project_template",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "project_template_team_team_id_team_id_fk": {+ "name": "project_template_team_team_id_team_id_fk",+ "tableFrom": "project_template_team",+ "columnsFrom": [+ "team_id"+ ],+ "tableTo": "team",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {+ "project_template_team_template_id_team_id_pk": {+ "name": "project_template_team_template_id_team_id_pk",+ "columns": [+ "template_id",+ "team_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_view": {+ "name": "project_view",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "icon": {+ "name": "icon",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "filters": {+ "name": "filters",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "display": {+ "name": "display",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "share_token": {+ "name": "share_token",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "share_extended": {+ "name": "share_extended",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "share_expires_at": {+ "name": "share_expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "is_private": {+ "name": "is_private",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "owner_user_id": {+ "name": "owner_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": {+ "project_view_project_idx": {+ "name": "project_view_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "project_view_owner_idx": {+ "name": "project_view_owner_idx",+ "columns": [+ {+ "expression": "owner_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "project_view_project_id_project_id_fk": {+ "name": "project_view_project_id_project_id_fk",+ "tableFrom": "project_view",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "project",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "project_view_owner_user_id_user_id_fk": {+ "name": "project_view_owner_user_id_user_id_fk",+ "tableFrom": "project_view",+ "columnsFrom": [+ "owner_user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "project_view_share_token_unique": {+ "name": "project_view_share_token_unique",+ "columns": [+ "share_token"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {+ "project_view_private_owner_check": {+ "name": "project_view_private_owner_check",+ "value": "\"project_view\".\"is_private\" = (\"project_view\".\"owner_user_id\" is not null)"+ }+ },+ "isRLSEnabled": false+ },+ "public.project_view_favorite": {+ "name": "project_view_favorite",+ "schema": "",+ "columns": {+ "view_id": {+ "name": "view_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "project_view_favorite_view_id_project_view_id_fk": {+ "name": "project_view_favorite_view_id_project_view_id_fk",+ "tableFrom": "project_view_favorite",+ "columnsFrom": [+ "view_id"+ ],+ "tableTo": "project_view",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "project_view_favorite_user_id_user_id_fk": {+ "name": "project_view_favorite_user_id_user_id_fk",+ "tableFrom": "project_view_favorite",+ "columnsFrom": [+ "user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {+ "project_view_favorite_view_id_user_id_pk": {+ "name": "project_view_favorite_view_id_user_id_pk",+ "columns": [+ "view_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_view_preference": {+ "name": "project_view_preference",+ "schema": "",+ "columns": {+ "view_id": {+ "name": "view_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "position": {+ "name": "position",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "is_hidden": {+ "name": "is_hidden",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "project_view_preference_view_id_project_view_id_fk": {+ "name": "project_view_preference_view_id_project_view_id_fk",+ "tableFrom": "project_view_preference",+ "columnsFrom": [+ "view_id"+ ],+ "tableTo": "project_view",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "project_view_preference_user_id_user_id_fk": {+ "name": "project_view_preference_user_id_user_id_fk",+ "tableFrom": "project_view_preference",+ "columnsFrom": [+ "user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {+ "project_view_preference_view_id_user_id_pk": {+ "name": "project_view_preference_view_id_user_id_pk",+ "columns": [+ "view_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.revision": {+ "name": "revision",+ "schema": "",+ "columns": {+ "scope": {+ "name": "scope",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "rev": {+ "name": "rev",+ "type": "bigint",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ }+ },+ "indexes": {+ "revision_project_idx": {+ "name": "revision_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.team": {+ "name": "team",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "slug": {+ "name": "slug",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "mcp_enabled": {+ "name": "mcp_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "default_agent_ids": {+ "name": "default_agent_ids",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "team_workspace_idx": {+ "name": "team_workspace_idx",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "team_workspace_id_workspace_id_fk": {+ "name": "team_workspace_id_workspace_id_fk",+ "tableFrom": "team",+ "columnsFrom": [+ "workspace_id"+ ],+ "tableTo": "workspace",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "team_slug_unique": {+ "name": "team_slug_unique",+ "columns": [+ "slug"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.team_invite": {+ "name": "team_invite",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "token": {+ "name": "token",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "team_id": {+ "name": "team_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "email": {+ "name": "email",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "team_role": {+ "name": "team_role",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'member'"+ },+ "project_role": {+ "name": "project_role",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "role_id": {+ "name": "role_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "invited_by_user_id": {+ "name": "invited_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "accepted_by_user_id": {+ "name": "accepted_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()"+ },+ "responded_at": {+ "name": "responded_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "team_invite_team_pending_uq": {+ "name": "team_invite_team_pending_uq",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "email",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"team_invite\".\"status\" = 'pending' AND \"team_invite\".\"project_id\" IS NULL",+ "concurrently": false+ },+ "team_invite_project_pending_uq": {+ "name": "team_invite_project_pending_uq",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "email",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"team_invite\".\"status\" = 'pending' AND \"team_invite\".\"project_id\" IS NOT NULL",+ "concurrently": false+ },+ "team_invite_team_idx": {+ "name": "team_invite_team_idx",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ },+ "team_invite_project_idx": {+ "name": "team_invite_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "team_invite_team_id_team_id_fk": {+ "name": "team_invite_team_id_team_id_fk",+ "tableFrom": "team_invite",+ "columnsFrom": [+ "team_id"+ ],+ "tableTo": "team",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "team_invite_project_id_project_id_fk": {+ "name": "team_invite_project_id_project_id_fk",+ "tableFrom": "team_invite",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "project",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "team_invite_role_id_team_role_id_fk": {+ "name": "team_invite_role_id_team_role_id_fk",+ "tableFrom": "team_invite",+ "columnsFrom": [+ "role_id"+ ],+ "tableTo": "team_role",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "team_invite_invited_by_user_id_user_id_fk": {+ "name": "team_invite_invited_by_user_id_user_id_fk",+ "tableFrom": "team_invite",+ "columnsFrom": [+ "invited_by_user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ },+ "team_invite_accepted_by_user_id_user_id_fk": {+ "name": "team_invite_accepted_by_user_id_user_id_fk",+ "tableFrom": "team_invite",+ "columnsFrom": [+ "accepted_by_user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "team_invite_token_unique": {+ "name": "team_invite_token_unique",+ "columns": [+ "token"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {+ "team_invite_team_role_check": {+ "name": "team_invite_team_role_check",+ "value": "\"team_invite\".\"team_role\" IN ('owner', 'manager', 'member')"+ },+ "team_invite_project_role_check": {+ "name": "team_invite_project_role_check",+ "value": "(\"team_invite\".\"project_id\" IS NULL AND \"team_invite\".\"project_role\" IS NULL)\n OR (\"team_invite\".\"project_id\" IS NOT NULL AND \"team_invite\".\"project_role\" IN ('owner', 'member'))"+ },+ "team_invite_status_check": {+ "name": "team_invite_status_check",+ "value": "\"team_invite\".\"status\" IN ('pending', 'accepted', 'rejected')"+ }+ },+ "isRLSEnabled": false+ },+ "public.team_member": {+ "name": "team_member",+ "schema": "",+ "columns": {+ "team_id": {+ "name": "team_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'member'"+ },+ "source": {+ "name": "source",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'invite'"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "team_member_user_idx": {+ "name": "team_member_user_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "team_member_team_id_team_id_fk": {+ "name": "team_member_team_id_team_id_fk",+ "tableFrom": "team_member",+ "columnsFrom": [+ "team_id"+ ],+ "tableTo": "team",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "team_member_user_id_user_id_fk": {+ "name": "team_member_user_id_user_id_fk",+ "tableFrom": "team_member",+ "columnsFrom": [+ "user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {+ "team_member_team_id_user_id_pk": {+ "name": "team_member_team_id_user_id_pk",+ "columns": [+ "team_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "team_member_role_check": {+ "name": "team_member_role_check",+ "value": "\"team_member\".\"role\" IN ('owner', 'manager', 'member', 'agent')"+ },+ "team_member_source_check": {+ "name": "team_member_source_check",+ "value": "\"team_member\".\"source\" IN ('invite', 'scim')"+ }+ },+ "isRLSEnabled": false+ },+ "public.team_notification_setting": {+ "name": "team_notification_setting",+ "schema": "",+ "columns": {+ "team_id": {+ "name": "team_id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true+ },+ "ciphertext": {+ "name": "ciphertext",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "iv": {+ "name": "iv",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "auth_tag": {+ "name": "auth_tag",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "redacted": {+ "name": "redacted",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "team_notification_setting_team_id_team_id_fk": {+ "name": "team_notification_setting_team_id_team_id_fk",+ "tableFrom": "team_notification_setting",+ "columnsFrom": [+ "team_id"+ ],+ "tableTo": "team",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.team_role": {+ "name": "team_role",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "team_id": {+ "name": "team_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "is_default": {+ "name": "is_default",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "permissions": {+ "name": "permissions",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "team_role_system_name_uq": {+ "name": "team_role_system_name_uq",+ "columns": [+ {+ "expression": "name",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"team_role\".\"team_id\" IS NULL",+ "concurrently": false+ },+ "team_role_system_default_uq": {+ "name": "team_role_system_default_uq",+ "columns": [+ {+ "expression": "is_default",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"team_role\".\"team_id\" IS NULL AND \"team_role\".\"is_default\"",+ "concurrently": false+ },+ "team_role_team_idx": {+ "name": "team_role_team_idx",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "team_role_team_id_team_id_fk": {+ "name": "team_role_team_id_team_id_fk",+ "tableFrom": "team_role",+ "columnsFrom": [+ "team_id"+ ],+ "tableTo": "team",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "team_role_team_id_name_unique": {+ "name": "team_role_team_id_name_unique",+ "columns": [+ "team_id",+ "name"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {+ "team_role_default_system_check": {+ "name": "team_role_default_system_check",+ "value": "\"team_role\".\"team_id\" IS NULL OR NOT \"team_role\".\"is_default\""+ }+ },+ "isRLSEnabled": false+ },+ "public.template_publisher": {+ "name": "template_publisher",+ "schema": "",+ "columns": {+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true+ },+ "email": {+ "name": "email",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "key_ciphertext": {+ "name": "key_ciphertext",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "key_iv": {+ "name": "key_iv",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "key_auth_tag": {+ "name": "key_auth_tag",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "author_name": {+ "name": "author_name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "author_url": {+ "name": "author_url",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "template_publisher_workspace_id_workspace_id_fk": {+ "name": "template_publisher_workspace_id_workspace_id_fk",+ "tableFrom": "template_publisher",+ "columnsFrom": [+ "workspace_id"+ ],+ "tableTo": "workspace",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_notification_preference": {+ "name": "user_notification_preference",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "email_events": {+ "name": "email_events",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "telegram_events": {+ "name": "telegram_events",+ "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": {},+ "foreignKeys": {+ "user_notification_preference_user_id_user_id_fk": {+ "name": "user_notification_preference_user_id_user_id_fk",+ "tableFrom": "user_notification_preference",+ "columnsFrom": [+ "user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "user_notification_preference_project_id_project_id_fk": {+ "name": "user_notification_preference_project_id_project_id_fk",+ "tableFrom": "user_notification_preference",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "project",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "user_notification_pref_user_project_unique": {+ "name": "user_notification_pref_user_project_unique",+ "columns": [+ "user_id",+ "project_id"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_preference": {+ "name": "user_preference",+ "schema": "",+ "columns": {+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "timezone": {+ "name": "timezone",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'UTC'"+ },+ "locale": {+ "name": "locale",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'en'"+ },+ "theme": {+ "name": "theme",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'system'"+ },+ "issue_open_mode": {+ "name": "issue_open_mode",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'panel'"+ },+ "start_page": {+ "name": "start_page",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'work-items'"+ },+ "show_chat_by_default": {+ "name": "show_chat_by_default",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "issue_stats_open": {+ "name": "issue_stats_open",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "issue_stats_view": {+ "name": "issue_stats_view",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'compact'"+ },+ "issue_activity_view": {+ "name": "issue_activity_view",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'flat'"+ },+ "auto_watch": {+ "name": "auto_watch",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "hotkeys": {+ "name": "hotkeys",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "last_project_id": {+ "name": "last_project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "seen_version": {+ "name": "seen_version",+ "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": {},+ "foreignKeys": {+ "user_preference_user_id_user_id_fk": {+ "name": "user_preference_user_id_user_id_fk",+ "tableFrom": "user_preference",+ "columnsFrom": [+ "user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "user_preference_last_project_id_project_id_fk": {+ "name": "user_preference_last_project_id_project_id_fk",+ "tableFrom": "user_preference",+ "columnsFrom": [+ "last_project_id"+ ],+ "tableTo": "project",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "user_preference_theme_check": {+ "name": "user_preference_theme_check",+ "value": "\"user_preference\".\"theme\" IN ('light', 'dark', 'system')"+ },+ "user_preference_issue_open_mode_check": {+ "name": "user_preference_issue_open_mode_check",+ "value": "\"user_preference\".\"issue_open_mode\" IN ('panel', 'page')"+ },+ "user_preference_start_page_check": {+ "name": "user_preference_start_page_check",+ "value": "\"user_preference\".\"start_page\" IN ('inbox', 'dashboard', 'work-items', 'initiatives')"+ },+ "user_preference_issue_stats_view_check": {+ "name": "user_preference_issue_stats_view_check",+ "value": "\"user_preference\".\"issue_stats_view\" IN ('compact', 'timeline')"+ },+ "user_preference_issue_activity_view_check": {+ "name": "user_preference_issue_activity_view_check",+ "value": "\"user_preference\".\"issue_activity_view\" IN ('flat', 'grouped')"+ }+ },+ "isRLSEnabled": false+ },+ "public.user_telegram_account": {+ "name": "user_telegram_account",+ "schema": "",+ "columns": {+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "chat_id": {+ "name": "chat_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "username": {+ "name": "username",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "first_name": {+ "name": "first_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "link_code": {+ "name": "link_code",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "link_code_expires_at": {+ "name": "link_code_expires_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "linked_at": {+ "name": "linked_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": {+ "user_telegram_account_chat_id_unique": {+ "name": "user_telegram_account_chat_id_unique",+ "columns": [+ {+ "expression": "chat_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"user_telegram_account\".\"chat_id\" IS NOT NULL",+ "concurrently": false+ },+ "user_telegram_account_link_code_unique": {+ "name": "user_telegram_account_link_code_unique",+ "columns": [+ {+ "expression": "link_code",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"user_telegram_account\".\"link_code\" IS NOT NULL",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "user_telegram_account_user_id_user_id_fk": {+ "name": "user_telegram_account_user_id_user_id_fk",+ "tableFrom": "user_telegram_account",+ "columnsFrom": [+ "user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.webhook": {+ "name": "webhook",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "url": {+ "name": "url",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "secret": {+ "name": "secret",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "events": {+ "name": "events",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "is_active": {+ "name": "is_active",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "consecutive_failures": {+ "name": "consecutive_failures",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "webhook_project_idx": {+ "name": "webhook_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "webhook_project_id_project_id_fk": {+ "name": "webhook_project_id_project_id_fk",+ "tableFrom": "webhook",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "project",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.webhook_delivery": {+ "name": "webhook_delivery",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "webhook_id": {+ "name": "webhook_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "event_id": {+ "name": "event_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "event_type": {+ "name": "event_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "payload": {+ "name": "payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "attempts": {+ "name": "attempts",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "next_attempt_at": {+ "name": "next_attempt_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "last_error": {+ "name": "last_error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "response_status": {+ "name": "response_status",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "response_body": {+ "name": "response_body",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "webhook_delivery_due_idx": {+ "name": "webhook_delivery_due_idx",+ "columns": [+ {+ "expression": "next_attempt_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "where": "\"webhook_delivery\".\"status\" = 'pending'",+ "concurrently": false+ },+ "webhook_delivery_webhook_idx": {+ "name": "webhook_delivery_webhook_idx",+ "columns": [+ {+ "expression": "webhook_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "webhook_delivery_webhook_id_webhook_id_fk": {+ "name": "webhook_delivery_webhook_id_webhook_id_fk",+ "tableFrom": "webhook_delivery",+ "columnsFrom": [+ "webhook_id"+ ],+ "tableTo": "webhook",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.workspace": {+ "name": "workspace",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "team_creation": {+ "name": "team_creation",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'owner'"+ },+ "max_concurrent_runs": {+ "name": "max_concurrent_runs",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "workspace_team_creation_check": {+ "name": "workspace_team_creation_check",+ "value": "\"workspace\".\"team_creation\" IN ('owner', 'managers', 'members')"+ },+ "workspace_max_concurrent_runs_check": {+ "name": "workspace_max_concurrent_runs_check",+ "value": "\"workspace\".\"max_concurrent_runs\" >= 0"+ }+ },+ "isRLSEnabled": false+ },+ "public.workspace_manager": {+ "name": "workspace_manager",+ "schema": "",+ "columns": {+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'admin'"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "workspace_manager_owner_uq": {+ "name": "workspace_manager_owner_uq",+ "columns": [+ {+ "expression": "workspace_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"workspace_manager\".\"role\" = 'owner'",+ "concurrently": false+ },+ "workspace_manager_user_idx": {+ "name": "workspace_manager_user_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "workspace_manager_workspace_id_workspace_id_fk": {+ "name": "workspace_manager_workspace_id_workspace_id_fk",+ "tableFrom": "workspace_manager",+ "columnsFrom": [+ "workspace_id"+ ],+ "tableTo": "workspace",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "workspace_manager_user_id_user_id_fk": {+ "name": "workspace_manager_user_id_user_id_fk",+ "tableFrom": "workspace_manager",+ "columnsFrom": [+ "user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {+ "workspace_manager_workspace_id_user_id_pk": {+ "name": "workspace_manager_workspace_id_user_id_pk",+ "columns": [+ "workspace_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "workspace_manager_role_check": {+ "name": "workspace_manager_role_check",+ "value": "\"workspace_manager\".\"role\" IN ('owner', 'admin')"+ }+ },+ "isRLSEnabled": false+ },+ "public.scim_group": {+ "name": "scim_group",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "display_name": {+ "name": "display_name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "external_id": {+ "name": "external_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": {+ "scim_group_instance_display_name_uq": {+ "name": "scim_group_instance_display_name_uq",+ "columns": [+ {+ "expression": "display_name",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"scim_group\".\"workspace_id\" IS NULL",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "scim_group_workspace_id_workspace_id_fk": {+ "name": "scim_group_workspace_id_workspace_id_fk",+ "tableFrom": "scim_group",+ "columnsFrom": [+ "workspace_id"+ ],+ "tableTo": "workspace",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "scim_group_workspace_id_display_name_unique": {+ "name": "scim_group_workspace_id_display_name_unique",+ "columns": [+ "workspace_id",+ "display_name"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.scim_group_mapping": {+ "name": "scim_group_mapping",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "group_id": {+ "name": "group_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'member'"+ },+ "role_id": {+ "name": "role_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "scim_group_mapping_project_idx": {+ "name": "scim_group_mapping_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "scim_group_mapping_group_id_scim_group_id_fk": {+ "name": "scim_group_mapping_group_id_scim_group_id_fk",+ "tableFrom": "scim_group_mapping",+ "columnsFrom": [+ "group_id"+ ],+ "tableTo": "scim_group",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "scim_group_mapping_project_id_project_id_fk": {+ "name": "scim_group_mapping_project_id_project_id_fk",+ "tableFrom": "scim_group_mapping",+ "columnsFrom": [+ "project_id"+ ],+ "tableTo": "project",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "scim_group_mapping_role_id_team_role_id_fk": {+ "name": "scim_group_mapping_role_id_team_role_id_fk",+ "tableFrom": "scim_group_mapping",+ "columnsFrom": [+ "role_id"+ ],+ "tableTo": "team_role",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "set null"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "scim_group_mapping_group_id_project_id_unique": {+ "name": "scim_group_mapping_group_id_project_id_unique",+ "columns": [+ "group_id",+ "project_id"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {+ "scim_group_mapping_role_check": {+ "name": "scim_group_mapping_role_check",+ "value": "\"scim_group_mapping\".\"role\" IN ('owner', 'member')"+ }+ },+ "isRLSEnabled": false+ },+ "public.scim_group_member": {+ "name": "scim_group_member",+ "schema": "",+ "columns": {+ "group_id": {+ "name": "group_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "scim_group_member_user_idx": {+ "name": "scim_group_member_user_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "scim_group_member_group_id_scim_group_id_fk": {+ "name": "scim_group_member_group_id_scim_group_id_fk",+ "tableFrom": "scim_group_member",+ "columnsFrom": [+ "group_id"+ ],+ "tableTo": "scim_group",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "scim_group_member_user_id_user_id_fk": {+ "name": "scim_group_member_user_id_user_id_fk",+ "tableFrom": "scim_group_member",+ "columnsFrom": [+ "user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {+ "scim_group_member_group_id_user_id_pk": {+ "name": "scim_group_member_group_id_user_id_pk",+ "columns": [+ "group_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.scim_user": {+ "name": "scim_user",+ "schema": "",+ "columns": {+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "external_id": {+ "name": "external_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "active": {+ "name": "active",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "scim_user_instance_user_uq": {+ "name": "scim_user_instance_user_uq",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "with": {},+ "method": "btree",+ "where": "\"scim_user\".\"workspace_id\" IS NULL",+ "concurrently": false+ },+ "scim_user_user_idx": {+ "name": "scim_user_user_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "with": {},+ "method": "btree",+ "concurrently": false+ }+ },+ "foreignKeys": {+ "scim_user_workspace_id_workspace_id_fk": {+ "name": "scim_user_workspace_id_workspace_id_fk",+ "tableFrom": "scim_user",+ "columnsFrom": [+ "workspace_id"+ ],+ "tableTo": "workspace",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ },+ "scim_user_user_id_user_id_fk": {+ "name": "scim_user_user_id_user_id_fk",+ "tableFrom": "scim_user",+ "columnsFrom": [+ "user_id"+ ],+ "tableTo": "user",+ "columnsTo": [+ "id"+ ],+ "onUpdate": "no action",+ "onDelete": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "scim_user_workspace_id_user_id_unique": {+ "name": "scim_user_workspace_id_user_id_unique",+ "columns": [+ "workspace_id",+ "user_id"+ ],+ "nullsNotDistinct": false+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ }+ },+ "enums": {},+ "schemas": {},+ "views": {},+ "sequences": {},+ "roles": {},+ "policies": {},+ "_meta": {+ "columns": {},+ "schemas": {},+ "tables": {}+ }+}\ No newline at end of filediff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.jsonindex a53ee204..3589b2e3 100644--- a/packages/db/drizzle/meta/_journal.json+++ b/packages/db/drizzle/meta/_journal.json@@ -1219,6 +1219,13 @@"when": 1793713887371,"tag": "0173_template_gallery","breakpoints": true+ },+ {+ "idx": 174,+ "version": "7",+ "when": 1793804244937,+ "tag": "0174_agent_schedules_permission",+ "breakpoints": true}]}\ No newline at end of filediff --git a/packages/db/src/permissions.ts b/packages/db/src/permissions.tsindex 9c0e8100..0ee1f675 100644--- a/packages/db/src/permissions.ts+++ b/packages/db/src/permissions.ts@@ -3,7 +3,7 @@// enforced by the API (apps/api/src/shared/access.ts). Owners bypass the matrix// entirely (full access).-export const PERMISSION_RESOURCES = [+const CORE_RESOURCES = ['work_items','initiatives','cycles',@@ -16,6 +16,7 @@ export const PERMISSION_RESOURCES = ['issue_types','labels','ai_agents',+ 'agent_schedules','integrations','agent_skills','agent_tools',@@ -30,7 +31,10 @@ export const PERMISSION_RESOURCES = ['import_export','danger_zone',] as const;-export type PermissionResource = (typeof PERMISSION_RESOURCES)[number];+export type PermissionResource = (typeof CORE_RESOURCES)[number];++// The resources in the order a matrix lists them, with those setPermissionExtensions added.+export const PERMISSION_RESOURCES: PermissionResource[] = [...CORE_RESOURCES];export const PERMISSION_ACTIONS = ['create', 'edit', 'read', 'delete'] as const;export type PermissionAction = (typeof PERMISSION_ACTIONS)[number];@@ -52,8 +56,40 @@ const RESOURCE_ACTIONS: Partial<Record<PermissionResource, readonly PermissionAcmembers_invite: ['read', 'create', 'delete'],};+// A resource a build splits out of one the core has.+export interface PermissionExtension {+ resource: string;+ // It is listed after this resource, supports the same actions unless `actions` says+ // otherwise, and a role saved before it existed holds here what it holds there.+ from: PermissionResource;+ actions?: readonly PermissionAction[];+}++const extensions = new Map<string, PermissionExtension>();++// For a build that extends the matrix: called at startup, before any request. Called with+// no argument it puts the core's matrix back, which is how a test undoes one.+export function setPermissionExtensions(list: PermissionExtension[] = []): void {+ extensions.clear();+ PERMISSION_RESOURCES.splice(0, PERMISSION_RESOURCES.length, ...CORE_RESOURCES);+ // In reverse, since each goes right after `from`: the list keeps its order.+ for (const extension of [...list].reverse()) {+ extensions.set(extension.resource, extension);+ PERMISSION_RESOURCES.splice(+ PERMISSION_RESOURCES.indexOf(extension.from) + 1,+ 0,+ extension.resource as PermissionResource,+ );+ }+}++export function extendedFrom(resource: PermissionResource): PermissionResource | undefined {+ return extensions.get(resource)?.from;+}+export function resourceActions(resource: PermissionResource): readonly PermissionAction[] {- return RESOURCE_ACTIONS[resource] ?? PERMISSION_ACTIONS;+ const extension = extensions.get(resource);+ return extension?.actions ?? RESOURCE_ACTIONS[extension?.from ?? resource] ?? PERMISSION_ACTIONS;}function allowAll(resource: PermissionResource): ResourcePermissions {@@ -78,19 +114,33 @@ export function fullPermissions(): Permissions {return Object.fromEntries(PERMISSION_RESOURCES.map((r) => [r, allowAll(r)])) as Permissions;}-// The matrix of the default system role ("Member") as migrations 0160 and 0162 leave it.-// A member with no role resolves to it.+// The matrix of the default system role ("Member") as migrations 0160, 0162 and 0174 leave+// it. A member with no role resolves to it.export function defaultMemberPermissions(): Permissions {- const p = emptyPermissions();- for (const r of ['work_items', 'initiatives', 'cycles', 'documents', 'note_boards'] as const) {- p[r] = allowAll(r);- }- p.dashboards.read = true;- p.views.read = true;- p.ai_agents.read = true;- p.members_manage.read = true;- p.members_invite.read = true;- return p;+ const all = { create: true, edit: true, read: true, delete: true };+ const read = { read: true };+ const member: Partial<Record<PermissionResource, Partial<ResourcePermissions>>> = {+ work_items: all,+ initiatives: all,+ cycles: all,+ documents: all,+ note_boards: all,+ dashboards: read,+ views: read,+ ai_agents: read,+ agent_schedules: read,+ members_manage: read,+ members_invite: read,+ };+ return normalizePermissions(member);+}++function normalizeResource(resource: PermissionResource, entry: unknown): ResourcePermissions {+ const e = (entry && typeof entry === 'object' ? entry : {}) as Record<string, unknown>;+ const allowed = resourceActions(resource);+ return Object.fromEntries(+ PERMISSION_ACTIONS.map((a) => [a, allowed.includes(a) && e[a] === true]),+ ) as ResourcePermissions;}// Coerces arbitrary input (a jsonb blob or a request body) into the canonical@@ -98,18 +148,13 @@ export function defaultMemberPermissions(): Permissions {// keys dropped, missing entries and actions the resource does not support// defaulted to false.export function normalizePermissions(input: unknown): Permissions {- const out = emptyPermissions();- if (!input || typeof input !== 'object') return out;- const src = input as Record<string, unknown>;- for (const resource of PERMISSION_RESOURCES) {- const entry = src[resource];- if (!entry || typeof entry !== 'object') continue;- const e = entry as Record<string, unknown>;- for (const action of resourceActions(resource)) {- out[resource][action] = e[action] === true;- }- }- return out;+ const src = (input && typeof input === 'object' ? input : {}) as Record<string, unknown>;+ return Object.fromEntries(+ PERMISSION_RESOURCES.map((resource) => {+ const from = extendedFrom(resource);+ return [resource, normalizeResource(resource, src[resource] ?? (from && src[from]))];+ }),+ ) as Permissions;}export function hasPermission(