⭐️⭐️⭐️ 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: save projects as team templates and create projects from them (#763)
Croffc7ef550b6363
diff --git a/apps/api/src/app.ts b/apps/api/src/app.tsindex 791fe113..9c34b0d7 100644--- a/apps/api/src/app.ts+++ b/apps/api/src/app.ts@@ -126,6 +126,10 @@ export const app = new Elysia()tags: [{ name: 'Projects', description: 'Projects and the full work items view' },{ name: 'Teams', description: 'Teams that own projects' },+ {+ name: 'Project Templates',+ description: 'Saved project configurations new projects are created from',+ },{ name: 'Workspaces', description: 'Workspaces that own teams, and who manages them' },{ name: 'Members', description: 'Project membership and roles' },{ name: 'Roles', description: 'Project roles and their permissions' },diff --git a/apps/api/src/modules/agents/core/service.ts b/apps/api/src/modules/agents/core/service.tsindex 1d56bfd3..02e4fbb9 100644--- a/apps/api/src/modules/agents/core/service.ts+++ b/apps/api/src/modules/agents/core/service.ts@@ -571,7 +571,9 @@ async function resolveTeamProjectIds(teamId: number, projectIds: number[]): Promconst rows = await db.select({ id: project.id }).from(project)- .where(and(eq(project.teamId, teamId), inArray(project.id, wanted)));+ .where(+ and(eq(project.teamId, teamId), inArray(project.id, wanted), eq(project.isTemplate, false)),+ );if (rows.length !== wanted.length) throw new HttpError(400, 'Project not found in this team');return rows.map((row) => row.id);}diff --git a/apps/api/src/modules/god/service.ts b/apps/api/src/modules/god/service.tsindex 60ec2320..69286adc 100644--- a/apps/api/src/modules/god/service.ts+++ b/apps/api/src/modules/god/service.ts@@ -546,9 +546,10 @@ export async function listInstanceProjects(options: {offset: number;}): Promise<InstanceProjectPage> {const term = options.search?.trim();- const where = term- ? or(ilike(project.key, `%${term}%`), ilike(project.name, `%${term}%`))- : undefined;+ const where = and(+ eq(project.isTemplate, false),+ term ? or(ilike(project.key, `%${term}%`), ilike(project.name, `%${term}%`)) : undefined,+ );const [rows, totals] = await Promise.all([db@@ -685,7 +686,7 @@ async function loadTeamCounts(teamIds: number[]): Promise<(id: number) => Instanconst [members, projects, issues, agents, skills, tools, roles] = await Promise.all([countByOwner(teamMember, teamMember.teamId, teamIds),- countByOwner(project, project.teamId, teamIds),+ countByOwner(project, project.teamId, teamIds, eq(project.isTemplate, false)),// Issues have no team column; they reach one through their project.db.select({ teamId: project.teamId, count: sql<number>`count(*)::int` })@@ -770,6 +771,7 @@ export async function listInstanceTeamProjects(const term = options.search?.trim();const where = and(eq(project.teamId, teamId),+ eq(project.isTemplate, false),term ? or(ilike(project.key, `%${term}%`), ilike(project.name, `%${term}%`)) : undefined,);diff --git a/apps/api/src/modules/project-templates/__tests__/integration/project-templates.test.ts b/apps/api/src/modules/project-templates/__tests__/integration/project-templates.test.tsnew file mode 100644index 00000000..04dcabf5--- /dev/null+++ b/apps/api/src/modules/project-templates/__tests__/integration/project-templates.test.ts@@ -0,0 +1,260 @@+import { beforeEach, describe, expect, it } from 'bun:test';+import { authedApi, type Api, createProject } from '#tests/helpers/app';+import { signUpTestUser } from '#tests/helpers/auth';+import { resetDb } from '#tests/helpers/db';+import { createAgent } from '#tests/helpers/agents';++async function signUpClient() {+ const user = await signUpTestUser();+ return { user, api: authedApi(user.cookie) };+}++async function ownTeamId(api: Api): Promise<number> {+ return (await api.teams.get()).data![0].id;+}++// Signs up a user, invites them into the team on the given rank and accepts for them.+async function addTeamMember(owner: Api, teamId: number, role: 'manager' | 'member') {+ const user = await signUpTestUser();+ const created = await owner.teams({ teamId }).invites.post({ email: user.email, role });+ const api = authedApi(user.cookie);+ await api.invites({ token: created.data!.token }).accept.post();+ return api;+}++// A team with the project SRC, which has the label "bug", saved as the template "Kanban".+async function setup() {+ const { api } = await signUpClient();+ const teamId = await ownTeamId(api);+ const source = (await createProject(api, { key: 'SRC', name: 'Source' })).data!;+ await api.projects({ projectKey: 'SRC' }).labels.post({ name: 'bug', color: '#ff0000' });+ const saved = await api+ .teams({ teamId })+ ['project-templates'].post({ projectId: source.id, name: 'Kanban', description: 'Our board' });+ expect(saved.status).toBe(201);+ return { api, teamId, source, template: saved.data! };+}++describe('project templates', () => {+ beforeEach(resetDb);++ describe('save', () => {+ it('lists the template and leaves it out of every project list', async () => {+ const { api, teamId, template } = await setup();+ expect(template).toMatchObject({ name: 'Kanban', description: 'Our board' });++ const list = await api.teams({ teamId })['project-templates'].get();+ expect(list.status).toBe(200);+ expect(list.data).toMatchObject([{ id: template.id, name: 'Kanban' }]);++ // The first account owns its workspace, so it reaches every project of it.+ expect((await api.projects.get()).data?.map((p) => p.key)).toEqual(['SRC']);+ expect((await api.projects.search.get({ query: {} })).data?.total).toBe(1);+ const teamProjects = await api.teams({ teamId }).projects.get();+ expect(teamProjects.data?.items.map((p) => p.key)).toEqual(['SRC']);+ expect((await api.teams.get()).data![0]).toMatchObject({ projectCount: 1, templateCount: 1 });+ const asProject = await api.teams({ teamId }).projects({ projectId: template.id }).get();+ expect(asProject.status).toBe(404);+ });++ it('keeps what was saved when the project changes later', async () => {+ const { api, teamId, template } = await setup();+ await api.projects({ projectKey: 'SRC' }).labels.post({ name: 'later', color: '#00ff00' });++ await api+ .teams({ teamId })+ .projects.post({ key: 'NEW', name: 'New', templateId: template.id });++ const view = await api.projects({ projectKey: 'NEW' }).get();+ expect(view.data?.labels.map((l) => l.name)).toEqual(['bug']);+ });++ it('leaves out the docs and the webhooks', async () => {+ const { api, teamId, source } = await setup();+ const sourceApi = api.projects({ projectKey: 'SRC' });+ await sourceApi.documents.post({ title: 'Runbook' });+ await sourceApi.webhooks.post({ url: 'https://example.com/hook', events: ['issue.created'] });+ const saved = await api.teams({ teamId })['project-templates'].post({+ projectId: source.id,+ name: 'Everything',+ include: { documents: true, webhooks: true },+ });++ await api+ .teams({ teamId })+ .projects.post({ key: 'NEW', name: 'New', templateId: saved.data!.id });++ const created = api.projects({ projectKey: 'NEW' });+ expect((await created.documents.get({ query: {} })).data).toEqual([]);+ expect((await created.webhooks.get()).data).toEqual([]);+ });++ it('saves only the chosen sections', async () => {+ const { api, teamId, source } = await setup();+ const saved = await api.teams({ teamId })['project-templates'].post({+ projectId: source.id,+ name: 'States only',+ include: { states: true },+ });++ await api+ .teams({ teamId })+ .projects.post({ key: 'NEW', name: 'New', templateId: saved.data!.id });++ const view = await api.projects({ projectKey: 'NEW' }).get();+ expect(view.data?.labels).toEqual([]);+ });++ it('rejects an empty name', async () => {+ const { api, teamId, source } = await setup();+ const saved = await api+ .teams({ teamId })+ ['project-templates'].post({ projectId: source.id, name: '' });+ expect(saved.status).toBe(400);+ });++ it('404s for a project of another team and for a template', async () => {+ const { api, teamId, template } = await setup();+ const other = await signUpClient();+ const otherProject = (await createProject(other.api, { key: 'OTH', name: 'Other' })).data!;++ const fromOther = await api+ .teams({ teamId })+ ['project-templates'].post({ projectId: otherProject.id, name: 'Theirs' });+ expect(fromOther.status).toBe(404);+ const fromTemplate = await api+ .teams({ teamId })+ ['project-templates'].post({ projectId: template.id, name: 'Again' });+ expect(fromTemplate.status).toBe(404);+ });++ it('is left to the owners and managers of the team', async () => {+ const { api, teamId, source, template } = await setup();+ const member = await addTeamMember(api, teamId, 'member');+ const manager = await addTeamMember(api, teamId, 'manager');++ const templates = member.teams({ teamId })['project-templates'];+ expect((await templates.get()).status).toBe(403);+ expect((await templates({ templateId: template.id }).get()).status).toBe(403);+ expect((await templates.post({ projectId: source.id, name: 'Mine' })).status).toBe(403);+ expect((await templates({ templateId: template.id }).delete()).status).toBe(403);++ const saved = await manager+ .teams({ teamId })+ ['project-templates'].post({ projectId: source.id, name: 'Manager' });+ expect(saved.status).toBe(201);+ });+ });++ describe('detail', () => {+ it('shows what the template holds', async () => {+ const { api, teamId, template } = await setup();++ const detail = await api+ .teams({ teamId })+ ['project-templates']({ templateId: template.id })+ .get();+ expect(detail.status).toBe(200);+ expect(detail.data).toMatchObject({+ id: template.id,+ name: 'Kanban',+ description: 'Our board',+ labels: [{ name: 'bug' }],+ issueTypes: [{ name: 'Task' }],+ estimates: { points: false, time: false, logging: false },+ sections: [],+ });+ expect(detail.data?.columns.map((c) => c.name)).toEqual([+ 'Backlog',+ 'Todo',+ 'In Progress',+ 'Done',+ 'Canceled',+ ]);+ });++ it('404s for a project and for a template of another team', async () => {+ const { api, teamId, source } = await setup();+ const other = await setup();+ const templates = api.teams({ teamId })['project-templates'];++ expect((await templates({ templateId: source.id }).get()).status).toBe(404);+ expect((await templates({ templateId: other.template.id }).get()).status).toBe(404);+ });+ });++ describe('create a project from a template', () => {+ it('takes what the template holds and the default agents', async () => {+ const { api, teamId, template } = await setup();+ const agent = (+ await createAgent(api, 'SRC', { name: 'Triage', username: 'triage', kind: 'external' })+ ).data!.agent;+ await api.teams({ teamId })['project-defaults'].patch({ defaultAgentIds: [agent.id] });++ const created = await api+ .teams({ teamId })+ .projects.post({ key: 'NEW', name: 'New', templateId: template.id });+ expect(created.status).toBe(201);+ expect(created.data).toMatchObject({ key: 'NEW', name: 'New', teamId });++ const view = (await api.projects({ projectKey: 'NEW' }).get()).data!;+ expect(view.viewer.role).toBe('owner');+ expect(view.labels.map((l) => l.name)).toEqual(['bug']);+ const members = await api.projects({ projectKey: 'NEW' }).members.get();+ expect(members.data?.items.map((m) => m.userId)).toContain(agent.userId);+ });++ it("404s for another team's template and for a project", async () => {+ const { api, teamId, source } = await setup();+ const other = await setup();++ const fromOther = await api+ .teams({ teamId })+ .projects.post({ key: 'NEW', name: 'New', templateId: other.template.id });+ expect(fromOther.status).toBe(404);+ const fromProject = await api+ .teams({ teamId })+ .projects.post({ key: 'NEW', name: 'New', templateId: source.id });+ expect(fromProject.status).toBe(404);+ });+ });++ describe('delete', () => {+ it('deletes the template and keeps the projects created from it', async () => {+ const { api, teamId, template } = await setup();+ await api+ .teams({ teamId })+ .projects.post({ key: 'NEW', name: 'New', templateId: template.id });++ const deleted = await api+ .teams({ teamId })+ ['project-templates']({ templateId: template.id })+ .delete();+ expect(deleted.status).toBe(204);+ expect((await api.teams({ teamId })['project-templates'].get()).data).toEqual([]);+ expect((await api.projects({ projectKey: 'NEW' }).get()).status).toBe(200);+ });++ it('404s for a project, leaving it in place', async () => {+ const { api, teamId, source } = await setup();++ const deleted = await api+ .teams({ teamId })+ ['project-templates']({ templateId: source.id })+ .delete();+ expect(deleted.status).toBe(404);+ expect((await api.projects({ projectKey: 'SRC' }).get()).status).toBe(200);+ });++ it('goes with its team', async () => {+ await signUpTestUser();+ const { api } = await signUpClient();+ const teamId = await ownTeamId(api);+ const project = (await createProject(api, { key: 'OPS', name: 'Operations' })).data!;+ await api.teams({ teamId })['project-templates'].post({ projectId: project.id, name: 'Ops' });+ await api.teams({ teamId }).projects({ projectId: project.id }).delete();++ expect((await api.teams({ teamId }).delete()).status).toBe(204);+ });+ });+});diff --git a/apps/api/src/modules/project-templates/index.ts b/apps/api/src/modules/project-templates/index.tsnew file mode 100644index 00000000..6499c48e--- /dev/null+++ b/apps/api/src/modules/project-templates/index.ts@@ -0,0 +1,103 @@+import { Elysia, t } from 'elysia';+import { noContent } from '#shared/http';+import { guards } from '#shared/guards';+import { errors } from '#shared/responses';+import { mcpTool } from '#mcp/generate';+import { teamParams } from '#modules/teams/model';+import {+ ProjectTemplateDetailResponse,+ ProjectTemplateListResponse,+ ProjectTemplateResponse,+ projectTemplateParams,+ saveProjectTemplateBody,+} from './model';+import {+ deleteProjectTemplate,+ getProjectTemplate,+ listProjectTemplates,+ saveProjectTemplate,+} from './service';++// The project templates of a team: saved copies of a project's configuration that new+// projects are created from (POST /teams/:teamId/projects with templateId). They are+// run by the team's owners and managers, who create its projects.+export const projectTemplateRoutes = new Elysia({+ name: 'project-templates',+ detail: { tags: ['Project Templates'] },+})+ .use(guards)++ .get(+ '/teams/:teamId/project-templates',+ ({ membership }) => listProjectTemplates(membership.teamId),+ {+ teamManager: true,+ params: teamParams,+ response: { 200: ProjectTemplateListResponse, ...errors(401, 403, 404) },+ detail: {+ summary: 'List project templates',+ description:+ 'Every project template of the team, by name. Pass its id as templateId to ' ++ 'create_project to create a project from it.',+ ...mcpTool('list_project_templates'),+ },+ },+ )++ .get(+ '/teams/:teamId/project-templates/:templateId',+ ({ membership, params }) =>+ getProjectTemplate(membership.teamId, params.templateId, membership.userId),+ {+ teamManager: true,+ params: projectTemplateParams,+ response: { 200: ProjectTemplateDetailResponse, ...errors(401, 403, 404) },+ detail: {+ summary: 'Get a project template',+ description:+ 'What a project template holds: its states, issue types, labels, custom fields, ' ++ 'issue templates, views, dashboards, actions, the sections it turns on and its ' ++ 'estimates.',+ ...mcpTool('get_project_template'),+ },+ },+ )++ .post(+ '/teams/:teamId/project-templates',+ async ({ body, membership, set }) => {+ set.status = 201;+ return saveProjectTemplate(membership.teamId, body, membership.userId);+ },+ {+ teamManager: true,+ params: teamParams,+ body: saveProjectTemplateBody,+ response: { 201: ProjectTemplateResponse, ...errors(400, 401, 403, 404, 409) },+ detail: {+ summary: 'Save a project as a template',+ description:+ "Save a copy of a team project's configuration, without its issues, as a project " ++ 'template. Later changes to the project do not change the template. `include` ' ++ 'chooses the sections as for a copy; docs, webhooks, agents and schedules are ' ++ 'never saved.',+ },+ },+ )++ .delete(+ '/teams/:teamId/project-templates/:templateId',+ async ({ membership, params }) => {+ await deleteProjectTemplate(membership.teamId, params.templateId);+ return noContent();+ },+ {+ teamManager: true,+ params: projectTemplateParams,+ response: { 204: t.Void(), ...errors(401, 403, 404) },+ detail: {+ summary: 'Delete a project template',+ description: 'Delete a project template. Projects created from it are not changed.',+ },+ },+ );diff --git a/apps/api/src/modules/project-templates/model.ts b/apps/api/src/modules/project-templates/model.tsnew file mode 100644index 00000000..7e8b5980--- /dev/null+++ b/apps/api/src/modules/project-templates/model.ts@@ -0,0 +1,56 @@+import { t } from 'elysia';+import {+ copyInclude,+ EstimatesResponse,+ FeaturesResponse,+ PROJECT_DESCRIPTION_LIMIT,+} from '#modules/projects/model';+import { ColumnResponse } from '#modules/columns/model';+import { IssueTypeResponse } from '#modules/issue-types/model';+import { LabelGroupResponse, LabelResponse } from '#modules/labels/model';+import { CustomFieldResponse } from '#modules/custom-fields/model';+import { IssueTemplateListResponse } from '#modules/issue-templates/model';+import { ViewResponse } from '#modules/views/model';+import { DashboardListResponse } from '#modules/dashboards/model';+import { ActionListResponse } from '#modules/actions/model';++export const projectTemplateParams = t.Object({ teamId: t.Numeric(), templateId: t.Numeric() });++export const saveProjectTemplateBody = t.Object({+ projectId: t.Integer({ description: 'The project of the team to save as a template.' }),+ name: t.String({ minLength: 1 }),+ description: t.Optional(t.String({ maxLength: PROJECT_DESCRIPTION_LIMIT })),+ include: copyInclude,+});++export const ProjectTemplateResponse = t.Object({+ id: t.Number(),+ name: t.String(),+ description: t.String(),+ createdAt: t.String(),+});++export const ProjectTemplateListResponse = t.Array(ProjectTemplateResponse);++export const ProjectTemplateDetailResponse = t.Composite([+ ProjectTemplateResponse,+ t.Object({+ columns: t.Array(ColumnResponse),+ issueTypes: t.Array(IssueTypeResponse),+ labels: t.Array(LabelResponse),+ labelGroups: t.Array(LabelGroupResponse),+ customFields: t.Array(CustomFieldResponse),+ issueTemplates: IssueTemplateListResponse,+ views: t.Array(ViewResponse),+ dashboards: DashboardListResponse,+ actions: ActionListResponse,+ features: FeaturesResponse,+ estimates: EstimatesResponse,+ sections: t.Array(+ t.Object(+ { key: t.String(), items: t.Array(t.String()) },+ { description: 'What a section an extension of the api added holds, by name.' },+ ),+ ),+ }),+]);diff --git a/apps/api/src/modules/project-templates/service.ts b/apps/api/src/modules/project-templates/service.tsnew file mode 100644index 00000000..5a0d6b3a--- /dev/null+++ b/apps/api/src/modules/project-templates/service.ts@@ -0,0 +1,190 @@+import { db, project } from '@repo/db';+import { and, asc, eq } from 'drizzle-orm';+import { HttpError, iso } from '#shared/lib';+import { copyIncludeKeys, copyProject } from '#modules/projects/copy';+import { copySections } from '#modules/projects/copy-extension';+import {+ deleteProject,+ getProjectById,+ projectFeatures,+ type ProjectFeatures,+ type ProjectRow,+} from '#modules/projects/service';+import { teamOwnsProject } from '#modules/teams/service';+import { listColumns, type ColumnRow } from '#modules/columns/service';+import { listIssueTypes, type IssueTypeRow } from '#modules/issue-types/service';+import {+ listLabelGroups,+ listLabels,+ type LabelGroupRow,+ type LabelRow,+} from '#modules/labels/service';+import { listCustomFields, type CustomFieldRow } from '#modules/custom-fields/service';+import { listIssueTemplates, type IssueTemplateRow } from '#modules/issue-templates/service';+import { listViews, type UserViewRow } from '#modules/views/service';+import { listDashboards, type DashboardRow } from '#modules/dashboards/service';+import { listActions, type ActionRow } from '#modules/actions/service';++export interface ProjectTemplate {+ id: number;+ name: string;+ description: string;+ createdAt: string;+}++export async function listProjectTemplates(teamId: number): Promise<ProjectTemplate[]> {+ const rows = await db+ .select({+ id: project.id,+ name: project.name,+ description: project.description,+ createdAt: project.createdAt,+ })+ .from(project)+ .where(and(eq(project.teamId, teamId), eq(project.isTemplate, true)))+ .orderBy(asc(project.name), asc(project.id));+ return rows.map((row) => ({ ...row, createdAt: iso(row.createdAt) }));+}++// A template is a project, so it takes a key unique in its team. Nobody sees the key,+// so it is random; the leading letter keeps it a valid project key.+function templateKey(): string {+ return `T${crypto.randomUUID().replaceAll('-', '').slice(0, 9).toUpperCase()}`;+}++// Saves a copy of the project's configuration as a template. Later changes to the+// project do not reach the template.+export async function saveProjectTemplate(+ teamId: number,+ input: {+ projectId: number;+ name: string;+ description?: string;+ include?: Record<string, boolean | undefined>;+ },+ userId: string,+): Promise<ProjectTemplate> {+ if (!(await teamOwnsProject(teamId, input.projectId))) {+ throw new HttpError(404, 'Project not found');+ }+ const saved = await copyProject(+ input.projectId,+ { key: templateKey(), name: input.name, description: input.description },+ userId,+ teamId,+ input.include,+ { template: true },+ );+ return {+ id: saved.id,+ name: saved.name,+ description: saved.description,+ createdAt: saved.createdAt,+ };+}++// What a template holds, read the way a project's own settings read it.+export interface ProjectTemplateDetail extends ProjectTemplate {+ columns: ColumnRow[];+ issueTypes: IssueTypeRow[];+ labels: LabelRow[];+ labelGroups: LabelGroupRow[];+ customFields: CustomFieldRow[];+ issueTemplates: IssueTemplateRow[];+ views: UserViewRow[];+ dashboards: DashboardRow[];+ actions: ActionRow[];+ features: ProjectFeatures;+ estimates: { points: boolean; time: boolean; logging: boolean };+ sections: { key: string; items: string[] }[];+}++export async function getProjectTemplate(+ teamId: number,+ templateId: number,+ userId: string,+): Promise<ProjectTemplateDetail> {+ await requireTemplate(teamId, templateId);+ const [+ found,+ columns,+ issueTypes,+ labels,+ labelGroups,+ customFields,+ issueTemplates,+ views,+ dashboards,+ actions,+ sections,+ ] = await Promise.all([+ getProjectById(templateId),+ listColumns(templateId),+ listIssueTypes(templateId),+ listLabels(templateId),+ listLabelGroups(templateId),+ listCustomFields(templateId, { allTypes: true }),+ listIssueTemplates(templateId),+ listViews(templateId, userId),+ listDashboards(templateId),+ listActions(templateId),+ Promise.all(+ copySections()+ .filter((section) => section.template)+ .map(async (section) => ({+ key: section.key,+ items: await section.contents(templateId),+ })),+ ),+ ]);+ const template = found!;+ return {+ id: template.id,+ name: template.name,+ description: template.description,+ createdAt: template.createdAt,+ columns,+ issueTypes,+ labels,+ labelGroups,+ customFields,+ issueTemplates,+ views,+ dashboards,+ actions,+ features: projectFeatures(template),+ estimates: {+ points: template.pointsEstimateEnabled,+ time: template.timeEstimateEnabled,+ logging: template.timeLoggingEnabled,+ },+ sections,+ };+}++async function requireTemplate(teamId: number, templateId: number): Promise<void> {+ const [row] = await db+ .select({ id: project.id })+ .from(project)+ .where(+ and(eq(project.id, templateId), eq(project.teamId, teamId), eq(project.isTemplate, true)),+ );+ if (!row) throw new HttpError(404, 'Project template not found');+}++export async function createProjectFromTemplate(+ teamId: number,+ templateId: number,+ input: { key: string; name: string; description?: string },+ userId: string,+): Promise<ProjectRow> {+ await requireTemplate(teamId, templateId);+ // A template holds only what was chosen when it was saved, so the project takes all of it.+ const everything = Object.fromEntries(copyIncludeKeys().map((key) => [key, true]));+ return copyProject(templateId, input, userId, teamId, everything, { defaultAgents: true });+}++export async function deleteProjectTemplate(teamId: number, templateId: number): Promise<void> {+ await requireTemplate(teamId, templateId);+ await deleteProject(templateId);+}diff --git a/apps/api/src/modules/projects/__tests__/integration/copy-extension.test.ts b/apps/api/src/modules/projects/__tests__/integration/copy-extension.test.tsnew file mode 100644index 00000000..031b26cc--- /dev/null+++ b/apps/api/src/modules/projects/__tests__/integration/copy-extension.test.ts@@ -0,0 +1,111 @@+import { afterEach, beforeEach, describe, expect, it } from 'bun:test';+import { label } from '@repo/db';+import { authedApi, type Api, createProject } from '#tests/helpers/app';+import { signUpTestUser } from '#tests/helpers/auth';+import { resetDb } from '#tests/helpers/db';+import {+ setCopySections,+ type CopySection,+ type CopySectionContext,+} from '#modules/projects/copy-extension';++let calls: CopySectionContext[] = [];++// A section that records each run and adds a label to the copy inside its transaction,+// named after how many labels the copy re-created before it.+function section(overrides: Partial<CopySection> = {}): CopySection {+ return {+ key: 'extra',+ requires: ['labels'],+ template: true,+ copy: async (context) => {+ calls.push(context);+ await context.tx+ .insert(label)+ .values({ projectId: context.projectId, name: `extra ${context.maps.label.size}` });+ },+ contents: async (projectId) => [`held by ${projectId}`],+ ...overrides,+ };+}++// The project SRC with the label "bug".+async function setup(): Promise<{ api: Api; teamId: number; sourceId: number }> {+ const user = await signUpTestUser();+ const api = authedApi(user.cookie);+ const source = (await createProject(api, { key: 'SRC', name: 'Source' })).data!;+ await api.projects({ projectKey: 'SRC' }).labels.post({ name: 'bug', color: '#ff0000' });+ return { api, teamId: source.teamId, sourceId: source.id };+}++async function labelNames(api: Api, projectKey: string) {+ return (await api.projects({ projectKey }).get()).data?.labels.map((l) => l.name);+}++describe('copy sections of an extension', () => {+ beforeEach(async () => {+ await resetDb();+ calls = [];+ });+ afterEach(() => setCopySections());++ it('copies a selected section with what it requires', async () => {+ const { api } = await setup();+ setCopySections([section()]);++ const copied = await api+ .projects({ projectKey: 'SRC' })+ .copy.post({ key: 'DST', name: 'Destination', include: { extra: true } });+ expect(copied.status).toBe(201);++ expect(await labelNames(api, 'DST')).toEqual(['bug', 'extra 1']);+ expect(calls).toMatchObject([{ template: false, sameTeam: true }]);+ });++ it('leaves a section out unless it is selected', async () => {+ const { api } = await setup();+ setCopySections([section()]);++ await api+ .projects({ projectKey: 'SRC' })+ .copy.post({ key: 'DST', name: 'Destination', include: { labels: true } });++ expect(await labelNames(api, 'DST')).toEqual(['bug']);+ expect(calls).toHaveLength(0);+ });++ it('saves a section into a template and copies it into a project made from it', async () => {+ const { api, teamId, sourceId } = await setup();+ setCopySections([section()]);++ const saved = await api+ .teams({ teamId })+ ['project-templates'].post({ projectId: sourceId, name: 'Kanban', include: { extra: true } });+ await api+ .teams({ teamId })+ .projects.post({ key: 'NEW', name: 'New', templateId: saved.data!.id });++ expect(calls.map((call) => call.template)).toEqual([true, false]);+ const detail = await api+ .teams({ teamId })+ ['project-templates']({ templateId: saved.data!.id })+ .get();+ expect(detail.data?.sections).toEqual([{ key: 'extra', items: [`held by ${saved.data!.id}`] }]);+ });++ it('leaves a section a template does not carry out of the template', async () => {+ const { api, teamId, sourceId } = await setup();+ setCopySections([section({ template: false })]);++ await api+ .teams({ teamId })+ ['project-templates'].post({ projectId: sourceId, name: 'Kanban', include: { extra: true } });++ expect(calls).toHaveLength(0);+ });++ it('refuses a key the core or another section uses', () => {+ expect(() => setCopySections([section({ key: 'labels' })])).toThrow();+ expect(() => setCopySections([section(), section()])).toThrow();+ });+});diff --git a/apps/api/src/modules/projects/__tests__/integration/projects.test.ts b/apps/api/src/modules/projects/__tests__/integration/projects.test.tsindex c264d1e6..20965b26 100644--- a/apps/api/src/modules/projects/__tests__/integration/projects.test.ts+++ b/apps/api/src/modules/projects/__tests__/integration/projects.test.ts@@ -359,6 +359,65 @@ describe('projects', () => {expect(view.data?.issueTypes.map((t) => t.name)).toEqual(['Task', 'Bug']);});+ it('copies every custom field, the project-wide ones too', async () => {+ const { api } = await signUpClient();+ await createProject(api, { key: 'SRC', name: 'Source' });+ const source = api.projects({ projectKey: 'SRC' });+ const type = (await source['issue-types'].post({ name: 'Bug' })).data!;+ await source['custom-fields'].post({ name: 'Severity', fieldType: 'text', showInBody: true });+ await source['custom-fields'].post({+ name: 'Steps',+ fieldType: 'text',+ issueTypeId: type.id,+ });++ await source.copy.post({ key: 'DST', name: 'Destination' });++ const view = (await viewOf(api, 'DST')).data!;+ const bug = view.issueTypes.find((t) => t.name === 'Bug')!;+ expect(+ view.customFields.map((f) => ({+ name: f.name,+ issueTypeId: f.issueTypeId,+ showInBody: f.showInBody,+ })),+ ).toEqual(+ expect.arrayContaining([+ { name: 'Severity', issueTypeId: null, showInBody: true },+ { name: 'Steps', issueTypeId: bug.id, showInBody: false },+ ]),+ );+ });++ it('copies issue templates onto the copied type, state and labels', async () => {+ const { api } = await signUpClient();+ await createProject(api, { key: 'SRC', name: 'Source' });+ const source = api.projects({ projectKey: 'SRC' });+ const type = (await source['issue-types'].post({ name: 'Bug' })).data!;+ const label = (await source.labels.post({ name: 'urgent', color: '#ff0000' })).data!;+ const todo = (await viewOf(api, 'SRC')).data!.columns.find((c) => c.name === 'Todo')!;+ await source['issue-templates'].post({+ name: 'Bug report',+ titleTemplate: 'Bug: ',+ typeId: type.id,+ columnId: todo.id,+ labelIds: [label.id],+ });++ await source.copy.post({ key: 'DST', name: 'Destination' });++ const view = (await viewOf(api, 'DST')).data!;+ expect(view.issueTemplates).toMatchObject([+ {+ name: 'Bug report',+ titleTemplate: 'Bug: ',+ typeId: view.issueTypes.find((t) => t.name === 'Bug')!.id,+ columnId: view.columns.find((c) => c.name === 'Todo')!.id,+ labelIds: [view.labels.find((l) => l.name === 'urgent')!.id],+ },+ ]);+ });+it('copies which optional sections the source project shows', async () => {const { api } = await signUpClient();await createProject(api, { key: 'SRC', name: 'Source' });diff --git a/apps/api/src/modules/projects/copy-extension.ts b/apps/api/src/modules/projects/copy-extension.tsnew file mode 100644index 00000000..10b2d99b--- /dev/null+++ b/apps/api/src/modules/projects/copy-extension.ts@@ -0,0 +1,43 @@+import type { DbExecutor } from '@repo/db';+import { COPY_INCLUDE_KEYS, type CopyIdMaps } from './copy';++export interface CopySectionContext {+ tx: DbExecutor;+ sourceProjectId: number;+ projectId: number;+ ownerId: string;+ // Old → new ids of what the copy re-created before the section runs.+ maps: CopyIdMaps;+ // The copy is a project template.+ template: boolean;+ // The copy stays in the source project's team.+ sameTeam: boolean;+}++// A part of a project an extension of the api adds to a project copy and to a project+// template: the include key that selects it, the keys it needs copied with it, whether a+// template carries it, the copy itself, run inside the copy's transaction, and the names+// of what it holds in a project, which a template's detail lists.+export interface CopySection {+ key: string;+ requires: string[];+ template: boolean;+ copy(context: CopySectionContext): Promise<void>;+ contents(projectId: number): Promise<string[]>;+}++let sections: CopySection[] = [];++// A key the core or another section already uses throws.+export function setCopySections(next: CopySection[] = []): void {+ const taken = new Set<string>(COPY_INCLUDE_KEYS);+ for (const section of next) {+ if (taken.has(section.key)) throw new Error(`Copy section '${section.key}' is taken`);+ taken.add(section.key);+ }+ sections = next;+}++export function copySections(): CopySection[] {+ return sections;+}diff --git a/apps/api/src/modules/projects/copy.ts b/apps/api/src/modules/projects/copy.tsindex ab8b2531..aee11c01 100644--- a/apps/api/src/modules/projects/copy.ts+++ b/apps/api/src/modules/projects/copy.ts@@ -8,6 +8,8 @@ import {label,customField,customFieldOption,+ issueTemplate,+ issueTemplateLabel,projectView,projectDashboard,projectDocument,@@ -20,6 +22,7 @@ import { and, eq, inArray, or } from 'drizzle-orm';import { HttpError } from '#shared/lib';import {DEFAULT_COLUMNS,+ defaultAgentMembers,getProjectById,joinTeamAsCreator,mapProject,@@ -41,12 +44,13 @@ import {deleteAttachmentObject,} from '#modules/attachments/storage';import { assertValidDocumentContentJson, replaceAssetReferences } from '#modules/documents/service';+import { copySections } from './copy-extension';// Which parts of a source project the copy carries over. A key set false skips that-// entity. Some sections depend on others (a view's filters reference-// states/types/labels/fields); those dependencies are force-enabled in-// normalizeInclude so a partial selection can never leave an id pointing at the-// source project. Agents, their skills and their configured tools are not among them:+// entity, and a section an extension adds (copy-extension.ts) has a key of its own.+// Some sections depend on others (a view's filters reference states/types/labels/fields);+// those dependencies are force-enabled in normalizeInclude so a partial selection can+// never leave an id pointing at the source project. Agents, their skills and their configured tools are not among them:// all three belong to the team, so a copy inside it reuses the same agents, and a copy// into another team carries none.export interface CopyProjectInclude {@@ -54,6 +58,7 @@ export interface CopyProjectInclude {issueTypes: boolean;labels: boolean;customFields: boolean;+ issueTemplates: boolean;views: boolean;dashboards: boolean;documents: boolean;@@ -69,6 +74,7 @@ export const COPY_INCLUDE_KEYS: (keyof CopyProjectInclude)[] = ['issueTypes','labels','customFields',+ 'issueTemplates','views','dashboards','documents',@@ -79,6 +85,22 @@ export const COPY_INCLUDE_KEYS: (keyof CopyProjectInclude)[] = ['schedules',];+type Include = CopyProjectInclude & Record<string, boolean>;++// The core's keys and those of the sections an extension added.+export function copyIncludeKeys(): string[] {+ return [...COPY_INCLUDE_KEYS, ...copySections().map((section) => section.key)];+}++// What a project template never carries: the agents and their schedules work in a+// project, a webhook delivers one project's events, and docs are its content.+const NOT_IN_TEMPLATE: (keyof CopyProjectInclude)[] = [+ 'agents',+ 'schedules',+ 'webhooks',+ 'documents',+];+const ALL_FALSE = Object.fromEntries(COPY_INCLUDE_KEYS.map((k) => [k, false]),) as unknown as CopyProjectInclude;@@ -91,6 +113,7 @@ const DEFAULT_INCLUDE: CopyProjectInclude = {issueTypes: true,labels: true,customFields: true,+ issueTemplates: true,views: true,dashboards: true,documents: true,@@ -98,11 +121,20 @@ const DEFAULT_INCLUDE: CopyProjectInclude = {};// Resolves the selection and force-enables the dependencies each entity needs to be-// copied correctly. Views/actions remap the ids of states, types, labels and fields,-// so those must be copied too; a schedule cannot exist without its agent, and a status-// schedule without its state.-function normalizeInclude(raw?: Partial<CopyProjectInclude>): CopyProjectInclude {- const inc: CopyProjectInclude = raw ? { ...ALL_FALSE, ...raw } : { ...DEFAULT_INCLUDE };+// copied correctly. Views, actions and issue templates remap the ids of states, types,+// labels and fields, so those must be copied too; a schedule cannot exist without its+// agent, and a status schedule without its state. A template leaves out what it never+// carries.+function normalizeInclude(+ raw: Record<string, boolean | undefined> | undefined,+ template: boolean,+): Include {+ const inc: Include = raw ? { ...ALL_FALSE, ...raw } : { ...DEFAULT_INCLUDE };+ for (const section of copySections()) {+ if (template && !section.template) inc[section.key] = false;+ if (inc[section.key]) for (const key of section.requires) inc[key] = true;+ }+ if (template) for (const key of NOT_IN_TEMPLATE) inc[key] = false;if (inc.customFields) inc.issueTypes = true;if (inc.views) {inc.states = true;@@ -110,7 +142,7 @@ function normalizeInclude(raw?: Partial<CopyProjectInclude>): CopyProjectIncludeinc.labels = true;inc.customFields = true;}- if (inc.actions) {+ if (inc.actions || inc.issueTemplates) {inc.states = true;inc.issueTypes = true;inc.labels = true;@@ -222,6 +254,9 @@ function remapActionEffect(effect: unknown, maps: CopyIdMaps): unknown {// Creates a new project that copies the selected parts of the source project's// configuration, but none of its issues. The creator becomes the new project's owner.+// With `template` the copy is a project template instead: it has no members, and it+// leaves out what a template never carries. With `defaultAgents` the copy starts with the+// team's default agents, as a created project does.//// Pure-database entities (states, types, labels, custom fields, views, dashboards,// documents, actions, settings, webhooks) are copied in one transaction, recording@@ -234,9 +269,10 @@ export async function copyProject(input: { key: string; name: string; description?: string },ownerId: string,teamId: number,- rawInclude?: Partial<CopyProjectInclude>,+ rawInclude?: Record<string, boolean | undefined>,+ { template = false, defaultAgents = false }: { template?: boolean; defaultAgents?: boolean } = {},): Promise<ProjectRow> {- const inc = normalizeInclude(rawInclude);+ const inc = normalizeInclude(rawInclude, template);const maps: CopyIdMaps = {column: new Map(),@@ -255,6 +291,7 @@ export async function copyProject(// What a new project starts with, set instance-wide in god mode. Read before the// transaction opens so the settings lookup is not part of it.const defaults = await getProjectDefaults();+ const agentMembers = defaultAgents ? await defaultAgentMembers(ownerTeam) : [];// Agents, integration credentials and roles belong to the team, so what references// them survives the copy only when it stays in the same team.const sameTeam = ownerTeam.id === source.teamId;@@ -288,6 +325,7 @@ export async function copyProject(name: input.name,description: input.description ?? '',mcpEnabled: defaults.mcpEnabled,+ isTemplate: template,...sourceFeatures,}).returning();@@ -298,8 +336,15 @@ export async function copyProject(teamMcpEnabled: ownerTeam.mcpEnabled,workspaceId: ownerTeam.workspaceId,});- await joinTeamAsCreator(tx, ownerTeam.id, ownerId);- await tx.insert(projectMember).values({ projectId: proj.id, userId: ownerId, role: 'owner' });+ if (!template) {+ await joinTeamAsCreator(tx, ownerTeam.id, ownerId);+ await tx.insert(projectMember).values({ projectId: proj.id, userId: ownerId, role: 'owner' });+ }+ if (agentMembers.length > 0) {+ await tx+ .insert(projectMember)+ .values(agentMembers.map((member) => ({ projectId: proj.id, ...member })));+ }// States (columns). When copied, every source column is carried over so views,// actions and issues have somewhere to map to. When not copied, the project is@@ -392,13 +437,13 @@ export async function copyProject(}}- // Type-scoped custom fields (with their options). Project-wide fields- // (issue_type_id NULL) are not copied.- if (inc.customFields && maps.type.size > 0) {+ // Custom fields with their options. Every issue type is copied with them, so a+ // type-scoped field keeps its type.+ if (inc.customFields) {const fieldRows = await tx.select().from(customField)- .where(inArray(customField.issueTypeId, Array.from(maps.type.keys())))+ .where(eq(customField.projectId, sourceProjectId)).orderBy(customField.position);for (const f of fieldRows) {const [created] = await tx@@ -409,6 +454,7 @@ export async function copyProject(name: f.name,fieldType: f.fieldType,memberScope: f.memberScope,+ showInBody: f.showInBody,position: f.position,}).returning({ id: customField.id });@@ -429,6 +475,41 @@ export async function copyProject(}}+ // Issue templates: their type, state and labels point at the copies. The assignee is+ // left unset, as a column's auto-assignee is.+ if (inc.issueTemplates) {+ const templateRows = await tx+ .select()+ .from(issueTemplate)+ .where(eq(issueTemplate.projectId, sourceProjectId))+ .orderBy(issueTemplate.id);+ for (const tpl of templateRows) {+ const [created] = await tx+ .insert(issueTemplate)+ .values({+ projectId: proj.id,+ name: tpl.name,+ description: tpl.description,+ titleTemplate: tpl.titleTemplate,+ descriptionTemplate: tpl.descriptionTemplate,+ typeId: tpl.typeId != null ? (maps.type.get(tpl.typeId) ?? null) : null,+ columnId: tpl.columnId != null ? (maps.column.get(tpl.columnId) ?? null) : null,+ priority: tpl.priority,+ })+ .returning({ id: issueTemplate.id });+ const labelRows = await tx+ .select({ labelId: issueTemplateLabel.labelId })+ .from(issueTemplateLabel)+ .where(eq(issueTemplateLabel.templateId, tpl.id));+ const labelIds = labelRows.flatMap((row) => maps.label.get(row.labelId) ?? []);+ if (labelIds.length > 0) {+ await tx+ .insert(issueTemplateLabel)+ .values(labelIds.map((labelId) => ({ templateId: created.id, labelId })));+ }+ }+ }+// Views: their filters reference the ids captured above.if (inc.views) {const viewRows = await tx@@ -635,6 +716,19 @@ export async function copyProject(}}+ for (const section of copySections()) {+ if (!inc[section.key]) continue;+ await section.copy({+ tx,+ sourceProjectId,+ projectId: proj.id,+ ownerId,+ maps,+ template,+ sameTeam,+ });+ }+return proj;});let newProject: ProjectRow;diff --git a/apps/api/src/modules/projects/index.ts b/apps/api/src/modules/projects/index.tsindex bcfe553e..3a0a81f0 100644--- a/apps/api/src/modules/projects/index.ts+++ b/apps/api/src/modules/projects/index.ts@@ -123,8 +123,8 @@ export const projectRoutes = new Elysia({ name: 'projects', detail: { tags: ['Prdescription:"Copy a project's configuration into a new project you own in the same team, without " +'its issues. Only an owner or a manager of that team may copy it. ' +- 'By default the structure (states, issue types, labels, custom fields, views, ' +- 'dashboards, documents, actions) is copied. Pass `include` to choose sections; the API ' ++ 'By default the structure (states, issue types, labels, custom fields, issue ' ++ 'templates, views, dashboards, documents, actions) is copied. Pass `include` to choose sections; the API ' +'force-enables dependencies (e.g. a view pulls in the states it references).',...mcpTool('copy_project'),},diff --git a/apps/api/src/modules/projects/model.ts b/apps/api/src/modules/projects/model.tsindex eb4e7476..fcb21dd0 100644--- a/apps/api/src/modules/projects/model.ts+++ b/apps/api/src/modules/projects/model.ts@@ -29,7 +29,8 @@ const projectBody = t.Object({// Create adds the issue-type preset: which set of types the new project starts with.// Omitted → "general" (a single Task). Copy takes its types from the source project,-// so the preset applies to create only.+// and a project created from a template from the template, so the preset applies to+// neither.export const createProjectBody = t.Composite([projectBody,t.Object({@@ -39,21 +40,29 @@ export const createProjectBody = t.Composite([{ description: `Issue-type preset: ${ISSUE_TYPE_PRESET_KEYS.join(', ')}.` },),),+ templateId: t.Optional(+ t.Integer({+ description:+ 'A project template of the team (list_project_templates) to create the project ' ++ 'from. The project then starts with what the template holds, and preset is not used.',+ }),+ ),}),]);+// Which parts of a source project a copy carries over. A key the core does not name+// selects a section an extension of the api adds.+export const copyInclude = t.Optional(+ t.Object(Object.fromEntries(COPY_INCLUDE_KEYS.map((k) => [k, t.Optional(t.Boolean())])), {+ additionalProperties: t.Boolean(),+ }),+);+// Copy adds an optional selection of which parts of the source project to carry over.// Omitted → the source project's structure (states, types, labels, custom fields,-// views, dashboards, documents, actions). Each flag maps to a project section-// menu; the service force-enables dependencies.-export const copyProjectBody = t.Composite([- projectBody,- t.Object({- include: t.Optional(- t.Object(Object.fromEntries(COPY_INCLUDE_KEYS.map((k) => [k, t.Optional(t.Boolean())]))),- ),- }),-]);+// issue templates, views, dashboards, documents, actions). Each flag maps to a project+// section menu; the service force-enables dependencies.+export const copyProjectBody = t.Composite([projectBody, t.Object({ include: copyInclude })]);export const updateProjectBody = t.Object({key: t.Optional(projectKey),@@ -238,7 +247,7 @@ export const ProjectBoardResponse = t.Object({});// Which optional sections the project shows (ProjectFeatures from the service).-const FeaturesResponse = t.Object({+export const FeaturesResponse = t.Object({initiatives: t.Boolean(),dashboards: t.Boolean(),documents: t.Boolean(),diff --git a/apps/api/src/modules/projects/service.ts b/apps/api/src/modules/projects/service.tsindex db5b39d4..1977dc21 100644--- a/apps/api/src/modules/projects/service.ts+++ b/apps/api/src/modules/projects/service.ts@@ -222,6 +222,7 @@ async function readProjects(grantedTeams.length > 0 ? inArray(project.teamId, grantedTeams) : undefined,),isNull(project.archivedAt),+ eq(project.isTemplate, false),opts.mcpOnly ? and(eq(project.mcpEnabled, true), eq(team.mcpEnabled, true)) : undefined,opts.teamId !== undefined ? eq(project.teamId, opts.teamId) : undefined,opts.workspaceId !== undefined ? eq(team.workspaceId, opts.workspaceId) : undefined,@@ -518,6 +519,22 @@ export const ISSUE_TYPE_PRESET_KEYS = Object.keys(ISSUE_TYPE_PRESETS);export type IssueTypePreset = keyof typeof ISSUE_TYPE_PRESETS;+// The team's default agents as the member rows a new project starts with, on the+// default role.+export async function defaultAgentMembers(ownerTeam: {+ id: number;+ defaultAgentIds: number[];+}): Promise<{ userId: string; role: 'member'; roleId: number | null }[]> {+ if (ownerTeam.defaultAgentIds.length === 0) return [];+ const agents = await db+ .select({ userId: aiAgent.userId })+ .from(aiAgent)+ .where(and(eq(aiAgent.teamId, ownerTeam.id), inArray(aiAgent.id, ownerTeam.defaultAgentIds)));+ if (agents.length === 0) return [];+ const roleId = await getDefaultRoleId();+ return agents.map((agent) => ({ userId: agent.userId, role: 'member', roleId }));+}+export async function createProject(input: {key: string;@@ -532,15 +549,7 @@ export async function createProject(// What a new project starts with, set instance-wide in god mode. Read before the// transaction opens so the settings lookup is not part of it.const defaults = await getProjectDefaults();- const defaultAgents = ownerTeam.defaultAgentIds.length- ? await db- .select({ userId: aiAgent.userId })- .from(aiAgent)- .where(- and(eq(aiAgent.teamId, ownerTeam.id), inArray(aiAgent.id, ownerTeam.defaultAgentIds)),- )- : [];- const defaultRoleId = defaultAgents.length ? await getDefaultRoleId() : null;+ const agentMembers = await defaultAgentMembers(ownerTeam);return db.transaction(async (tx) => {const [row] = await tx.insert(project)@@ -554,15 +563,10 @@ export async function createProject(.returning();await joinTeamAsCreator(tx, ownerTeam.id, ownerId);await tx.insert(projectMember).values({ projectId: row.id, userId: ownerId, role: 'owner' });- if (defaultAgents.length) {- await tx.insert(projectMember).values(- defaultAgents.map((agent) => ({- projectId: row.id,- userId: agent.userId,- role: 'member',- roleId: defaultRoleId,- })),- );+ if (agentMembers.length > 0) {+ await tx+ .insert(projectMember)+ .values(agentMembers.map((member) => ({ projectId: row.id, ...member })));}for (const [position, column] of DEFAULT_COLUMNS.entries()) {await tx.insert(projectColumn).values({diff --git a/apps/api/src/modules/scim/mappings.ts b/apps/api/src/modules/scim/mappings.tsindex 3d3a42b0..46b50475 100644--- a/apps/api/src/modules/scim/mappings.ts+++ b/apps/api/src/modules/scim/mappings.ts@@ -107,7 +107,13 @@ export async function setGroupMappings(.select({ id: project.id, teamId: project.teamId }).from(project).innerJoin(team, eq(team.id, project.teamId))- .where(and(inArray(project.id, projectIds), where && or(where, inArray(project.id, before))));+ .where(+ and(+ inArray(project.id, projectIds),+ eq(project.isTemplate, false),+ where && or(where, inArray(project.id, before)),+ ),+ );if (known.length !== projectIds.length) throw new HttpError(400, 'Unknown project');// A custom role belongs to one team, so a mapping that names another team's role// would silently grant the wrong permissions. A system role fits every team.@@ -157,7 +163,7 @@ export async function listMappableProjects(workspaceId: number | null) {.select({ id: project.id, key: project.key, name: project.name, teamId: project.teamId }).from(project).innerJoin(team, eq(team.id, project.teamId))- .where(where)+ .where(and(where, eq(project.isTemplate, false))).orderBy(asc(project.key)),db.select({ id: teamRole.id, name: teamRole.name, teamId: teamRole.teamId })diff --git a/apps/api/src/modules/teams/index.ts b/apps/api/src/modules/teams/index.tsindex 2d6e8114..c754a01e 100644--- a/apps/api/src/modules/teams/index.ts+++ b/apps/api/src/modules/teams/index.ts@@ -21,6 +21,7 @@ import {updateProject,} from '#modules/projects/service';import { copyProject } from '#modules/projects/copy';+import { createProjectFromTemplate } from '#modules/project-templates/service';import {TeamDetailResponse,TeamListResponse,@@ -325,9 +326,9 @@ export const teamRoutes = new Elysia({ name: 'teams', detail: { tags: ['Teams']detail: {summary: 'Delete a team',description:- 'Delete a team you own, with its members, roles, invites, skills, tools and ' +- 'integrations. A team that holds a project or an AI agent is refused until those ' +- 'are gone. Irreversible.',+ 'Delete a team you own, with its members, roles, project templates, invites, skills, ' ++ 'tools and integrations. A team that holds a project or an AI agent is refused ' ++ 'until those are gone. Irreversible.',},},)@@ -336,7 +337,10 @@ export const teamRoutes = new Elysia({ name: 'teams', detail: { tags: ['Teams']'/teams/:teamId/projects',async ({ body, membership, set }) => {set.status = 201;- return createProject(body, membership.userId, membership.teamId);+ const { templateId, ...input } = body;+ return templateId === undefined+ ? createProject(input, membership.userId, membership.teamId)+ : createProjectFromTemplate(membership.teamId, templateId, input, membership.userId);},{teamManager: true,@@ -348,7 +352,8 @@ export const teamRoutes = new Elysia({ name: 'teams', detail: { tags: ['Teams']description:'Create a project in a team you own or manage and become its owner. `key` is the ' +"immutable prefix for issue ids, unique within the team (e.g. 'MKT' -> 'MKT-1'). " +- 'Seeds the default columns and the issue types of the chosen `preset`. Over MCP, ' ++ 'Seeds the default columns and the issue types of the chosen `preset`, or copies ' ++ 'what the project template `templateId` holds. Over MCP, ' +'uses the team from your key when there is one; otherwise call list_teams and pass ' +'teamId.',...mcpTool('create_project'),diff --git a/apps/api/src/modules/teams/model.ts b/apps/api/src/modules/teams/model.tsindex 53b07757..46b507ab 100644--- a/apps/api/src/modules/teams/model.ts+++ b/apps/api/src/modules/teams/model.ts@@ -65,6 +65,7 @@ export const TeamResponse = t.Object({}),joinedAt: t.String(),projectCount: t.Number(),+ templateCount: t.Number({ description: 'How many project templates the team holds.' }),memberCount: t.Number(),ownerCount: t.Number({ description: 'How many members are owners; the last one cannot leave.' }),roleCount: t.Number({ description: "How many roles the team's projects assign from." }),diff --git a/apps/api/src/modules/teams/service.ts b/apps/api/src/modules/teams/service.tsindex 7eb8874b..cc15c9fd 100644--- a/apps/api/src/modules/teams/service.ts+++ b/apps/api/src/modules/teams/service.ts@@ -86,6 +86,7 @@ export interface TeamRow {source: MemberSource;joinedAt: string;projectCount: number;+ templateCount: number;memberCount: number;// How many of those members are owners: the last one cannot leave.ownerCount: number;@@ -264,8 +265,9 @@ async function loadTeamRows(userId: string, teamId?: number): Promise<TeamRow[]>db.select({teamId: project.teamId,- count: sql<number>`count(*)::int`,- joined: sql<number>`count(${projectMember.userId})::int`,+ count: sql<number>`count(*) filter (where not ${project.isTemplate})::int`,+ joined: sql<number>`count(${projectMember.userId}) filter (where not ${project.isTemplate})::int`,+ templates: sql<number>`count(*) filter (where ${project.isTemplate})::int`,}).from(project).leftJoin(@@ -334,6 +336,7 @@ async function loadTeamRows(userId: string, teamId?: number): Promise<TeamRow[]>source: (row.source as MemberSource | null) ?? 'invite',joinedAt: iso(row.joinedAt ?? row.createdAt),projectCount: (runsTeam(standing) || grant ? projectCount?.count : projectCount?.joined) ?? 0,+ templateCount: projectCount?.templates ?? 0,memberCount: members.get(row.id)?.count ?? 0,ownerCount: members.get(row.id)?.owners ?? 0,roleCount: roles.get(row.id) ?? 0,@@ -412,7 +415,7 @@ async function getTeamMcp(teamId: number): Promise<TeamMcpSettings> {db.select({ projectId: project.id, enabled: project.mcpEnabled }).from(project)- .where(eq(project.teamId, teamId))+ .where(and(eq(project.teamId, teamId), eq(project.isTemplate, false))).orderBy(project.key),]);return { enabled: rows[0]?.mcpEnabled ?? false, projects };@@ -559,6 +562,7 @@ async function visibleTeamProjects(const term = search?.trim();return and(eq(project.teamId, teamId),+ eq(project.isTemplate, false),seesAll? undefined: sql`exists (select 1 from ${projectMember} where ${projectMember.projectId} = ${project.id}@@ -687,12 +691,14 @@ async function lastActivityAt(projectId: number): Promise<string | null> {}// Whether the project is one the team owns. The team-scoped project routes check it-// so a project of another team answers 404 rather than being acted on.+// so a project of another team, or a template, answers 404 rather than being acted on.export async function teamOwnsProject(teamId: number, projectId: number): Promise<boolean> {const rows = await db.select({ id: project.id }).from(project)- .where(and(eq(project.id, projectId), eq(project.teamId, teamId)));+ .where(+ and(eq(project.id, projectId), eq(project.teamId, teamId), eq(project.isTemplate, false)),+ );return rows.length > 0;}@@ -842,6 +848,7 @@ export async function createTeam(source: 'invite',joinedAt: iso(membership.createdAt),projectCount: 0,+ templateCount: 0,memberCount: 1,ownerCount: 1,roleCount: 1,@@ -901,7 +908,7 @@ export async function deleteTeam(teamId: number): Promise<void> {.where(and(eq(team.id, teamId),- sql`not exists (select 1 from ${project} where ${project.teamId} = ${team.id})`,+ sql`not exists (select 1 from ${project} where ${project.teamId} = ${team.id} and not ${project.isTemplate})`,sql`not exists (select 1 from ${aiAgent} where ${aiAgent.teamId} = ${team.id})`,),)diff --git a/apps/api/src/modules/workspaces/service.ts b/apps/api/src/modules/workspaces/service.tsindex 6500c93f..78038b6e 100644--- a/apps/api/src/modules/workspaces/service.ts+++ b/apps/api/src/modules/workspaces/service.ts@@ -71,7 +71,7 @@ export async function projectWorkspaceGrant(workspaceManager,and(eq(workspaceManager.workspaceId, team.workspaceId), eq(workspaceManager.userId, userId)),)- .where(eq(project.id, projectId));+ .where(and(eq(project.id, projectId), eq(project.isTemplate, false)));return row ? workspaceRoleGrant(row.role) : null;}@@ -206,7 +206,8 @@ async function runLimitCap(workspaceId: number): Promise<number> {}// Whether a team of the workspace has a project or an AI agent: people's work, which a-// deleted workspace would take with it.+// deleted workspace would take with it. A project template is the team's configuration,+// not work, and goes with the workspace.export async function workspaceHoldsWork(workspaceId: number): Promise<boolean> {const [row] = await db.select({ id: team.id })@@ -219,7 +220,7 @@ export async function workspaceHoldsWork(workspaceId: number): Promise<boolean>db.select({ n: sql`1` }).from(project)- .where(eq(project.teamId, team.id)),+ .where(and(eq(project.teamId, team.id), eq(project.isTemplate, false))),),exists(dbdiff --git a/apps/api/src/planner.ts b/apps/api/src/planner.tsindex 06a748ce..5b5c9c7e 100644--- a/apps/api/src/planner.ts+++ b/apps/api/src/planner.ts@@ -16,6 +16,7 @@ import { agentSkillRoutes } from './modules/agents/skills';import { agentToolRoutes } from './modules/agents/tools';import { customFieldRoutes } from './modules/custom-fields';import { issueTemplateRoutes } from './modules/issue-templates';+import { projectTemplateRoutes } from './modules/project-templates';import { issueRoutes } from './modules/issues';import { initiativeRoutes } from './modules/initiatives';import { cycleRoutes } from './modules/cycles';@@ -73,6 +74,7 @@ export const planner = new Elysia({ name: 'planner' })}).use(projectRoutes).use(teamRoutes)+ .use(projectTemplateRoutes).use(workspaceRoutes).use(memberRoutes).use(roleRoutes)diff --git a/apps/api/src/shared/access.ts b/apps/api/src/shared/access.tsindex d37a52f9..c7a82299 100644--- a/apps/api/src/shared/access.ts+++ b/apps/api/src/shared/access.ts@@ -434,7 +434,10 @@ export function reachedProjectIds(userId: string, grantedTeams: number[]): SQLWr.where(eq(projectMember.userId, userId));if (grantedTeams.length === 0) return member;return member.union(- db.select({ id: project.id }).from(project).where(inArray(project.teamId, grantedTeams)),+ db+ .select({ id: project.id })+ .from(project)+ .where(and(inArray(project.teamId, grantedTeams), eq(project.isTemplate, false))),);}diff --git a/apps/web/messages/ar/newProject.json b/apps/web/messages/ar/newProject.jsonindex 73086a71..fab39bc2 100644--- a/apps/web/messages/ar/newProject.json+++ b/apps/web/messages/ar/newProject.json@@ -4,6 +4,11 @@"copyKey": "المفتاح","description": "الوصف","issueTypes": "أنواع المهام",+ "templates": "القوالب",+ "blank": "مشروع فارغ",+ "blankHint": "الحالات الافتراضية وأنواع المهام التي تختارها",+ "startFrom": "البدء من",+ "continue": "متابعة","typesCreated": "{count, plural, zero {مش هيتعمل أنواع مهام} one {هيتعمل نوع مهمة واحد} two {هيتعمل نوعين مهام} few {هيتعمل # أنواع مهام} many {هيتعمل # نوع مهمة} other {هيتعمل # نوع مهمة}}","defaultType": "المهام الجديدة بتاخد {type} افتراضيًا. تقدر تعدّل الأنواع من الإعدادات.","presets": {@@ -33,6 +38,7 @@"issueTypes": "أنواع المهام","labels": "الوسوم","customFields": "الحقول المخصّصة",+ "issueTemplates": "قوالب المهام","views": "العروض","dashboards": "لوحات المعلومات","documents": "المستندات",diff --git a/apps/web/messages/ar/projects.json b/apps/web/messages/ar/projects.jsonindex 68e71516..1b701238 100644--- a/apps/web/messages/ar/projects.json+++ b/apps/web/messages/ar/projects.json@@ -1,6 +1,13 @@{"editAction": "تعديل المشروع","copyAction": "نسخ المشروع",+ "saveTemplateAction": "حفظ كقالب",+ "saveTemplate": {+ "title": "حفظ \"{name}\" كقالب",+ "hint": "يحتفظ القالب بنسخة من الإعدادات المختارة. لا تغيّره التعديلات اللاحقة على المشروع. لا تُحفظ المستندات والوكلاء والجدولات وخطافات الويب.",+ "save": "حفظ القالب",+ "saved": "تم حفظ القالب \"{name}\""+ },"deleteAction": "حذف المشروع","leaveAction": "مغادرة المشروع","archiveAction": "أرشفة المشروع",diff --git a/apps/web/messages/ar/teams.json b/apps/web/messages/ar/teams.jsonindex 228a83fe..ad26f1c9 100644--- a/apps/web/messages/ar/teams.json+++ b/apps/web/messages/ar/teams.json@@ -20,6 +20,10 @@"title": "المشاريع","description": "المشاريع التي يملكها الفريق."},+ "templates": {+ "title": "قوالب المشاريع",+ "description": "إعدادات مشاريع محفوظة تبدأ منها المشاريع الجديدة."+ },"members": {"title": "أعضاء الفريق","description": "كل أعضاء الفريق، والدعوات التي لم يُرد عليها بعد."@@ -74,15 +78,16 @@"leaveHint": "تحتفظ بالمشاريع التي أنت عضو فيها. للانضمام مجددًا يجب أن يضيفك أحد المالكين.","delete": {"action": "حذف الفريق",- "hint": "يُحذف معه أعضاؤه وأدواره ودعواته ومهاراته وأدواته وتكاملاته. يحتفظ الأشخاص بحساباتهم وفرقهم الأخرى.",+ "hint": "يُحذف معه أعضاؤه وأدواره وقوالب مشاريعه ودعواته ومهاراته وأدواته وتكاملاته. يحتفظ الأشخاص بحساباتهم وفرقهم الأخرى.","blocked": "احذف مشاريع الفريق ووكلاء الذكاء الاصطناعي الخاصين به أولاً.","title": "حذف {name}؟",- "description": "يُحذف <strong>{name}</strong> مع أعضائه وأدواره ودعواته ومهاراته وأدواته وتكاملاته. يحتفظ الأشخاص بحساباتهم وفرقهم الأخرى. لا يمكن التراجع عن ذلك.",+ "description": "يُحذف <strong>{name}</strong> مع أعضائه وأدواره وقوالب مشاريعه ودعواته ومهاراته وأدواته وتكاملاته. يحتفظ الأشخاص بحساباتهم وفرقهم الأخرى. لا يمكن التراجع عن ذلك.","deleted": "تم حذف الفريق"}},"columns": {"project": "المشروع",+ "template": "القالب","owners": "المالكون","members": "الأعضاء","created": "أُنشئ",@@ -182,6 +187,22 @@"empty": "تصدير الأدوار فارغ."}},+ "templates": {+ "ownerOnly": "يمكن لمالك الفريق أو مديره فقط إدارة قوالب المشاريع.",+ "empty": "لا توجد قوالب مشاريع بعد",+ "emptyHint": "احفظ مشروعًا كقالب لتنشئ منه مشاريع جديدة.",+ "openProjects": "الانتقال إلى المشاريع",+ "deleteAction": "حذف القالب",+ "deleteDialog": {+ "title": "حذف القالب \"{name}\"؟",+ "description": "لا تتغير المشاريع التي أُنشئت منه.",+ "confirm": "حذف القالب"+ },+ "panel": {+ "saved": "حُفظ في {date}",+ "none": "لا شيء"+ }+ },"panel": {"created": "أُنشئ في {date}","newProject": "مشروع جديد",diff --git a/apps/web/messages/en/newProject.json b/apps/web/messages/en/newProject.jsonindex 56f39986..4c9a4089 100644--- a/apps/web/messages/en/newProject.json+++ b/apps/web/messages/en/newProject.json@@ -4,6 +4,11 @@"copyKey": "Key","description": "Description","issueTypes": "Issue types",+ "templates": "Templates",+ "blank": "Blank project",+ "blankHint": "Default states and the issue types you pick",+ "startFrom": "Start from",+ "continue": "Continue","typesCreated": "{count, plural, one {# issue type} other {# issue types}} will be created","defaultType": "New issues get {type} by default. Types are editable in settings.","presets": {@@ -33,6 +38,7 @@"issueTypes": "Issue types","labels": "Labels","customFields": "Custom fields",+ "issueTemplates": "Issue templates","views": "Views","dashboards": "Dashboards","documents": "Docs",diff --git a/apps/web/messages/en/projects.json b/apps/web/messages/en/projects.jsonindex d1f7c007..ecb4f161 100644--- a/apps/web/messages/en/projects.json+++ b/apps/web/messages/en/projects.json@@ -1,6 +1,13 @@{"editAction": "Edit project","copyAction": "Copy project",+ "saveTemplateAction": "Save as template",+ "saveTemplate": {+ "title": "Save \"{name}\" as a template",+ "hint": "The template keeps a copy of the chosen settings. Later changes to this project don't change it. Docs, agents, schedules and webhooks aren't saved.",+ "save": "Save template",+ "saved": "Template \"{name}\" saved"+ },"deleteAction": "Delete project","leaveAction": "Leave project","archiveAction": "Archive project",diff --git a/apps/web/messages/en/teams.json b/apps/web/messages/en/teams.jsonindex 99620e63..8705427a 100644--- a/apps/web/messages/en/teams.json+++ b/apps/web/messages/en/teams.json@@ -20,6 +20,10 @@"title": "Projects","description": "The projects this team owns."},+ "templates": {+ "title": "Project templates",+ "description": "Saved project settings that new projects start from."+ },"members": {"title": "Team members","description": "Everyone in the team, and the invites that are still open."@@ -74,15 +78,16 @@"leaveHint": "You keep the projects you are a member of. To join again an owner has to add you back.","delete": {"action": "Delete team",- "hint": "Its members, roles, invites, skills, tools and integrations are deleted with it. People keep their accounts and their other teams.",+ "hint": "Its members, roles, project templates, invites, skills, tools and integrations are deleted with it. People keep their accounts and their other teams.","blocked": "Delete the projects and AI agents of the team first.","title": "Delete {name}?",- "description": "<strong>{name}</strong> is deleted with its members, roles, invites, skills, tools and integrations. People keep their accounts and their other teams. This cannot be undone.",+ "description": "<strong>{name}</strong> is deleted with its members, roles, project templates, invites, skills, tools and integrations. People keep their accounts and their other teams. This cannot be undone.","deleted": "Team deleted"}},"columns": {"project": "Project",+ "template": "Template","owners": "Owners","members": "Members","created": "Created",@@ -182,6 +187,22 @@"empty": "The roles export is empty."}},+ "templates": {+ "ownerOnly": "Only a team owner or manager can manage project templates.",+ "empty": "No project templates yet",+ "emptyHint": "Save a project as a template, then start new projects from it.",+ "openProjects": "Go to projects",+ "deleteAction": "Delete template",+ "deleteDialog": {+ "title": "Delete template \"{name}\"?",+ "description": "Projects created from it stay as they are.",+ "confirm": "Delete template"+ },+ "panel": {+ "saved": "Saved {date}",+ "none": "None"+ }+ },"panel": {"created": "Created {date}","newProject": "New project",diff --git a/apps/web/messages/es-ES/newProject.json b/apps/web/messages/es-ES/newProject.jsonindex 3814247e..cb0fba80 100644--- a/apps/web/messages/es-ES/newProject.json+++ b/apps/web/messages/es-ES/newProject.json@@ -4,6 +4,11 @@"copyKey": "Clave","description": "Descripción","issueTypes": "Tipos de ticket",+ "templates": "Plantillas",+ "blank": "Proyecto en blanco",+ "blankHint": "Estados por defecto y los tipos de ticket que elijas",+ "startFrom": "Empezar desde",+ "continue": "Continuar","typesCreated": "Se crearán {count, plural, one {# tipo de ticket} other {# tipos de ticket}}","defaultType": "Los nuevos tickets reciben {type} por defecto. Los tipos se pueden editar en los ajustes.","presets": {@@ -33,6 +38,7 @@"issueTypes": "Tipos de ticket","labels": "Etiquetas","customFields": "Campos personalizados",+ "issueTemplates": "Plantillas de ticket","views": "Vistas","dashboards": "Paneles","documents": "Documentos",diff --git a/apps/web/messages/es-ES/projects.json b/apps/web/messages/es-ES/projects.jsonindex fdb38a01..9911bc77 100644--- a/apps/web/messages/es-ES/projects.json+++ b/apps/web/messages/es-ES/projects.json@@ -1,6 +1,13 @@{"editAction": "Editar proyecto","copyAction": "Duplicar proyecto",+ "saveTemplateAction": "Guardar como plantilla",+ "saveTemplate": {+ "title": "Guardar «{name}» como plantilla",+ "hint": "La plantilla guarda una copia de los ajustes elegidos. Los cambios posteriores en el proyecto no la modifican. Los documentos, los agentes, las tareas programadas y los webhooks no se guardan.",+ "save": "Guardar plantilla",+ "saved": "Plantilla «{name}» guardada"+ },"deleteAction": "Eliminar proyecto","leaveAction": "Abandonar proyecto","archiveAction": "Archivar proyecto",diff --git a/apps/web/messages/es-ES/teams.json b/apps/web/messages/es-ES/teams.jsonindex 5aff91a1..d09136b7 100644--- a/apps/web/messages/es-ES/teams.json+++ b/apps/web/messages/es-ES/teams.json@@ -20,6 +20,10 @@"title": "Proyectos","description": "Los proyectos que este equipo posee."},+ "templates": {+ "title": "Plantillas de proyecto",+ "description": "Ajustes guardados con los que empiezan los proyectos nuevos."+ },"members": {"title": "Miembros del equipo","description": "Todo el mundo del equipo, y las invitaciones que siguen abiertas."@@ -74,15 +78,16 @@"leaveHint": "Conservas los proyectos de los que eres miembro. Para volver a unirte, un propietario tiene que añadirte de vuelta.","delete": {"action": "Eliminar equipo",- "hint": "Se eliminan con él sus miembros, roles, invitaciones, habilidades, herramientas e integraciones. Las personas conservan sus cuentas y sus otros equipos.",+ "hint": "Se eliminan con él sus miembros, roles, plantillas de proyecto, invitaciones, habilidades, herramientas e integraciones. Las personas conservan sus cuentas y sus otros equipos.","blocked": "Elimina primero los proyectos y los agentes de IA del equipo.","title": "¿Eliminar {name}?",- "description": "<strong>{name}</strong> se elimina junto con sus miembros, roles, invitaciones, habilidades, herramientas e integraciones. Las personas conservan sus cuentas y sus otros equipos. No se puede deshacer.",+ "description": "<strong>{name}</strong> se elimina junto con sus miembros, roles, plantillas de proyecto, invitaciones, habilidades, herramientas e integraciones. Las personas conservan sus cuentas y sus otros equipos. No se puede deshacer.","deleted": "Equipo eliminado"}},"columns": {"project": "Proyecto",+ "template": "Plantilla","owners": "Propietarios","members": "Miembros","created": "Creada",@@ -182,6 +187,22 @@"empty": "La exportación de roles está vacía."}},+ "templates": {+ "ownerOnly": "Solo un propietario o administrador del equipo puede gestionar las plantillas de proyecto.",+ "empty": "Todavía no hay plantillas de proyecto",+ "emptyHint": "Guarda un proyecto como plantilla para crear proyectos nuevos a partir de ella.",+ "openProjects": "Ir a proyectos",+ "deleteAction": "Eliminar plantilla",+ "deleteDialog": {+ "title": "¿Eliminar la plantilla «{name}»?",+ "description": "Los proyectos creados con ella no cambian.",+ "confirm": "Eliminar plantilla"+ },+ "panel": {+ "saved": "Guardada el {date}",+ "none": "Ninguno"+ }+ },"panel": {"created": "Creada el {date}","newProject": "Nuevo proyecto",diff --git a/apps/web/messages/fa/newProject.json b/apps/web/messages/fa/newProject.jsonindex 17d2dc51..a227c039 100644--- a/apps/web/messages/fa/newProject.json+++ b/apps/web/messages/fa/newProject.json@@ -4,6 +4,11 @@"copyKey": "کلید","description": "توضیحات","issueTypes": "انواع تسک",+ "templates": "قالبها",+ "blank": "پروژه خالی",+ "blankHint": "وضعیتهای پیشفرض و انواع تسکی که انتخاب میکنید",+ "startFrom": "شروع از",+ "continue": "ادامه","typesCreated": "{count, plural, one {# نوع تسک} other {# نوع تسک}} ساخته میشود","defaultType": "تسکهای جدید بهطور پیشفرض {type} میگیرند. انواع در تنظیمات قابل ویرایش هستند.","presets": {@@ -33,6 +38,7 @@"issueTypes": "انواع تسک","labels": "برچسبها","customFields": "فیلدهای سفارشی",+ "issueTemplates": "قالبهای تسک","views": "نماها","dashboards": "داشبوردها","documents": "مستندات",diff --git a/apps/web/messages/fa/projects.json b/apps/web/messages/fa/projects.jsonindex 84550b55..969a051c 100644--- a/apps/web/messages/fa/projects.json+++ b/apps/web/messages/fa/projects.json@@ -1,6 +1,13 @@{"editAction": "ویرایش پروژه","copyAction": "کپی پروژه",+ "saveTemplateAction": "ذخیره بهعنوان قالب",+ "saveTemplate": {+ "title": "ذخیرهٔ «{name}» بهعنوان قالب",+ "hint": "قالب یک نسخه از تنظیمات انتخابشده را نگه میدارد. تغییرات بعدی پروژه آن را تغییر نمیدهد. مستندات، ایجنتها، زمانبندیها و وبهوکها ذخیره نمیشوند.",+ "save": "ذخیرهٔ قالب",+ "saved": "قالب «{name}» ذخیره شد"+ },"deleteAction": "حذف پروژه","leaveAction": "خروج از پروژه","archiveAction": "بایگانی پروژه",diff --git a/apps/web/messages/fa/teams.json b/apps/web/messages/fa/teams.jsonindex a7765089..d16d72f2 100644--- a/apps/web/messages/fa/teams.json+++ b/apps/web/messages/fa/teams.json@@ -20,6 +20,10 @@"title": "پروژهها","description": "پروژههایی که این تیم مالک آنهاست."},+ "templates": {+ "title": "قالبهای پروژه",+ "description": "تنظیمات ذخیرهشدهٔ پروژه که پروژههای جدید از آن شروع میشوند."+ },"members": {"title": "اعضای تیم","description": "همه اعضای تیم و دعوتهایی که هنوز باز هستند."@@ -74,15 +78,16 @@"leaveHint": "پروژههایی که عضو آن هستید را حفظ میکنید. برای پیوستن دوباره، یک مالک باید شما را دوباره اضافه کند.","delete": {"action": "حذف تیم",- "hint": "اعضا، نقشها، دعوتها، مهارتها، ابزارها و یکپارچهسازیهای آن نیز حذف میشوند. افراد حسابهای خود و تیمهای دیگرشان را حفظ میکنند.",+ "hint": "اعضا، نقشها، قالبهای پروژه، دعوتها، مهارتها، ابزارها و یکپارچهسازیهای آن نیز حذف میشوند. افراد حسابهای خود و تیمهای دیگرشان را حفظ میکنند.","blocked": "ابتدا پروژهها و ایجنتهای AI تیم را حذف کنید.","title": "حذف {name}؟",- "description": "<strong>{name}</strong> با اعضا، نقشها، دعوتها، مهارتها، ابزارها و یکپارچهسازیهایش حذف میشود. افراد حسابهای خود و تیمهای دیگرشان را حفظ میکنند. این کار قابل بازگشت نیست.",+ "description": "<strong>{name}</strong> با اعضا، نقشها، قالبهای پروژه، دعوتها، مهارتها، ابزارها و یکپارچهسازیهایش حذف میشود. افراد حسابهای خود و تیمهای دیگرشان را حفظ میکنند. این کار قابل بازگشت نیست.","deleted": "تیم حذف شد"}},"columns": {"project": "پروژه",+ "template": "قالب","owners": "مالکان","members": "اعضا","created": "ایجادشده",@@ -182,6 +187,22 @@"empty": "خروجی نقشها خالی است."}},+ "templates": {+ "ownerOnly": "فقط مالک یا مدیر تیم میتواند قالبهای پروژه را مدیریت کند.",+ "empty": "هنوز قالب پروژهای وجود ندارد",+ "emptyHint": "یک پروژه را بهعنوان قالب ذخیره کنید تا پروژههای جدید را از آن بسازید.",+ "openProjects": "رفتن به پروژهها",+ "deleteAction": "حذف قالب",+ "deleteDialog": {+ "title": "قالب «{name}» حذف شود؟",+ "description": "پروژههایی که از آن ساخته شدهاند تغییری نمیکنند.",+ "confirm": "حذف قالب"+ },+ "panel": {+ "saved": "ذخیرهشده در {date}",+ "none": "هیچ"+ }+ },"panel": {"created": "ایجادشده در {date}","newProject": "پروژه جدید",diff --git a/apps/web/messages/fr/newProject.json b/apps/web/messages/fr/newProject.jsonindex 0631ce38..54abb8c2 100644--- a/apps/web/messages/fr/newProject.json+++ b/apps/web/messages/fr/newProject.json@@ -4,6 +4,11 @@"copyKey": "Clé","description": "Description","issueTypes": "Types de tickets",+ "templates": "Modèles",+ "blank": "Projet vierge",+ "blankHint": "États par défaut et les types de tickets choisis",+ "startFrom": "Partir de",+ "continue": "Continuer","typesCreated": "{count, plural, one {# type de ticket sera créé} other {# types de tickets seront créés}}","defaultType": "Les nouveaux tickets reçoivent le type {type} par défaut. Les types sont modifiables dans les paramètres.","presets": {@@ -33,6 +38,7 @@"issueTypes": "Types de tickets","labels": "Étiquettes","customFields": "Champs personnalisés",+ "issueTemplates": "Modèles de tickets","views": "Vues","dashboards": "Tableaux de bord","documents": "Documents",diff --git a/apps/web/messages/fr/projects.json b/apps/web/messages/fr/projects.jsonindex 118ee51f..f5dabf34 100644--- a/apps/web/messages/fr/projects.json+++ b/apps/web/messages/fr/projects.json@@ -1,6 +1,13 @@{"editAction": "Modifier le projet","copyAction": "Copier le projet",+ "saveTemplateAction": "Enregistrer comme modèle",+ "saveTemplate": {+ "title": "Enregistrer « {name} » comme modèle",+ "hint": "Le modèle garde une copie des paramètres choisis. Les modifications ultérieures du projet ne le changent pas. Les documents, les agents, les planifications et les webhooks ne sont pas enregistrés.",+ "save": "Enregistrer le modèle",+ "saved": "Modèle « {name} » enregistré"+ },"deleteAction": "Supprimer le projet","leaveAction": "Quitter le projet","archiveAction": "Archiver le projet",diff --git a/apps/web/messages/fr/teams.json b/apps/web/messages/fr/teams.jsonindex 8484a5fb..56ced353 100644--- a/apps/web/messages/fr/teams.json+++ b/apps/web/messages/fr/teams.json@@ -20,6 +20,10 @@"title": "Projets","description": "Les projets que cette équipe détient."},+ "templates": {+ "title": "Modèles de projet",+ "description": "Paramètres enregistrés à partir desquels les nouveaux projets démarrent."+ },"members": {"title": "Membres de l'équipe","description": "Tous les membres de l'équipe, et les invitations encore ouvertes."@@ -74,15 +78,16 @@"leaveHint": "Vous conservez les projets dont vous êtes membre. Pour revenir, un propriétaire doit vous ajouter à nouveau.","delete": {"action": "Supprimer l'équipe",- "hint": "Ses membres, rôles, invitations, compétences, outils et intégrations sont supprimés avec elle. Les personnes conservent leur compte et leurs autres équipes.",+ "hint": "Ses membres, rôles, modèles de projet, invitations, compétences, outils et intégrations sont supprimés avec elle. Les personnes conservent leur compte et leurs autres équipes.","blocked": "Supprimez d'abord les projets et les agents IA de l'équipe.","title": "Supprimer {name} ?",- "description": "<strong>{name}</strong> est supprimée avec ses membres, rôles, invitations, compétences, outils et intégrations. Les personnes conservent leur compte et leurs autres équipes. Cette action est irréversible.",+ "description": "<strong>{name}</strong> est supprimée avec ses membres, rôles, modèles de projet, invitations, compétences, outils et intégrations. Les personnes conservent leur compte et leurs autres équipes. Cette action est irréversible.","deleted": "Équipe supprimée"}},"columns": {"project": "Projet",+ "template": "Modèle","owners": "Propriétaires","members": "Membres","created": "Créé le",@@ -182,6 +187,22 @@"empty": "L'export de rôles est vide."}},+ "templates": {+ "ownerOnly": "Seul un propriétaire ou un responsable de l'équipe peut gérer les modèles de projet.",+ "empty": "Aucun modèle de projet pour l'instant",+ "emptyHint": "Enregistrez un projet comme modèle pour créer de nouveaux projets à partir de celui-ci.",+ "openProjects": "Voir les projets",+ "deleteAction": "Supprimer le modèle",+ "deleteDialog": {+ "title": "Supprimer le modèle « {name} » ?",+ "description": "Les projets créés à partir de ce modèle restent inchangés.",+ "confirm": "Supprimer le modèle"+ },+ "panel": {+ "saved": "Enregistré le {date}",+ "none": "Aucun"+ }+ },"panel": {"created": "Créé {date}","newProject": "Nouveau projet",diff --git a/apps/web/messages/id/newProject.json b/apps/web/messages/id/newProject.jsonindex 69448d0e..bd5f10ef 100644--- a/apps/web/messages/id/newProject.json+++ b/apps/web/messages/id/newProject.json@@ -4,6 +4,11 @@"copyKey": "Kunci","description": "Deskripsi","issueTypes": "Jenis issue",+ "templates": "Templat",+ "blank": "Proyek kosong",+ "blankHint": "Status bawaan dan jenis issue yang Anda pilih",+ "startFrom": "Mulai dari",+ "continue": "Lanjutkan","typesCreated": "{count, plural, one {# jenis issue} other {# jenis issue}} akan dibuat","defaultType": "Issue baru akan menggunakan {type} secara bawaan. Jenis dapat diedit di pengaturan.","presets": {@@ -33,6 +38,7 @@"issueTypes": "Jenis issue","labels": "Label","customFields": "Bidang kustom",+ "issueTemplates": "Templat issue","views": "Tampilan","dashboards": "Dasbor","documents": "Dokumen",diff --git a/apps/web/messages/id/projects.json b/apps/web/messages/id/projects.jsonindex f65a44d5..cb94a6af 100644--- a/apps/web/messages/id/projects.json+++ b/apps/web/messages/id/projects.json@@ -1,6 +1,13 @@{"editAction": "Ubah proyek","copyAction": "Salin proyek",+ "saveTemplateAction": "Simpan sebagai templat",+ "saveTemplate": {+ "title": "Simpan \"{name}\" sebagai templat",+ "hint": "Templat menyimpan salinan pengaturan yang dipilih. Perubahan proyek setelahnya tidak mengubah templat. Dokumen, agen, jadwal, dan webhook tidak disimpan.",+ "save": "Simpan templat",+ "saved": "Templat \"{name}\" disimpan"+ },"deleteAction": "Hapus proyek","leaveAction": "Tinggalkan proyek","archiveAction": "Arsipkan proyek",diff --git a/apps/web/messages/id/teams.json b/apps/web/messages/id/teams.jsonindex dd36b8ad..c69470ed 100644--- a/apps/web/messages/id/teams.json+++ b/apps/web/messages/id/teams.json@@ -20,6 +20,10 @@"title": "Proyek","description": "Proyek yang dimiliki tim ini."},+ "templates": {+ "title": "Templat proyek",+ "description": "Pengaturan tersimpan yang menjadi awal proyek baru."+ },"members": {"title": "Anggota tim","description": "Semua orang di tim, dan undangan yang masih terbuka."@@ -74,15 +78,16 @@"leaveHint": "Anda tetap menjadi anggota proyek yang Anda ikuti. Untuk bergabung kembali, pemilik harus menambahkan Anda lagi.","delete": {"action": "Hapus tim",- "hint": "Anggota, peran, undangan, keterampilan, alat, dan integrasinya ikut dihapus. Orang-orang tetap memiliki akun dan tim lain mereka.",+ "hint": "Anggota, peran, templat proyek, undangan, keterampilan, alat, dan integrasinya ikut dihapus. Orang-orang tetap memiliki akun dan tim lain mereka.","blocked": "Hapus dulu proyek dan agen AI milik tim.","title": "Hapus {name}?",- "description": "<strong>{name}</strong> dihapus beserta anggota, peran, undangan, keterampilan, alat, dan integrasinya. Orang-orang tetap memiliki akun dan tim lain mereka. Tindakan ini tidak dapat dibatalkan.",+ "description": "<strong>{name}</strong> dihapus beserta anggota, peran, templat proyek, undangan, keterampilan, alat, dan integrasinya. Orang-orang tetap memiliki akun dan tim lain mereka. Tindakan ini tidak dapat dibatalkan.","deleted": "Tim dihapus"}},"columns": {"project": "Proyek",+ "template": "Templat","owners": "Pemilik","members": "Anggota","created": "Dibuat",@@ -182,6 +187,22 @@"empty": "Ekspor peran kosong."}},+ "templates": {+ "ownerOnly": "Hanya pemilik atau manajer tim yang dapat mengelola templat proyek.",+ "empty": "Belum ada templat proyek",+ "emptyHint": "Simpan proyek sebagai templat untuk membuat proyek baru darinya.",+ "openProjects": "Buka proyek",+ "deleteAction": "Hapus templat",+ "deleteDialog": {+ "title": "Hapus templat \"{name}\"?",+ "description": "Proyek yang dibuat dari templat ini tidak berubah.",+ "confirm": "Hapus templat"+ },+ "panel": {+ "saved": "Disimpan {date}",+ "none": "Tidak ada"+ }+ },"panel": {"created": "Dibuat {date}","newProject": "Proyek baru",diff --git a/apps/web/messages/ko/newProject.json b/apps/web/messages/ko/newProject.jsonindex a45dda4d..6d520d93 100644--- a/apps/web/messages/ko/newProject.json+++ b/apps/web/messages/ko/newProject.json@@ -4,6 +4,11 @@"copyKey": "키","description": "설명","issueTypes": "이슈 유형",+ "templates": "템플릿",+ "blank": "빈 프로젝트",+ "blankHint": "기본 상태와 선택한 이슈 유형",+ "startFrom": "시작 기준",+ "continue": "계속","typesCreated": "{count, plural, one {이슈 유형 #개가 생성됩니다} other {이슈 유형 #개가 생성됩니다}}","defaultType": "새 이슈에는 기본적으로 {type} 유형이 적용됩니다. 유형은 설정에서 편집할 수 있습니다.","presets": {@@ -33,6 +38,7 @@"issueTypes": "이슈 유형","labels": "라벨","customFields": "사용자 지정 필드",+ "issueTemplates": "이슈 템플릿","views": "보기","dashboards": "대시보드","documents": "문서",diff --git a/apps/web/messages/ko/projects.json b/apps/web/messages/ko/projects.jsonindex 491fa0ef..0be1e503 100644--- a/apps/web/messages/ko/projects.json+++ b/apps/web/messages/ko/projects.json@@ -1,6 +1,13 @@{"editAction": "프로젝트 편집","copyAction": "프로젝트 복사",+ "saveTemplateAction": "템플릿으로 저장",+ "saveTemplate": {+ "title": "\"{name}\"을(를) 템플릿으로 저장",+ "hint": "템플릿은 선택한 설정의 사본을 보관합니다. 이후 프로젝트를 변경해도 템플릿은 바뀌지 않습니다. 문서, AI 에이전트, 일정, 웹훅은 저장되지 않습니다.",+ "save": "템플릿 저장",+ "saved": "\"{name}\" 템플릿이 저장되었습니다"+ },"deleteAction": "프로젝트 삭제","leaveAction": "프로젝트 나가기","archiveAction": "프로젝트 보관",diff --git a/apps/web/messages/ko/teams.json b/apps/web/messages/ko/teams.jsonindex bef4ba32..c8d5cf7a 100644--- a/apps/web/messages/ko/teams.json+++ b/apps/web/messages/ko/teams.json@@ -20,6 +20,10 @@"title": "프로젝트","description": "이 팀이 소유한 프로젝트를 관리합니다."},+ "templates": {+ "title": "프로젝트 템플릿",+ "description": "새 프로젝트가 시작할 때 쓰는 저장된 프로젝트 설정입니다."+ },"members": {"title": "팀 멤버","description": "팀의 모든 멤버와 아직 수락되지 않은 초대를 관리합니다."@@ -74,15 +78,16 @@"leaveHint": "내가 멤버로 참여 중인 프로젝트는 계속 유지됩니다. 팀에 다시 참여하려면 소유자가 나를 다시 추가해야 합니다.","delete": {"action": "팀 삭제",- "hint": "팀을 삭제하면 멤버, 역할, 초대, 스킬, 도구 및 연동도 함께 삭제됩니다. 사용자의 계정과 다른 팀은 유지됩니다.",+ "hint": "팀을 삭제하면 멤버, 역할, 프로젝트 템플릿, 초대, 스킬, 도구 및 연동도 함께 삭제됩니다. 사용자의 계정과 다른 팀은 유지됩니다.","blocked": "먼저 이 팀의 프로젝트와 AI 에이전트를 삭제하세요.","title": "{name} 팀을 삭제하시겠습니까?",- "description": "<strong>{name}</strong> 팀과 멤버, 역할, 초대, 스킬, 도구 및 연동이 삭제됩니다. 사용자의 계정과 다른 팀은 유지됩니다. 이 작업은 되돌릴 수 없습니다.",+ "description": "<strong>{name}</strong> 팀과 멤버, 역할, 프로젝트 템플릿, 초대, 스킬, 도구 및 연동이 삭제됩니다. 사용자의 계정과 다른 팀은 유지됩니다. 이 작업은 되돌릴 수 없습니다.","deleted": "팀이 삭제되었습니다"}},"columns": {"project": "프로젝트",+ "template": "템플릿","owners": "소유자","members": "멤버","created": "생성일",@@ -182,6 +187,22 @@"empty": "역할 내보내기 데이터가 비어 있습니다."}},+ "templates": {+ "ownerOnly": "팀 소유자 또는 관리자만 프로젝트 템플릿을 관리할 수 있습니다.",+ "empty": "아직 프로젝트 템플릿이 없습니다",+ "emptyHint": "프로젝트를 템플릿으로 저장하면 그 템플릿으로 새 프로젝트를 만들 수 있습니다.",+ "openProjects": "프로젝트로 이동",+ "deleteAction": "템플릿 삭제",+ "deleteDialog": {+ "title": "\"{name}\" 템플릿을 삭제할까요?",+ "description": "이 템플릿으로 만든 프로젝트는 그대로 유지됩니다.",+ "confirm": "템플릿 삭제"+ },+ "panel": {+ "saved": "{date}에 저장됨",+ "none": "없음"+ }+ },"panel": {"created": "{date}에 생성됨","newProject": "새 프로젝트",diff --git a/apps/web/messages/pt-BR/newProject.json b/apps/web/messages/pt-BR/newProject.jsonindex aceeb71e..6fd07abb 100644--- a/apps/web/messages/pt-BR/newProject.json+++ b/apps/web/messages/pt-BR/newProject.json@@ -4,6 +4,11 @@"copyKey": "Chave","description": "Descrição","issueTypes": "Tipos de issue",+ "templates": "Modelos",+ "blank": "Projeto em branco",+ "blankHint": "Estados padrão e os tipos de issue que você escolher",+ "startFrom": "Começar de",+ "continue": "Continuar","typesCreated": "{count, plural, one {# tipo de issue} other {# tipos de issue}} serão criados","defaultType": "Novas issues recebem {type} por padrão. Tipos são editáveis nas configurações.","presets": {@@ -33,6 +38,7 @@"issueTypes": "Tipos de issue","labels": "Etiquetas","customFields": "Campos personalizados",+ "issueTemplates": "Modelos de issue","views": "Visões","dashboards": "Dashboards","documents": "Documentos",diff --git a/apps/web/messages/pt-BR/projects.json b/apps/web/messages/pt-BR/projects.jsonindex ef5270a6..d410bde6 100644--- a/apps/web/messages/pt-BR/projects.json+++ b/apps/web/messages/pt-BR/projects.json@@ -1,6 +1,13 @@{"editAction": "Editar projeto","copyAction": "Copiar projeto",+ "saveTemplateAction": "Salvar como modelo",+ "saveTemplate": {+ "title": "Salvar \"{name}\" como modelo",+ "hint": "O modelo guarda uma cópia das configurações escolhidas. Mudanças posteriores no projeto não o alteram. Documentos, agentes, agendamentos e webhooks não são salvos.",+ "save": "Salvar modelo",+ "saved": "Modelo \"{name}\" salvo"+ },"deleteAction": "Excluir projeto","leaveAction": "Sair do projeto","archiveAction": "Arquivar projeto",diff --git a/apps/web/messages/pt-BR/teams.json b/apps/web/messages/pt-BR/teams.jsonindex 9ba33c0b..6f893be4 100644--- a/apps/web/messages/pt-BR/teams.json+++ b/apps/web/messages/pt-BR/teams.json@@ -20,6 +20,10 @@"title": "Projetos","description": "Os projetos que este time possui."},+ "templates": {+ "title": "Modelos de projeto",+ "description": "Configurações salvas a partir das quais novos projetos começam."+ },"members": {"title": "Membros do time","description": "Todos no time e os convites ainda abertos."@@ -74,15 +78,16 @@"leaveHint": "Você mantém os projetos de que é membro. Para entrar de novo, um dono precisa readicioná-lo.","delete": {"action": "Excluir equipe",- "hint": "Seus membros, funções, convites, habilidades, ferramentas e integrações são excluídos com ela. As pessoas mantêm suas contas e suas outras equipes.",+ "hint": "Seus membros, funções, modelos de projeto, convites, habilidades, ferramentas e integrações são excluídos com ela. As pessoas mantêm suas contas e suas outras equipes.","blocked": "Exclua primeiro os projetos e os agentes de IA da equipe.","title": "Excluir {name}?",- "description": "<strong>{name}</strong> é excluída com seus membros, funções, convites, habilidades, ferramentas e integrações. As pessoas mantêm suas contas e suas outras equipes. Isso não pode ser desfeito.",+ "description": "<strong>{name}</strong> é excluída com seus membros, funções, modelos de projeto, convites, habilidades, ferramentas e integrações. As pessoas mantêm suas contas e suas outras equipes. Isso não pode ser desfeito.","deleted": "Equipe excluída"}},"columns": {"project": "Projeto",+ "template": "Modelo","owners": "Donos","members": "Membros","created": "Criado",@@ -182,6 +187,22 @@"empty": "A exportação de funções está vazia."}},+ "templates": {+ "ownerOnly": "Só um dono ou gerente do time pode gerenciar modelos de projeto.",+ "empty": "Nenhum modelo de projeto ainda",+ "emptyHint": "Salve um projeto como modelo para criar novos projetos a partir dele.",+ "openProjects": "Ir para projetos",+ "deleteAction": "Excluir modelo",+ "deleteDialog": {+ "title": "Excluir o modelo \"{name}\"?",+ "description": "Os projetos criados a partir dele continuam iguais.",+ "confirm": "Excluir modelo"+ },+ "panel": {+ "saved": "Salvo em {date}",+ "none": "Nenhum"+ }+ },"panel": {"created": "Criado em {date}","newProject": "Novo projeto",diff --git a/apps/web/messages/ru/newProject.json b/apps/web/messages/ru/newProject.jsonindex c27d0b75..e28727e0 100644--- a/apps/web/messages/ru/newProject.json+++ b/apps/web/messages/ru/newProject.json@@ -4,6 +4,11 @@"copyKey": "Ключ","description": "Описание","issueTypes": "Типы задач",+ "templates": "Шаблоны",+ "blank": "Пустой проект",+ "blankHint": "Стандартные статусы и выбранные типы задач",+ "startFrom": "Начать с",+ "continue": "Продолжить","typesCreated": "Будет создано {count, plural, one {# тип задачи} few {# типа задач} many {# типов задач} other {# типа задач}}","defaultType": "Новые задачи по умолчанию получают тип {type}. Типы можно изменить в настройках.","presets": {@@ -33,6 +38,7 @@"issueTypes": "Типы задач","labels": "Метки","customFields": "Пользовательские поля",+ "issueTemplates": "Шаблоны задач","views": "Представления","dashboards": "Дашборды","documents": "Документы",diff --git a/apps/web/messages/ru/projects.json b/apps/web/messages/ru/projects.jsonindex 8dd5ef2f..86dfc85c 100644--- a/apps/web/messages/ru/projects.json+++ b/apps/web/messages/ru/projects.json@@ -1,6 +1,13 @@{"editAction": "Изменить проект","copyAction": "Скопировать проект",+ "saveTemplateAction": "Сохранить как шаблон",+ "saveTemplate": {+ "title": "Сохранить «{name}» как шаблон",+ "hint": "Шаблон хранит копию выбранных настроек. Изменения проекта после сохранения его не меняют. Документы, агенты, расписания и вебхуки не сохраняются.",+ "save": "Сохранить шаблон",+ "saved": "Шаблон «{name}» сохранён"+ },"deleteAction": "Удалить проект","leaveAction": "Выйти из проекта","archiveAction": "Архивировать проект",diff --git a/apps/web/messages/ru/teams.json b/apps/web/messages/ru/teams.jsonindex 2be5cdfa..ddc5ac09 100644--- a/apps/web/messages/ru/teams.json+++ b/apps/web/messages/ru/teams.json@@ -20,6 +20,10 @@"title": "Проекты","description": "Проекты, которыми владеет команда."},+ "templates": {+ "title": "Шаблоны проектов",+ "description": "Сохранённые настройки, с которых начинаются новые проекты."+ },"members": {"title": "Участники команды","description": "Все участники команды и приглашения, на которые ещё не ответили."@@ -74,15 +78,16 @@"leaveHint": "Проекты, в которых вы участвуете, остаются у вас. Чтобы вернуться, владелец должен добавить вас снова.","delete": {"action": "Удалить команду",- "hint": "Вместе с ней удаляются участники, роли, приглашения, навыки, инструменты и интеграции. Люди сохраняют свои аккаунты и другие команды.",+ "hint": "Вместе с ней удаляются участники, роли, шаблоны проектов, приглашения, навыки, инструменты и интеграции. Люди сохраняют свои аккаунты и другие команды.","blocked": "Сначала удалите проекты и ИИ-агентов команды.","title": "Удалить {name}?",- "description": "<strong>{name}</strong> удаляется вместе с участниками, ролями, приглашениями, навыками, инструментами и интеграциями. Люди сохраняют свои аккаунты и другие команды. Это действие нельзя отменить.",+ "description": "<strong>{name}</strong> удаляется вместе с участниками, ролями, шаблонами проектов, приглашениями, навыками, инструментами и интеграциями. Люди сохраняют свои аккаунты и другие команды. Это действие нельзя отменить.","deleted": "Команда удалена"}},"columns": {"project": "Проект",+ "template": "Шаблон","owners": "Владельцы","members": "Участники","created": "Создан",@@ -182,6 +187,22 @@"empty": "Экспорт ролей пуст."}},+ "templates": {+ "ownerOnly": "Шаблонами проектов управляют только владелец или менеджер команды.",+ "empty": "Шаблонов проектов пока нет",+ "emptyHint": "Сохраните проект как шаблон, чтобы создавать по нему новые проекты.",+ "openProjects": "Перейти к проектам",+ "deleteAction": "Удалить шаблон",+ "deleteDialog": {+ "title": "Удалить шаблон «{name}»?",+ "description": "Проекты, созданные по нему, не изменятся.",+ "confirm": "Удалить шаблон"+ },+ "panel": {+ "saved": "Сохранён {date}",+ "none": "Нет"+ }+ },"panel": {"created": "Создан {date}","newProject": "Новый проект",diff --git a/apps/web/messages/tr/newProject.json b/apps/web/messages/tr/newProject.jsonindex 5d6bf1e7..850040bd 100644--- a/apps/web/messages/tr/newProject.json+++ b/apps/web/messages/tr/newProject.json@@ -4,6 +4,11 @@"copyKey": "Anahtar","description": "Açıklama","issueTypes": "İş türleri",+ "templates": "Şablonlar",+ "blank": "Boş proje",+ "blankHint": "Varsayılan durumlar ve seçtiğiniz iş türleri",+ "startFrom": "Başlangıç",+ "continue": "Devam","typesCreated": "{count, plural, one {# iş türü} other {# iş türü}} oluşturulacak","defaultType": "Yeni işler varsayılan olarak {type} türünü alır. Türler ayarlardan düzenlenebilir.","presets": {@@ -33,6 +38,7 @@"issueTypes": "İş türleri","labels": "Etiketler","customFields": "Özel alanlar",+ "issueTemplates": "İş şablonları","views": "Görünümler","dashboards": "Panolar","documents": "Belgeler",diff --git a/apps/web/messages/tr/projects.json b/apps/web/messages/tr/projects.jsonindex a8553785..09a7b3a1 100644--- a/apps/web/messages/tr/projects.json+++ b/apps/web/messages/tr/projects.json@@ -1,6 +1,13 @@{"editAction": "Projeyi düzenle","copyAction": "Projeyi kopyala",+ "saveTemplateAction": "Şablon olarak kaydet",+ "saveTemplate": {+ "title": "\"{name}\" projesini şablon olarak kaydet",+ "hint": "Şablon, seçilen ayarların bir kopyasını saklar. Projede sonradan yapılan değişiklikler şablonu değiştirmez. Belgeler, ajanlar, zamanlamalar ve webhook'lar kaydedilmez.",+ "save": "Şablonu kaydet",+ "saved": "\"{name}\" şablonu kaydedildi"+ },"deleteAction": "Projeyi sil","leaveAction": "Projeden ayrıl","archiveAction": "Projeyi arşivle",diff --git a/apps/web/messages/tr/teams.json b/apps/web/messages/tr/teams.jsonindex f272ac94..28a1c332 100644--- a/apps/web/messages/tr/teams.json+++ b/apps/web/messages/tr/teams.json@@ -20,6 +20,10 @@"title": "Projeler","description": "Bu takımın sahip olduğu projeler."},+ "templates": {+ "title": "Proje şablonları",+ "description": "Yeni projelerin başladığı kayıtlı proje ayarları."+ },"members": {"title": "Takım üyeleri","description": "Takımdaki herkes ve bekleyen açık davetler."@@ -74,15 +78,16 @@"leaveHint": "Üyesi olduğunuz projelerdeki erişiminiz kalır. Takıma tekrar katılmak için bir sahibin sizi eklemesi gerekir.","delete": {"action": "Takımı sil",- "hint": "Üyeleri, rolleri, davetleri, yetenekleri, araçları ve entegrasyonları takımla birlikte silinir. Kişilerin hesapları ve diğer takımları korunur.",+ "hint": "Üyeleri, rolleri, proje şablonları, davetleri, yetenekleri, araçları ve entegrasyonları takımla birlikte silinir. Kişilerin hesapları ve diğer takımları korunur.","blocked": "Önce takımın projelerini ve yapay zekâ ajanlarını silin.","title": "{name} silinsin mi?",- "description": "<strong>{name}</strong> takımı; üyeleri, rolleri, davetleri, yetenekleri, araçları ve entegrasyonlarıyla birlikte silinecektir. Kişilerin hesapları ve diğer takımları korunur. Bu işlem geri alınamaz.",+ "description": "<strong>{name}</strong> takımı; üyeleri, rolleri, proje şablonları, davetleri, yetenekleri, araçları ve entegrasyonlarıyla birlikte silinecektir. Kişilerin hesapları ve diğer takımları korunur. Bu işlem geri alınamaz.","deleted": "Takım silindi"}},"columns": {"project": "Proje",+ "template": "Şablon","owners": "Sahipler","members": "Üyeler","created": "Oluşturulma",@@ -182,6 +187,22 @@"empty": "Rol dışa aktarma verisi boş."}},+ "templates": {+ "ownerOnly": "Proje şablonlarını yalnızca bir takım sahibi veya yöneticisi yönetebilir.",+ "empty": "Henüz proje şablonu yok",+ "emptyHint": "Yeni projeleri bir şablondan başlatmak için bir projeyi şablon olarak kaydedin.",+ "openProjects": "Projelere git",+ "deleteAction": "Şablonu sil",+ "deleteDialog": {+ "title": "\"{name}\" şablonu silinsin mi?",+ "description": "Bu şablondan oluşturulan projeler değişmez.",+ "confirm": "Şablonu sil"+ },+ "panel": {+ "saved": "{date} tarihinde kaydedildi",+ "none": "Yok"+ }+ },"panel": {"created": "{date} tarihinde oluşturuldu","newProject": "Yeni proje",diff --git a/apps/web/messages/uk/newProject.json b/apps/web/messages/uk/newProject.jsonindex e0dbd500..cabbc03f 100644--- a/apps/web/messages/uk/newProject.json+++ b/apps/web/messages/uk/newProject.json@@ -4,6 +4,11 @@"copyKey": "Ключ","description": "Опис","issueTypes": "Типи задач",+ "templates": "Шаблони",+ "blank": "Порожній проєкт",+ "blankHint": "Стандартні статуси та вибрані типи задач",+ "startFrom": "Почати з",+ "continue": "Продовжити","typesCreated": "Буде створено {count, plural, one {# тип задачі} few {# типи задач} many {# типів задач} other {# типів задач}}","defaultType": "Нові задачі типово отримують тип {type}. Типи можна змінити в налаштуваннях.","presets": {@@ -33,6 +38,7 @@"issueTypes": "Типи задач","labels": "Мітки","customFields": "Власні поля",+ "issueTemplates": "Шаблони задач","views": "Подання","dashboards": "Дашборди","documents": "Документи",diff --git a/apps/web/messages/uk/projects.json b/apps/web/messages/uk/projects.jsonindex 583b96a7..f5d1ea69 100644--- a/apps/web/messages/uk/projects.json+++ b/apps/web/messages/uk/projects.json@@ -1,6 +1,13 @@{"editAction": "Змінити проєкт","copyAction": "Скопіювати проєкт",+ "saveTemplateAction": "Зберегти як шаблон",+ "saveTemplate": {+ "title": "Зберегти «{name}» як шаблон",+ "hint": "Шаблон зберігає копію вибраних налаштувань. Зміни проєкту після збереження його не змінюють. Документи, агенти, розклади та вебхуки не зберігаються.",+ "save": "Зберегти шаблон",+ "saved": "Шаблон «{name}» збережено"+ },"deleteAction": "Видалити проєкт","leaveAction": "Вийти з проєкту","archiveAction": "Архівувати проєкт",diff --git a/apps/web/messages/uk/teams.json b/apps/web/messages/uk/teams.jsonindex 8df38d4b..879e507c 100644--- a/apps/web/messages/uk/teams.json+++ b/apps/web/messages/uk/teams.json@@ -20,6 +20,10 @@"title": "Проєкти","description": "Проєкти, якими володіє команда."},+ "templates": {+ "title": "Шаблони проєктів",+ "description": "Збережені налаштування, з яких починаються нові проєкти."+ },"members": {"title": "Учасники команди","description": "Усі учасники команди та запрошення, на які ще не відповіли."@@ -74,15 +78,16 @@"leaveHint": "Проєкти, у яких ви берете участь, залишаються у вас. Щоб повернутися, власник має додати вас знову.","delete": {"action": "Видалити команду",- "hint": "Разом із нею видаляються учасники, ролі, запрошення, навички, інструменти та інтеграції. Люди зберігають свої облікові записи та інші команди.",+ "hint": "Разом із нею видаляються учасники, ролі, шаблони проєктів, запрошення, навички, інструменти та інтеграції. Люди зберігають свої облікові записи та інші команди.","blocked": "Спочатку видаліть проєкти та ШІ-агентів команди.","title": "Видалити {name}?",- "description": "<strong>{name}</strong> видаляється разом з учасниками, ролями, запрошеннями, навичками, інструментами та інтеграціями. Люди зберігають свої облікові записи та інші команди. Цю дію не можна скасувати.",+ "description": "<strong>{name}</strong> видаляється разом з учасниками, ролями, шаблонами проєктів, запрошеннями, навичками, інструментами та інтеграціями. Люди зберігають свої облікові записи та інші команди. Цю дію не можна скасувати.","deleted": "Команду видалено"}},"columns": {"project": "Проєкт",+ "template": "Шаблон","owners": "Власники","members": "Учасники","created": "Створено",@@ -182,6 +187,22 @@"empty": "Експорт ролей порожній."}},+ "templates": {+ "ownerOnly": "Шаблонами проєктів керують лише власник або менеджер команди.",+ "empty": "Шаблонів проєктів поки немає",+ "emptyHint": "Збережіть проєкт як шаблон, щоб створювати за ним нові проєкти.",+ "openProjects": "Перейти до проєктів",+ "deleteAction": "Видалити шаблон",+ "deleteDialog": {+ "title": "Видалити шаблон «{name}»?",+ "description": "Проєкти, створені за ним, не зміняться.",+ "confirm": "Видалити шаблон"+ },+ "panel": {+ "saved": "Збережено {date}",+ "none": "Немає"+ }+ },"panel": {"created": "Створено {date}","newProject": "Новий проєкт",diff --git a/apps/web/messages/zh-CN/newProject.json b/apps/web/messages/zh-CN/newProject.jsonindex 273000c1..eebea172 100644--- a/apps/web/messages/zh-CN/newProject.json+++ b/apps/web/messages/zh-CN/newProject.json@@ -4,6 +4,11 @@"copyKey": "标识","description": "描述","issueTypes": "工作项类型",+ "templates": "模板",+ "blank": "空白项目",+ "blankHint": "默认状态和你选择的工作项类型",+ "startFrom": "起点",+ "continue": "继续","typesCreated": "将创建 {count, plural, other {# 个工作项类型}}","defaultType": "新工作项默认使用 {type} 类型,可在设置中编辑。","presets": {@@ -33,6 +38,7 @@"issueTypes": "工作项类型","labels": "标签","customFields": "自定义字段",+ "issueTemplates": "问题模板","views": "视图","dashboards": "仪表盘","documents": "文档",diff --git a/apps/web/messages/zh-CN/projects.json b/apps/web/messages/zh-CN/projects.jsonindex bba8162c..9a1828be 100644--- a/apps/web/messages/zh-CN/projects.json+++ b/apps/web/messages/zh-CN/projects.json@@ -1,6 +1,13 @@{"editAction": "编辑项目","copyAction": "复制项目",+ "saveTemplateAction": "另存为模板",+ "saveTemplate": {+ "title": "将“{name}”另存为模板",+ "hint": "模板会保存所选设置的副本。之后对项目的更改不会影响模板。文档、代理、定时任务和 Webhook 不会保存。",+ "save": "保存模板",+ "saved": "模板“{name}”已保存"+ },"deleteAction": "删除项目","leaveAction": "退出项目","archiveAction": "归档项目",diff --git a/apps/web/messages/zh-CN/teams.json b/apps/web/messages/zh-CN/teams.jsonindex 03875172..18187660 100644--- a/apps/web/messages/zh-CN/teams.json+++ b/apps/web/messages/zh-CN/teams.json@@ -20,6 +20,10 @@"title": "项目","description": "该团队拥有的项目。"},+ "templates": {+ "title": "项目模板",+ "description": "新项目所使用的已保存项目设置。"+ },"members": {"title": "团队成员","description": "团队里的所有成员,以及尚未回应的邀请。"@@ -74,15 +78,16 @@"leaveHint": "你仍保留你参与的项目。若要重新加入,需由所有者再次添加你。","delete": {"action": "删除团队",- "hint": "其成员、角色、邀请、技能、工具和集成会一并删除。成员会保留自己的账户和其他团队。",+ "hint": "其成员、角色、项目模板、邀请、技能、工具和集成会一并删除。成员会保留自己的账户和其他团队。","blocked": "请先删除该团队的项目和 AI 代理。","title": "删除 {name}?",- "description": "<strong>{name}</strong> 及其成员、角色、邀请、技能、工具和集成将被删除。成员会保留自己的账户和其他团队。此操作无法撤销。",+ "description": "<strong>{name}</strong> 及其成员、角色、项目模板、邀请、技能、工具和集成将被删除。成员会保留自己的账户和其他团队。此操作无法撤销。","deleted": "团队已删除"}},"columns": {"project": "项目",+ "template": "模板","owners": "所有者","members": "成员","created": "创建时间",@@ -182,6 +187,22 @@"empty": "角色导出数据为空。"}},+ "templates": {+ "ownerOnly": "只有团队所有者或管理者可以管理项目模板。",+ "empty": "暂无项目模板",+ "emptyHint": "将项目另存为模板,即可基于它创建新项目。",+ "openProjects": "前往项目",+ "deleteAction": "删除模板",+ "deleteDialog": {+ "title": "删除模板“{name}”?",+ "description": "基于该模板创建的项目不受影响。",+ "confirm": "删除模板"+ },+ "panel": {+ "saved": "保存于 {date}",+ "none": "无"+ }+ },"panel": {"created": "创建于 {date}","newProject": "新建项目",diff --git a/apps/web/messages/zh-TW/newProject.json b/apps/web/messages/zh-TW/newProject.jsonindex b54dfab1..43b3592d 100644--- a/apps/web/messages/zh-TW/newProject.json+++ b/apps/web/messages/zh-TW/newProject.json@@ -4,6 +4,11 @@"copyKey": "專案代碼","description": "描述","issueTypes": "工作項目類型",+ "templates": "範本",+ "blank": "空白專案",+ "blankHint": "預設狀態和你選擇的工作項目類型",+ "startFrom": "起點",+ "continue": "繼續","typesCreated": "將建立 {count, plural, other {# 個工作項目類型}}","defaultType": "新工作項目預設使用 {type} 類型,可在設定中編輯。","presets": {@@ -33,6 +38,7 @@"issueTypes": "工作項目類型","labels": "標籤","customFields": "自訂欄位",+ "issueTemplates": "工作項目範本","views": "檢視","dashboards": "儀表板","documents": "文件",diff --git a/apps/web/messages/zh-TW/projects.json b/apps/web/messages/zh-TW/projects.jsonindex c84b0f1d..9944129c 100644--- a/apps/web/messages/zh-TW/projects.json+++ b/apps/web/messages/zh-TW/projects.json@@ -1,6 +1,13 @@{"editAction": "編輯專案","copyAction": "複製專案",+ "saveTemplateAction": "另存為範本",+ "saveTemplate": {+ "title": "將「{name}」另存為範本",+ "hint": "範本會保存所選設定的副本。之後對專案的變更不會影響範本。文件、代理、排程和 Webhook 不會儲存。",+ "save": "儲存範本",+ "saved": "範本「{name}」已儲存"+ },"deleteAction": "刪除專案","leaveAction": "退出專案","archiveAction": "封存專案",diff --git a/apps/web/messages/zh-TW/teams.json b/apps/web/messages/zh-TW/teams.jsonindex 760a24e7..e6445ff1 100644--- a/apps/web/messages/zh-TW/teams.json+++ b/apps/web/messages/zh-TW/teams.json@@ -20,6 +20,10 @@"title": "專案","description": "該團隊擁有的專案。"},+ "templates": {+ "title": "專案範本",+ "description": "新專案所使用的已儲存專案設定。"+ },"members": {"title": "團隊成員","description": "團隊裡的所有成員,以及尚未回應的邀請。"@@ -74,15 +78,16 @@"leaveHint": "你仍保留你參與的專案。若要重新加入,需由所有者再次新增你。","delete": {"action": "刪除團隊",- "hint": "其成員、角色、邀請、技能、工具和整合會一併刪除。成員會保留自己的帳號和其他團隊。",+ "hint": "其成員、角色、專案範本、邀請、技能、工具和整合會一併刪除。成員會保留自己的帳號和其他團隊。","blocked": "請先刪除該團隊的專案和 AI 代理。","title": "刪除 {name}?",- "description": "<strong>{name}</strong> 及其成員、角色、邀請、技能、工具和整合將被刪除。成員會保留自己的帳號和其他團隊。此操作無法復原。",+ "description": "<strong>{name}</strong> 及其成員、角色、專案範本、邀請、技能、工具和整合將被刪除。成員會保留自己的帳號和其他團隊。此操作無法復原。","deleted": "團隊已刪除"}},"columns": {"project": "專案",+ "template": "範本","owners": "所有者","members": "成員","created": "建立時間",@@ -182,6 +187,22 @@"empty": "角色匯出資料為空。"}},+ "templates": {+ "ownerOnly": "只有團隊所有者或管理者可以管理專案範本。",+ "empty": "暫無專案範本",+ "emptyHint": "將專案另存為範本,即可依據它建立新專案。",+ "openProjects": "前往專案",+ "deleteAction": "刪除範本",+ "deleteDialog": {+ "title": "刪除範本「{name}」?",+ "description": "以此範本建立的專案不受影響。",+ "confirm": "刪除範本"+ },+ "panel": {+ "saved": "儲存於 {date}",+ "none": "無"+ }+ },"panel": {"created": "建立於 {date}","newProject": "新建專案",diff --git a/apps/web/src/app/[teamRef]/settings/templates/page.tsx b/apps/web/src/app/[teamRef]/settings/templates/page.tsxnew file mode 100644index 00000000..97b37385--- /dev/null+++ b/apps/web/src/app/[teamRef]/settings/templates/page.tsx@@ -0,0 +1,9 @@+'use client';++import TeamTemplatesSection from '@/features/teams/components/templates/TeamTemplatesSection';+import { useRouteTeam } from '@/features/teams/hooks/useRouteTeam';++export default function Page() {+ const team = useRouteTeam();+ return team && <TeamTemplatesSection teamId={team.id} />;+}diff --git a/apps/web/src/ce/index.ts b/apps/web/src/ce/index.tsindex 1b35a41a..bf7c796c 100644--- a/apps/web/src/ce/index.ts+++ b/apps/web/src/ce/index.ts@@ -14,6 +14,7 @@ export { default as ScheduleDialog } from './ScheduleDialog';export { default as ShellNotice } from './ShellNotice';export { default as SignInExtras } from './SignInExtras';export { default as SignInPage } from './SignInPage';+export { default as useCopySections } from './useCopySections';export { default as useImportSources } from './useImportSources';export { default as useProjectSettingsSections } from './useProjectSettingsSections';export { default as useWorkspaceSections } from './useWorkspaceSections';diff --git a/apps/web/src/ce/useCopySections.ts b/apps/web/src/ce/useCopySections.tsnew file mode 100644index 00000000..0e3d875a--- /dev/null+++ b/apps/web/src/ce/useCopySections.ts@@ -0,0 +1,10 @@+'use client';++import type { CopyGroup } from '@/utils/copyOptions';++// A self-hosted instance copies the core's parts of a project. The hosted build returns+// the core's columns with options of its own, in a group of the core's or its own; the+// api copies them through the sections it adds (setCopySections).+export default function useCopySections(core: CopyGroup[][]): CopyGroup[][] {+ return core;+}diff --git a/apps/web/src/components/common/project-template/ProjectTemplateConfiguration.tsx b/apps/web/src/components/common/project-template/ProjectTemplateConfiguration.tsxnew file mode 100644index 00000000..a6e3c842--- /dev/null+++ b/apps/web/src/components/common/project-template/ProjectTemplateConfiguration.tsx@@ -0,0 +1,51 @@+'use client';++import { useTranslations } from 'next-intl';+import type { EstimateSettings, ProjectFeatures } from '@/lib/api/endpoints/settings';+import { useFeatureLabel } from '@/hooks/useFeatureLabel';+import OnOffStatus from '@/components/common/fields/OnOffStatus';+import ProjectTemplateRow from './ProjectTemplateRow';++// The project sections and the estimates a template turns on, beside the ones it+// leaves off.+export default function ProjectTemplateConfiguration({+ features,+ estimates,+}: {+ features: ProjectFeatures;+ estimates: EstimateSettings;+}) {+ const tGeneral = useTranslations('settings.general');+ const tConfig = useTranslations('settings.configuration');+ const featureLabel = useFeatureLabel();++ const sections = (Object.keys(features) as (keyof ProjectFeatures)[]).map((feature) => ({+ key: feature,+ on: features[feature],+ name: featureLabel(feature),+ }));+ const kinds = [+ { key: 'points', on: estimates.points, name: tConfig('pointsEstimate') },+ { key: 'time', on: estimates.time, name: tConfig('timeEstimate') },+ { key: 'logging', on: estimates.logging, name: tConfig('timeLogging') },+ ];++ return (+ <>+ {[+ { label: tGeneral('features'), items: sections },+ { label: tConfig('estimates'), items: kinds },+ ].map((row) => (+ <ProjectTemplateRow key={row.label} label={row.label}>+ <div className="grid grid-cols-2 gap-x-4 gap-y-1.5">+ {row.items.map((item) => (+ <OnOffStatus key={item.key} on={item.on}>+ {item.name}+ </OnOffStatus>+ ))}+ </div>+ </ProjectTemplateRow>+ ))}+ </>+ );+}diff --git a/apps/web/src/components/common/project-template/ProjectTemplateContents.tsx b/apps/web/src/components/common/project-template/ProjectTemplateContents.tsxnew file mode 100644index 00000000..bcbf973b--- /dev/null+++ b/apps/web/src/components/common/project-template/ProjectTemplateContents.tsx@@ -0,0 +1,94 @@+'use client';++import type { ReactNode } from 'react';+import { useTranslations } from 'next-intl';+import type { ProjectTemplateDetail } from '@/lib/api/endpoints/project-templates';+import { useCopyColumns } from '@/hooks/useCopyColumns';+import ProjectTemplateConfiguration from './ProjectTemplateConfiguration';+import ProjectTemplateItems, { type TemplateItem } from './ProjectTemplateItems';+import ProjectTemplateLabels from './ProjectTemplateLabels';+import ProjectTemplateRow from './ProjectTemplateRow';+import ProjectTemplateStates from './ProjectTemplateStates';++// What a template holds, in the groups and the order "Save as template" offers them,+// the hosted build's parts included.+export default function ProjectTemplateContents({ template }: { template: ProjectTemplateDetail }) {+ const t = useTranslations('teams.templates.panel');+ const tFieldTypes = useTranslations('settings.customFields.fieldTypes');+ const columns = useCopyColumns(true);++ const typeName = (id: number | null) => template.issueTypes.find((type) => type.id === id)?.name;+ const named = (items: { id: number; name: string }[]) =>+ items.map((item) => ({ key: item.id, name: item.name }));++ const lists: Record<string, TemplateItem[]> = {+ issueTypes: template.issueTypes.map((x) => ({ key: x.id, name: x.name, color: x.color })),+ customFields: template.customFields.map((f) => ({+ key: f.id,+ name: f.name,+ hint: [tFieldTypes(f.fieldType), typeName(f.issueTypeId)].filter(Boolean).join(' · '),+ })),+ issueTemplates: named(template.issueTemplates),+ actions: named(template.actions),+ views: named(template.views),+ dashboards: named(template.dashboards),+ ...Object.fromEntries(+ template.sections.map((section) => [+ section.key,+ section.items.map((name, i) => ({ key: i, name })),+ ]),+ ),+ };+ const parts: Record<string, { count: number; body: ReactNode }> = {+ states: {+ count: template.columns.length,+ body: <ProjectTemplateStates columns={template.columns} />,+ },+ labels: {+ count: template.labels.length,+ body: <ProjectTemplateLabels labels={template.labels} groups={template.labelGroups} />,+ },+ ...Object.fromEntries(+ Object.entries(lists).map(([key, items]) => [+ key,+ {+ count: items.length,+ body: <ProjectTemplateItems items={items} list={key === 'customFields'} />,+ },+ ]),+ ),+ };++ return (+ <div className="space-y-6">+ {columns.flat().map((group) => (+ <section key={group.key}>+ <h3 className="pb-1 text-xs font-medium tracking-wide text-muted-foreground uppercase">+ {group.title}+ </h3>+ {group.options.map((option) => {+ if (option.key === 'configuration') {+ return (+ <ProjectTemplateConfiguration+ key={option.key}+ features={template.features}+ estimates={template.estimates}+ />+ );+ }+ const part = parts[option.key];+ return (+ <ProjectTemplateRow key={option.key} label={option.label} count={part?.count ?? 0}>+ {part?.count ? (+ part.body+ ) : (+ <p className="text-sm text-muted-foreground">{t('none')}</p>+ )}+ </ProjectTemplateRow>+ );+ })}+ </section>+ ))}+ </div>+ );+}diff --git a/apps/web/src/components/common/project-template/ProjectTemplateDetails.tsx b/apps/web/src/components/common/project-template/ProjectTemplateDetails.tsxnew file mode 100644index 00000000..1e6253b9--- /dev/null+++ b/apps/web/src/components/common/project-template/ProjectTemplateDetails.tsx@@ -0,0 +1,41 @@+'use client';++import { useTranslations } from 'next-intl';+import type { ProjectTemplate } from '@/lib/api/endpoints/project-templates';+import { formatDate } from '@/utils/dates';+import { useProjectTemplateQuery } from '@/services/projectTemplates.service';+import ListSkeleton from '@/components/common/skeleton/ListSkeleton';+import ProjectTemplateContents from './ProjectTemplateContents';++// What a template is, then what a project created from it starts with.+export default function ProjectTemplateDetails({+ teamId,+ template,+}: {+ teamId: number;+ template: ProjectTemplate;+}) {+ const t = useTranslations('teams.templates.panel');+ const { data: detail } = useProjectTemplateQuery(teamId, template.id);++ return (+ <div className="space-y-8">+ <section className="space-y-2">+ {template.description && (+ <p className="text-sm whitespace-pre-line text-foreground" dir="auto">+ {template.description}+ </p>+ )}+ <p className="text-xs text-muted-foreground">+ {t('saved', { date: formatDate(template.createdAt) })}+ </p>+ </section>++ {detail ? (+ <ProjectTemplateContents template={detail} />+ ) : (+ <ListSkeleton rows={5} rowClassName="h-10" />+ )}+ </div>+ );+}diff --git a/apps/web/src/components/common/project-template/ProjectTemplateItems.tsx b/apps/web/src/components/common/project-template/ProjectTemplateItems.tsxnew file mode 100644index 00000000..d7126a2e--- /dev/null+++ b/apps/web/src/components/common/project-template/ProjectTemplateItems.tsx@@ -0,0 +1,50 @@+'use client';++import { Fragment } from 'react';+import { colorDot } from '@/components/common/fields/colorDot';++export interface TemplateItem {+ key: string | number;+ name: string;+ color?: string;+ hint?: string;+}++// What one part of a template holds: in a row, or with `list` one per line beside its+// hint.+export default function ProjectTemplateItems({+ items,+ list = false,+}: {+ items: TemplateItem[];+ list?: boolean;+}) {+ if (list) {+ return (+ <div className="grid grid-cols-[minmax(0,max-content)_minmax(0,1fr)] gap-x-4 gap-y-1 text-sm">+ {items.map((item) => (+ <Fragment key={item.key}>+ <span className="truncate" dir="auto">+ {item.name}+ </span>+ <span className="truncate text-muted-foreground">{item.hint}</span>+ </Fragment>+ ))}+ </div>+ );+ }++ return (+ <div className="flex flex-wrap gap-x-4 gap-y-1.5 text-sm">+ {items.map((item) => (+ <span key={item.key} className="flex min-w-0 items-center gap-1.5">+ {item.color && colorDot(item.color)}+ <span className="truncate" dir="auto">+ {item.name}+ </span>+ {item.hint && <span className="shrink-0 text-muted-foreground">{item.hint}</span>}+ </span>+ ))}+ </div>+ );+}diff --git a/apps/web/src/components/common/project-template/ProjectTemplateLabels.tsx b/apps/web/src/components/common/project-template/ProjectTemplateLabels.tsxnew file mode 100644index 00000000..e735fa22--- /dev/null+++ b/apps/web/src/components/common/project-template/ProjectTemplateLabels.tsx@@ -0,0 +1,45 @@+'use client';++import { useTranslations } from 'next-intl';+import type { Label, LabelGroup } from '@/lib/api/endpoints/labels';+import ProjectTemplateItems from './ProjectTemplateItems';++// The labels of a template under their groups, the ungrouped ones last.+export default function ProjectTemplateLabels({+ labels,+ groups,+}: {+ labels: Label[];+ groups: LabelGroup[];+}) {+ const t = useTranslations('settings.labels');+ const items = (list: Label[]) => list.map((l) => ({ key: l.id, name: l.name, color: l.color }));++ if (groups.length === 0) return <ProjectTemplateItems items={items(labels)} />;++ const sets = [+ ...groups.map((group) => ({+ key: group.id,+ name: group.name,+ labels: labels.filter((l) => l.groupId === group.id),+ })),+ {+ key: 'ungrouped',+ name: t('ungrouped'),+ labels: labels.filter((l) => !groups.some((group) => group.id === l.groupId)),+ },+ ].filter((set) => set.labels.length > 0);++ return (+ <div className="space-y-1.5">+ {sets.map((set) => (+ <div key={set.key} className="grid grid-cols-[96px_minmax(0,1fr)] gap-3">+ <span className="truncate text-xs leading-5 text-muted-foreground" dir="auto">+ {set.name}+ </span>+ <ProjectTemplateItems items={items(set.labels)} />+ </div>+ ))}+ </div>+ );+}diff --git a/apps/web/src/components/common/project-template/ProjectTemplateRow.tsx b/apps/web/src/components/common/project-template/ProjectTemplateRow.tsxnew file mode 100644index 00000000..99dcce8a--- /dev/null+++ b/apps/web/src/components/common/project-template/ProjectTemplateRow.tsx@@ -0,0 +1,22 @@+import type { ReactNode } from 'react';++// One part of a template: its name and count beside what it holds.+export default function ProjectTemplateRow({+ label,+ count,+ children,+}: {+ label: string;+ count?: number;+ children: ReactNode;+}) {+ return (+ <div className="grid gap-1 py-2.5 sm:grid-cols-[136px_minmax(0,1fr)] sm:gap-4">+ <p className="text-sm text-muted-foreground">+ {label}+ {count !== undefined && <span className="ms-1.5 text-xs tabular-nums">{count}</span>}+ </p>+ <div className="min-w-0">{children}</div>+ </div>+ );+}diff --git a/apps/web/src/components/common/project-template/ProjectTemplateStates.tsx b/apps/web/src/components/common/project-template/ProjectTemplateStates.tsxnew file mode 100644index 00000000..1523e1f8--- /dev/null+++ b/apps/web/src/components/common/project-template/ProjectTemplateStates.tsx@@ -0,0 +1,38 @@+import { Fragment } from 'react';+import { ChevronRight } from 'lucide-react';+import type { Column } from '@/lib/api/endpoints/columns';+import { colorDot } from '@/components/common/fields/colorDot';++// The states of a template in board order, the canceled ones set apart after the flow.+export default function ProjectTemplateStates({ columns }: { columns: Column[] }) {+ const flow = columns.filter((column) => column.stateType !== 'canceled');+ const canceled = columns.filter((column) => column.stateType === 'canceled');++ const state = (column: Column) => (+ <span className="flex min-w-0 items-center gap-1.5">+ {colorDot(column.color)}+ <span className="truncate" dir="auto">+ {column.name}+ </span>+ </span>+ );++ return (+ <div className="flex flex-wrap items-center gap-x-2 gap-y-1.5 text-sm">+ {flow.map((column, i) => (+ <Fragment key={column.id}>+ {i > 0 && (+ <ChevronRight className="size-3.5 shrink-0 text-muted-foreground rtl:rotate-180" />+ )}+ {state(column)}+ </Fragment>+ ))}+ {flow.length > 0 && canceled.length > 0 && (+ <span className="px-1 text-muted-foreground">·</span>+ )}+ {canceled.map((column) => (+ <Fragment key={column.id}>{state(column)}</Fragment>+ ))}+ </div>+ );+}diff --git a/apps/web/src/components/layout/CopyProjectForm.tsx b/apps/web/src/components/layout/CopyProjectForm.tsxindex 60da8239..e7e875d5 100644--- a/apps/web/src/components/layout/CopyProjectForm.tsx+++ b/apps/web/src/components/layout/CopyProjectForm.tsx@@ -3,7 +3,8 @@ import { KEY_MAX_LENGTH } from '@/utils/projectKey';import { Input } from '@/components/ui/input';import { Label } from '@/components/ui/label';import { Textarea } from '@/components/ui/textarea';-import CopyProjectOptions, { type CopyInclude } from '@/components/layout/CopyProjectOptions';+import type { CopyGroup, CopyInclude } from '@/utils/copyOptions';+import CopyProjectOptions from '@/components/layout/CopyProjectOptions';// The copy-a-project form. The fields are few and the sections to carry over are// many, so everything stacks full width instead of leaving one short column next@@ -12,6 +13,7 @@ export default function CopyProjectForm({name,projectKey,description,+ columns,include,onNameChange,onKeyChange,@@ -21,6 +23,7 @@ export default function CopyProjectForm({name: string;projectKey: string;description: string;+ columns: CopyGroup[][];include: CopyInclude;onNameChange: (value: string) => void;onKeyChange: (value: string) => void;@@ -54,7 +57,7 @@ export default function CopyProjectForm({onChange={(e) => onDescriptionChange(e.target.value)}/></div>- <CopyProjectOptions value={include} onChange={onIncludeChange} />+ <CopyProjectOptions columns={columns} value={include} onChange={onIncludeChange} /></div>);}diff --git a/apps/web/src/components/layout/CopyProjectOptions.tsx b/apps/web/src/components/layout/CopyProjectOptions.tsxindex 336ec681..cae15dd3 100644--- a/apps/web/src/components/layout/CopyProjectOptions.tsx+++ b/apps/web/src/components/layout/CopyProjectOptions.tsx@@ -1,97 +1,35 @@import { useTranslations } from 'next-intl';-import type { CopyProjectIncludeKey } from '@/lib/api/endpoints/teams';+import {+ copyOptionsOf,+ isIncluded,+ toggleInclude,+ type CopyGroup,+ type CopyInclude,+} from '@/utils/copyOptions';import { Checkbox } from '@/components/ui/checkbox';-export type CopyInclude = Record<CopyProjectIncludeKey, boolean>;--// What each entity needs copied alongside it. Mirrors the API's normalizeInclude: a-// view/action remaps state/type/label/field ids, and a schedule belongs to an agent and-// a status schedule to a state.-// Checking a child enables its requirements; unchecking a requirement disables the-// children that need it.-const REQUIRES: Record<CopyProjectIncludeKey, CopyProjectIncludeKey[]> = {- states: [],- issueTypes: [],- labels: [],- customFields: ['issueTypes'],- views: ['states', 'issueTypes', 'labels', 'customFields'],- dashboards: [],- documents: [],- actions: ['states', 'issueTypes', 'labels'],- configuration: [],- webhooks: [],- agents: [],- schedules: ['agents', 'states'],-};--// The name of a group, and of each entity, are messages under `newProject`.-type Group = {- title: 'workflow' | 'automation' | 'aiTeam' | 'views' | 'knowledge';- keys: CopyProjectIncludeKey[];+const GRID_COLUMNS: Record<number, string> = {+ 1: 'sm:grid-cols-1',+ 2: 'sm:grid-cols-2',+ 3: 'sm:grid-cols-3',+ 4: 'sm:grid-cols-4',};-// Groups assigned to the four rendered columns by hand, keeping each column close-// to the same number of rows.-const COLUMNS: Group[][] = [- [- {- title: 'workflow',- keys: ['states', 'issueTypes', 'labels', 'customFields', 'configuration'],- },- ],- [{ title: 'automation', keys: ['actions', 'schedules', 'webhooks'] }],- [{ title: 'aiTeam', keys: ['agents'] }],- [- { title: 'views', keys: ['views', 'dashboards'] },- { title: 'knowledge', keys: ['documents'] },- ],-];--const ALL_KEYS = COLUMNS.flat().flatMap((g) => g.keys);--const selectAll = (on: boolean): CopyInclude =>- Object.fromEntries(ALL_KEYS.map((k) => [k, on])) as CopyInclude;--export const allSelected = (): CopyInclude => selectAll(true);--function applyToggle(sel: CopyInclude, key: CopyProjectIncludeKey, checked: boolean): CopyInclude {- const next = { ...sel, [key]: checked };- if (checked) {- // Enable everything this key requires, transitively.- const stack = [...REQUIRES[key]];- while (stack.length) {- const dep = stack.pop()!;- if (!next[dep]) next[dep] = true;- stack.push(...REQUIRES[dep]);- }- } else {- // Disable anything that requires this key, transitively.- let changed = true;- while (changed) {- changed = false;- for (const k of ALL_KEYS) {- if (next[k] && REQUIRES[k].some((dep) => !next[dep])) {- next[k] = false;- changed = true;- }- }- }- }- return next;-}-// Grid of copy options, grouped by settings section. Selecting a dependent option// pulls in the entities it references; clearing a required one clears its dependents.export default function CopyProjectOptions({+ columns,value,onChange,}: {+ columns: CopyGroup[][];value: CopyInclude;onChange: (next: CopyInclude) => void;}) {const t = useTranslations('newProject');- const total = ALL_KEYS.length;- const selectedCount = ALL_KEYS.filter((k) => value[k]).length;+ const options = copyOptionsOf(columns);+ const total = options.length;+ const selectedCount = options.filter((option) => isIncluded(value, option.key)).length;const allOn = selectedCount === total;return (@@ -106,27 +44,31 @@ export default function CopyProjectOptions({<buttontype="button"className="text-xs text-muted-foreground hover:text-foreground"- onClick={() => onChange(selectAll(!allOn))}+ onClick={() =>+ onChange(Object.fromEntries(options.map((option) => [option.key, !allOn])))+ }>{t(allOn ? 'clearAll' : 'selectAll')}</button></div>- <div className="grid grid-cols-2 gap-x-4 sm:grid-cols-4">- {COLUMNS.map((column, i) => (+ <div className={`grid grid-cols-2 gap-x-4 ${GRID_COLUMNS[Math.min(columns.length, 4)]}`}>+ {columns.map((column, i) => (<div key={i} className="space-y-3">{column.map((group) => (- <div key={group.title} className="space-y-1">- <p className="text-xs text-muted-foreground">{t(`copyGroups.${group.title}`)}</p>- {group.keys.map((key) => (+ <div key={group.key} className="space-y-1">+ <p className="text-xs text-muted-foreground">{group.title}</p>+ {group.options.map((option) => (<label- key={key}+ key={option.key}className="flex cursor-pointer items-center gap-2 text-sm text-foreground"><Checkbox- checked={value[key]}- onCheckedChange={(c) => onChange(applyToggle(value, key, c === true))}+ checked={isIncluded(value, option.key)}+ onCheckedChange={(c) =>+ onChange(toggleInclude(columns, value, option.key, c === true))+ }/>- {t(`copyItems.${key}`)}+ {option.label}</label>))}</div>diff --git a/apps/web/src/components/layout/NewProjectDetails.tsx b/apps/web/src/components/layout/NewProjectDetails.tsxnew file mode 100644index 00000000..c8e2631d--- /dev/null+++ b/apps/web/src/components/layout/NewProjectDetails.tsx@@ -0,0 +1,35 @@+import type { ReactNode } from 'react';+import { useTranslations } from 'next-intl';+import { Button } from '@/components/ui/button';++// The second step: what the project starts from, with a way back to change it, above the+// project fields.+export default function NewProjectDetails({+ start,+ onChange,+ children,+}: {+ start: string;+ onChange: () => void;+ children: ReactNode;+}) {+ const t = useTranslations('newProject');+ const tCommon = useTranslations('common');++ return (+ <div className="space-y-5">+ <div className="flex items-center gap-3 rounded-lg bg-muted/60 px-3 py-2.5">+ <div className="min-w-0 flex-1">+ <p className="text-xs text-muted-foreground">{t('startFrom')}</p>+ <p className="truncate text-sm font-medium" dir="auto">+ {start}+ </p>+ </div>+ <Button variant="ghost" size="sm" onClick={onChange}>+ {tCommon('change')}+ </Button>+ </div>+ {children}+ </div>+ );+}diff --git a/apps/web/src/components/layout/NewProjectFields.tsx b/apps/web/src/components/layout/NewProjectFields.tsxnew file mode 100644index 00000000..e551b25f--- /dev/null+++ b/apps/web/src/components/layout/NewProjectFields.tsx@@ -0,0 +1,49 @@+import { useTranslations } from 'next-intl';+import { KEY_MAX_LENGTH } from '@/utils/projectKey';+import { Input } from '@/components/ui/input';+import { Label } from '@/components/ui/label';+import { Textarea } from '@/components/ui/textarea';++export default function NewProjectFields({+ name,+ projectKey,+ description,+ onNameChange,+ onKeyChange,+ onDescriptionChange,+}: {+ name: string;+ projectKey: string;+ description: string;+ onNameChange: (value: string) => void;+ onKeyChange: (value: string) => void;+ onDescriptionChange: (value: string) => void;+}) {+ const t = useTranslations('newProject');++ return (+ <div className="flex flex-col gap-3">+ <div className="space-y-1.5">+ <Label>{t('name')}</Label>+ <Input autoFocus value={name} onChange={(e) => onNameChange(e.target.value)} />+ </div>+ <div className="space-y-1.5">+ <Label>{t('key')}</Label>+ <Input+ value={projectKey}+ onChange={(e) => onKeyChange(e.target.value)}+ maxLength={KEY_MAX_LENGTH}+ />+ </div>+ <div className="flex flex-1 flex-col space-y-1.5">+ <Label>{t('description')}</Label>+ <Textarea+ rows={2}+ className="min-h-20 flex-1 resize-none"+ value={description}+ onChange={(e) => onDescriptionChange(e.target.value)}+ />+ </div>+ </div>+ );+}diff --git a/apps/web/src/components/layout/NewProjectForm.tsx b/apps/web/src/components/layout/NewProjectForm.tsxdeleted file mode 100644index 69cfc6c6..00000000--- a/apps/web/src/components/layout/NewProjectForm.tsx+++ /dev/null@@ -1,62 +0,0 @@-import { useTranslations } from 'next-intl';-import { KEY_MAX_LENGTH } from '@/utils/projectKey';-import type { PresetKey } from '@/utils/projectPresets';-import { Input } from '@/components/ui/input';-import { Label } from '@/components/ui/label';-import { Textarea } from '@/components/ui/textarea';-import NewProjectPreset from '@/components/layout/NewProjectPreset';--// The create-from-scratch form: the project fields on the left, the issue-type-// preset picker on the right, where the two halves are of comparable size.-export default function NewProjectForm({- name,- projectKey,- description,- preset,- onNameChange,- onKeyChange,- onDescriptionChange,- onPresetChange,-}: {- name: string;- projectKey: string;- description: string;- preset: PresetKey;- onNameChange: (value: string) => void;- onKeyChange: (value: string) => void;- onDescriptionChange: (value: string) => void;- onPresetChange: (value: PresetKey) => void;-}) {- const t = useTranslations('newProject');-- return (- <div className="grid gap-6 sm:grid-cols-[1.15fr_1fr]">- {/* The description field takes the leftover height so both columns end on- the same line. */}- <div className="flex flex-col gap-3">- <div className="space-y-1.5">- <Label>{t('name')}</Label>- <Input autoFocus value={name} onChange={(e) => onNameChange(e.target.value)} />- </div>- <div className="space-y-1.5">- <Label>{t('key')}</Label>- <Input- value={projectKey}- onChange={(e) => onKeyChange(e.target.value)}- maxLength={KEY_MAX_LENGTH}- />- </div>- <div className="flex flex-1 flex-col space-y-1.5">- <Label>{t('description')}</Label>- <Textarea- rows={2}- className="min-h-20 flex-1 resize-none"- value={description}- onChange={(e) => onDescriptionChange(e.target.value)}- />- </div>- </div>- <NewProjectPreset value={preset} onChange={onPresetChange} />- </div>- );-}diff --git a/apps/web/src/components/layout/NewProjectModal.tsx b/apps/web/src/components/layout/NewProjectModal.tsxindex 444c15fb..ac176f51 100644--- a/apps/web/src/components/layout/NewProjectModal.tsx+++ b/apps/web/src/components/layout/NewProjectModal.tsx@@ -1,33 +1,44 @@-import { useState } from 'react';-import { Users } from 'lucide-react';+import { useState, type ReactNode } from 'react';+import { ArrowLeft, Users } from 'lucide-react';import { useTranslations } from 'next-intl';import { useCreateProject } from '@/services/projects.service';import { useTeamsQuery, useTeamProjectDefaultsQuery } from '@/services/teams.service';import { useAiAgentsQuery } from '@/services/aiAgents.service';+import { useProjectTemplatesQuery } from '@/services/projectTemplates.service';+import { useCopyColumns } from '@/hooks/useCopyColumns';+import { includeOf, type CopyInclude } from '@/utils/copyOptions';import { normalizeKey, suggestKey } from '@/utils/projectKey';import type { PresetKey } from '@/utils/projectPresets';import Modal from '@/components/common/overlay/Modal';+import ListSkeleton from '@/components/common/skeleton/ListSkeleton';import { Button } from '@/components/ui/button';import CopyProjectForm from '@/components/layout/CopyProjectForm';-import NewProjectForm from '@/components/layout/NewProjectForm';-import { allSelected, type CopyInclude } from '@/components/layout/CopyProjectOptions';+import NewProjectDetails from '@/components/layout/NewProjectDetails';+import NewProjectFields from '@/components/layout/NewProjectFields';+import NewProjectPreset from '@/components/layout/NewProjectPreset';+import NewProjectStart from '@/components/layout/NewProjectStart';-// Creates a project, or — when `copyFrom` is set — copies that project's structure-// (states, issue types, labels, custom fields) into a new project without its-// issues. `teamId` is the team the project belongs to; a copy is always made within-// the source project's team.+// Creates a project, from scratch or from one of the team's templates, or — when+// `copyFrom` is set — copies that project's structure (states, issue types, labels,+// custom fields) into a new project without its issues. `teamId` is the team the project+// belongs to; a copy is always made within the source project's team. While the team has+// templates, creating takes two steps: what the project starts from, then its fields;+// `initialTemplateId` opens the second step with that template picked.export default function NewProjectModal({onClose,onCreated,teamId,copyFrom,+ initialTemplateId,}: {onClose: () => void;onCreated: (projectKey: string) => void;teamId: number;copyFrom?: { id: number; name: string; description: string };+ initialTemplateId?: number;}) {const t = useTranslations('newProject');+ const tCommon = useTranslations('common');const initialName = copyFrom ? t('copyName', { name: copyFrom.name }) : '';const [key, setKey] = useState(() => suggestKey(initialName));const [name, setName] = useState(initialName);@@ -37,10 +48,23 @@ export default function NewProjectModal({const [keyEdited, setKeyEdited] = useState(false);// Which parts of the source project to copy. Defaults to everything; the user// clears what they don't want.- const [include, setInclude] = useState<CopyInclude>(allSelected);+ const copyColumns = useCopyColumns();+ const [include, setInclude] = useState<CopyInclude>({});// Which issue types the new project starts with. A copy takes its types from the- // source project, so the preset applies only when creating from scratch.+ // source project, and a project from a template from the template, so the preset+ // applies only when creating from scratch.const [preset, setPreset] = useState<PresetKey>('general');+ const [templateId, setTemplateId] = useState<number | null>(initialTemplateId ?? null);+ const [step, setStep] = useState<'start' | 'details'>(+ initialTemplateId != null ? 'details' : 'start',+ );+ const templatesQuery = useProjectTemplatesQuery(copyFrom ? null : teamId);+ // The list is for the team's owners and managers; anyone it is refused to starts+ // from scratch.+ const templates = templatesQuery.isError ? [] : templatesQuery.data;+ const template = templates?.find((one) => one.id === templateId);+ const twoSteps = !copyFrom && templates !== undefined && templates.length > 0;+ const choosing = twoSteps && step === 'start';const createProject = useCreateProject();// Names the team in the header, so the dialog says where the project lands.const teams = useTeamsQuery().data;@@ -67,7 +91,11 @@ export default function NewProjectModal({key: key.trim().toUpperCase(),name: name.trim(),description: description.trim(),- ...(copyFrom ? { include } : { preset }),+ ...(copyFrom+ ? { include: includeOf(copyColumns, include) }+ : template+ ? { templateId: template.id }+ : { preset }),};createProject.mutate({ teamId, copyFromId: copyFrom?.id, input },@@ -75,6 +103,63 @@ export default function NewProjectModal({);}+ const fields = (+ <NewProjectFields+ name={name}+ projectKey={key}+ description={description}+ onNameChange={onNameChange}+ onKeyChange={onKeyChange}+ onDescriptionChange={setDescription}+ />+ );+ const presetPicker = <NewProjectPreset value={preset} onChange={setPreset} />;++ let body: ReactNode;+ if (copyFrom) {+ body = (+ <CopyProjectForm+ name={name}+ projectKey={key}+ description={description}+ columns={copyColumns}+ include={include}+ onNameChange={onNameChange}+ onKeyChange={onKeyChange}+ onDescriptionChange={setDescription}+ onIncludeChange={setInclude}+ />+ );+ } else if (!templates) {+ body = <ListSkeleton rows={4} rowClassName="h-10" />;+ } else if (!twoSteps) {+ body = (+ <div className="grid gap-6 sm:grid-cols-[1.15fr_1fr]">+ {fields}+ {presetPicker}+ </div>+ );+ } else if (choosing) {+ body = (+ <NewProjectStart+ teamId={teamId}+ templates={templates}+ templateId={templateId}+ onTemplateChange={setTemplateId}+ blank={presetPicker}+ />+ );+ } else {+ body = (+ <NewProjectDetails+ start={template?.name ?? `${t('blank')} · ${t(`presets.${preset}`)}`}+ onChange={() => setStep('start')}+ >+ {fields}+ </NewProjectDetails>+ );+ }+return (<Modaltitle={copyFrom ? t('copyTitle', { name: copyFrom.name }) : t('title')}@@ -94,42 +179,30 @@ export default function NewProjectModal({{/* On a short viewport the form scrolls on its own so the submit buttonstays in place instead of sitting below the fold. */}<div className="max-h-[55vh] overflow-y-auto pr-1">- {copyFrom ? (- <CopyProjectForm- name={name}- projectKey={key}- description={description}- include={include}- onNameChange={onNameChange}- onKeyChange={onKeyChange}- onDescriptionChange={setDescription}- onIncludeChange={setInclude}- />- ) : (- <NewProjectForm- name={name}- projectKey={key}- description={description}- preset={preset}- onNameChange={onNameChange}- onKeyChange={onKeyChange}- onDescriptionChange={setDescription}- onPresetChange={setPreset}- />- )}- {!copyFrom && defaultAgentNames.length > 0 && (+ {body}+ {!copyFrom && !choosing && defaultAgentNames.length > 0 && (<p className="mt-4 text-sm text-muted-foreground">{t('defaultAgents', { names: defaultAgentNames.join(', ') })}</p>)}</div>- <div className="mt-4 flex justify-end border-t pt-3">- <Button- disabled={createProject.isPending || !key.trim() || !name.trim()}- onClick={submit}- >- {t(copyFrom ? 'copyAction' : 'create')}- </Button>+ <div className="mt-4 flex items-center justify-end gap-2 border-t pt-3">+ {twoSteps && !choosing && (+ <Button variant="ghost" className="me-auto" onClick={() => setStep('start')}>+ <ArrowLeft className="rtl:rotate-180" />+ {tCommon('back')}+ </Button>+ )}+ {choosing ? (+ <Button onClick={() => setStep('details')}>{t('continue')}</Button>+ ) : (+ <Button+ disabled={createProject.isPending || !key.trim() || !name.trim()}+ onClick={submit}+ >+ {t(copyFrom ? 'copyAction' : 'create')}+ </Button>+ )}</div></div></Modal>diff --git a/apps/web/src/components/layout/NewProjectOption.tsx b/apps/web/src/components/layout/NewProjectOption.tsxnew file mode 100644index 00000000..d510a396--- /dev/null+++ b/apps/web/src/components/layout/NewProjectOption.tsx@@ -0,0 +1,29 @@+import type { ReactNode } from 'react';++// One choice of what a new project starts with: a blank project, a template, or an+// issue-type preset.+export default function NewProjectOption({+ selected,+ onSelect,+ children,+}: {+ selected: boolean;+ onSelect: () => void;+ children: ReactNode;+}) {+ return (+ <button+ type="button"+ role="radio"+ aria-checked={selected}+ onClick={onSelect}+ className={`truncate rounded-md px-2 py-1.5 text-start text-sm transition-colors duration-150 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none ${+ selected+ ? 'bg-secondary font-medium text-secondary-foreground'+ : 'text-muted-foreground hover:bg-accent hover:text-accent-foreground'+ }`}+ >+ {children}+ </button>+ );+}diff --git a/apps/web/src/components/layout/NewProjectPreset.tsx b/apps/web/src/components/layout/NewProjectPreset.tsxindex 78353afd..3712d9e9 100644--- a/apps/web/src/components/layout/NewProjectPreset.tsx+++ b/apps/web/src/components/layout/NewProjectPreset.tsx@@ -1,9 +1,10 @@import { useTranslations } from 'next-intl';import { PRESETS, type PresetKey } from '@/utils/projectPresets';+import NewProjectOption from '@/components/layout/NewProjectOption';-// Picks the set of issue types a new project starts with and previews the result.-// The preview updates as the selection changes, so the outcome is visible before-// the project exists.+// Picks the set of issue types a blank project starts with and previews the result. The+// preview updates as the selection changes, so the outcome is visible before the project+// exists.export default function NewProjectPreset({value,onChange,@@ -24,25 +25,16 @@ export default function NewProjectPreset({className="grid grid-cols-2 gap-x-2 gap-y-0.5">{PRESETS.map((preset) => (- <button+ <NewProjectOptionkey={preset.key}- type="button"- role="radio"- aria-checked={preset.key === value}- onClick={() => onChange(preset.key)}- className={`rounded-md px-2 py-1.5 text-left text-sm transition-colors duration-150 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none ${- preset.key === value- ? 'bg-secondary font-medium text-secondary-foreground'- : 'text-muted-foreground hover:bg-accent hover:text-accent-foreground'- }`}+ selected={preset.key === value}+ onSelect={() => onChange(preset.key)}>{t(`presets.${preset.key}`)}- </button>+ </NewProjectOption>))}</div>- {/* The type list wraps to two rows at most and the line below is one row, so- the block keeps its height when the selection changes. */}<div className="space-y-2 rounded-lg bg-muted/60 p-3"><p className="text-xs text-muted-foreground">{t('typesCreated', { count: selected.types.length })}diff --git a/apps/web/src/components/layout/NewProjectStart.tsx b/apps/web/src/components/layout/NewProjectStart.tsxnew file mode 100644index 00000000..c471443b--- /dev/null+++ b/apps/web/src/components/layout/NewProjectStart.tsx@@ -0,0 +1,80 @@+import type { ReactNode } from 'react';+import { useTranslations } from 'next-intl';+import type { ProjectTemplate } from '@/lib/api/endpoints/project-templates';+import { formatDate } from '@/utils/dates';+import ProjectTemplateDetails from '@/components/common/project-template/ProjectTemplateDetails';+import NewProjectOption from '@/components/layout/NewProjectOption';++// The first step while the team has templates: a blank project or one of the templates,+// and beside the list what the choice starts the project with. A blank project shows+// `blank`, the issue-type picker.+export default function NewProjectStart({+ teamId,+ templates,+ templateId,+ onTemplateChange,+ blank,+}: {+ teamId: number;+ templates: ProjectTemplate[];+ templateId: number | null;+ onTemplateChange: (next: number | null) => void;+ blank: ReactNode;+}) {+ const t = useTranslations('newProject');+ const tTemplates = useTranslations('teams.templates.panel');+ const template = templates.find((one) => one.id === templateId);++ return (+ <div className="grid gap-5 sm:h-[55vh] sm:grid-cols-[232px_minmax(0,1fr)]">+ <div+ role="radiogroup"+ aria-label={t('startFrom')}+ className="flex flex-col gap-0.5 sm:overflow-y-auto"+ >+ <NewProjectOption selected={!template} onSelect={() => onTemplateChange(null)}>+ <span className="block truncate">{t('blank')}</span>+ <span className="block truncate text-xs font-normal text-muted-foreground">+ {t('blankHint')}+ </span>+ </NewProjectOption>+ <span className="px-2 pt-3 pb-1 text-xs font-medium tracking-wide text-muted-foreground uppercase">+ {t('templates')}+ </span>+ {templates.map((one) => (+ <NewProjectOption+ key={one.id}+ selected={one.id === templateId}+ onSelect={() => onTemplateChange(one.id)}+ >+ <span className="block truncate" dir="auto">+ {one.name}+ </span>+ <span className="block truncate text-xs font-normal text-muted-foreground">+ {tTemplates('saved', { date: formatDate(one.createdAt) })}+ </span>+ </NewProjectOption>+ ))}+ </div>++ <div className="min-w-0 space-y-4 sm:overflow-y-auto sm:border-s sm:ps-5">+ {template ? (+ <>+ <h3 className="text-base font-semibold" dir="auto">+ {template.name}+ </h3>+ <ProjectTemplateDetails teamId={teamId} template={template} />+ </>+ ) : (+ <>+ <div className="space-y-1">+ <h3 className="text-base font-semibold">{t('blank')}</h3>+ <p className="text-sm text-muted-foreground">{t('blankHint')}</p>+ </div>+ {blank}+ </>+ )}+ </div>+ </div>+ );+}diff --git a/apps/web/src/components/layout/ProjectSwitcher.test.tsx b/apps/web/src/components/layout/ProjectSwitcher.test.tsxindex 2bc2c3dd..f465b7bd 100644--- a/apps/web/src/components/layout/ProjectSwitcher.test.tsx+++ b/apps/web/src/components/layout/ProjectSwitcher.test.tsx@@ -79,6 +79,7 @@ function team(id: number, workspaceId: number): Team {source: 'invite',joinedAt: '2026-01-01T00:00:00Z',projectCount: 0,+ templateCount: 0,memberCount: 1,ownerCount: 1,roleCount: 0,diff --git a/apps/web/src/features/teams/components/TeamSectionNav.tsx b/apps/web/src/features/teams/components/TeamSectionNav.tsxindex 918d6f79..1f069128 100644--- a/apps/web/src/features/teams/components/TeamSectionNav.tsx+++ b/apps/web/src/features/teams/components/TeamSectionNav.tsx@@ -12,6 +12,7 @@ import {FolderKanban,GitBranch,Info,+ LayoutTemplate,PanelLeftClose,PanelLeftOpen,Plug,@@ -40,9 +41,9 @@ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/componentimport { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';// The sections of the open team, as the page's last rail: the team itself, its-// projects, the roles they assign from and its members, then the AI group — the-// integration credentials the agents run on, the agents themselves, the skills they-// load, the tools they can call and what they spent — with what MCP clients reach and+// projects and the templates they are created from, the roles they assign from and its+// members, then the AI group — the integration credentials the agents run on, the+// agents themselves, the skills they load, the tools they can call and what they spent — with what MCP clients reach and// the notification providers last. The counts come with the team list, so each is shown// before its section is opened. A section the caller may not read is left out, and the// AI group with it once none of them is readable. Collapsed, the rail shows the icons of@@ -83,8 +84,14 @@ export default function TeamSectionNav({const top = [section('info', t('info.title'), Info),section('projects', t('projects.title'), FolderKanban, team.projectCount),- // The roles are managed by the team's owner and managers, so the section is theirs.- ...(runsTeam ? [section('roles', t('roles.title'), ShieldCheck, team.roleCount)] : []),+ // The project templates and the roles are managed by the team's owner and managers,+ // so the sections are theirs.+ ...(runsTeam+ ? [+ section('templates', t('templates.title'), LayoutTemplate, team.templateCount),+ section('roles', t('roles.title'), ShieldCheck, team.roleCount),+ ]+ : []),section('members', t('members.title'), Users, team.memberCount),];const ai = [diff --git a/apps/web/src/features/teams/components/projects/TeamProjectActions.tsx b/apps/web/src/features/teams/components/projects/TeamProjectActions.tsxindex 7614b4ef..6bc2de4e 100644--- a/apps/web/src/features/teams/components/projects/TeamProjectActions.tsx+++ b/apps/web/src/features/teams/components/projects/TeamProjectActions.tsx@@ -2,7 +2,15 @@import { useState } from 'react';import { useRouter } from 'next/navigation';-import { Archive, ArchiveRestore, Copy, LogOut, Pencil, Trash2 } from 'lucide-react';+import {+ Archive,+ ArchiveRestore,+ Copy,+ LayoutTemplate,+ LogOut,+ Pencil,+ Trash2,+} from 'lucide-react';import { useTranslations } from 'next-intl';import { toast } from 'sonner';import type { MemberRole } from '@/lib/api/endpoints/members';@@ -16,12 +24,13 @@ import NewProjectModal from '@/components/layout/NewProjectModal';import TeamProjectDeleteDialog from './TeamProjectDeleteDialog';import TeamProjectEditModal from './TeamProjectEditModal';import TeamProjectLeaveDialog from './TeamProjectLeaveDialog';+import TeamProjectTemplateModal from './TeamProjectTemplateModal';// What the reader may do with one project of the team, as the actions of the panel-// header. Editing, copying and archiving follow their rank in the team — a manager-// does all three, an owner also deletes — while leaving follows their membership in-// the project, which its last owner, and anyone a provisioned group put there, cannot-// give up.+// header. Editing, copying, saving as a template and archiving follow their rank in the+// team — a manager does all four, an owner also deletes — while leaving follows their+// membership in the project, which its last owner, and anyone a provisioned group put+// there, cannot give up.export default function TeamProjectActions({teamId,teamRole,@@ -38,6 +47,7 @@ export default function TeamProjectActions({const { data: session } = useSession();const [editing, setEditing] = useState(false);const [copying, setCopying] = useState(false);+ const [templating, setTemplating] = useState(false);const [deleting, setDeleting] = useState(false);const [leaving, setLeaving] = useState(false);const setArchived = useSetTeamProjectArchived();@@ -66,6 +76,11 @@ export default function TeamProjectActions({<><RowAction icon={Pencil} label={t('editAction')} onClick={() => setEditing(true)} /><RowAction icon={Copy} label={t('copyAction')} onClick={() => setCopying(true)} />+ <RowAction+ icon={LayoutTemplate}+ label={t('saveTemplateAction')}+ onClick={() => setTemplating(true)}+ /><RowActionicon={archived ? ArchiveRestore : Archive}label={t(archived ? 'restoreAction' : 'archiveAction')}@@ -101,6 +116,14 @@ export default function TeamProjectActions({/>)}+ {templating && (+ <TeamProjectTemplateModal+ teamId={teamId}+ project={project}+ onClose={() => setTemplating(false)}+ />+ )}+{deleting && (<TeamProjectDeleteDialogteamId={teamId}diff --git a/apps/web/src/features/teams/components/projects/TeamProjectTemplateModal.tsx b/apps/web/src/features/teams/components/projects/TeamProjectTemplateModal.tsxnew file mode 100644index 00000000..3c8cb74a--- /dev/null+++ b/apps/web/src/features/teams/components/projects/TeamProjectTemplateModal.tsx@@ -0,0 +1,81 @@+'use client';++import { useState } from 'react';+import { useTranslations } from 'next-intl';+import { toast } from 'sonner';+import type { TeamProject } from '@/lib/api/endpoints/teams';+import { useSaveProjectTemplate } from '@/services/projectTemplates.service';+import Modal from '@/components/common/overlay/Modal';+import { useCopyColumns } from '@/hooks/useCopyColumns';+import { includeOf, type CopyInclude } from '@/utils/copyOptions';+import CopyProjectOptions from '@/components/layout/CopyProjectOptions';+import { Button } from '@/components/ui/button';+import { Input } from '@/components/ui/input';+import { Label } from '@/components/ui/label';+import { Textarea } from '@/components/ui/textarea';++// Saves the chosen parts of a project's configuration as a project template of the team.+// Only what a template carries is offered.+export default function TeamProjectTemplateModal({+ teamId,+ project,+ onClose,+}: {+ teamId: number;+ project: TeamProject;+ onClose: () => void;+}) {+ const t = useTranslations('projects.saveTemplate');+ const tNew = useTranslations('newProject');+ const [name, setName] = useState(project.name);+ const [description, setDescription] = useState(project.description);+ const columns = useCopyColumns(true);+ const [include, setInclude] = useState<CopyInclude>({});+ const save = useSaveProjectTemplate(teamId);++ function submit() {+ save.mutate(+ {+ projectId: project.id,+ name: name.trim(),+ description: description.trim(),+ include: includeOf(columns, include),+ },+ {+ onSuccess: (template) => {+ toast.success(t('saved', { name: template.name }));+ onClose();+ },+ },+ );+ }++ return (+ <Modal title={t('title', { name: project.name })} onClose={onClose} wide="xl" className="pb-3">+ <div className="flex min-h-0 flex-col">+ <div className="max-h-[55vh] space-y-4 overflow-y-auto pr-1">+ <p className="text-sm text-muted-foreground">{t('hint')}</p>+ <div className="space-y-1.5">+ <Label>{tNew('name')}</Label>+ <Input autoFocus value={name} onChange={(e) => setName(e.target.value)} />+ </div>+ <div className="space-y-1.5">+ <Label>{tNew('description')}</Label>+ <Textarea+ rows={2}+ className="resize-none"+ value={description}+ onChange={(e) => setDescription(e.target.value)}+ />+ </div>+ <CopyProjectOptions columns={columns} value={include} onChange={setInclude} />+ </div>+ <div className="mt-4 flex justify-end border-t pt-3">+ <Button disabled={save.isPending || !name.trim()} onClick={submit}>+ {t('save')}+ </Button>+ </div>+ </div>+ </Modal>+ );+}diff --git a/apps/web/src/features/teams/components/templates/TeamTemplateDeleteDialog.tsx b/apps/web/src/features/teams/components/templates/TeamTemplateDeleteDialog.tsxnew file mode 100644index 00000000..630dc1ab--- /dev/null+++ b/apps/web/src/features/teams/components/templates/TeamTemplateDeleteDialog.tsx@@ -0,0 +1,33 @@+'use client';++import { useTranslations } from 'next-intl';+import type { ProjectTemplate } from '@/lib/api/endpoints/project-templates';+import { useDeleteProjectTemplate } from '@/services/projectTemplates.service';+import ConfirmDialog from '@/components/common/overlay/ConfirmDialog';++export default function TeamTemplateDeleteDialog({+ teamId,+ template,+ onClose,+}: {+ teamId: number;+ template: ProjectTemplate;+ onClose: () => void;+}) {+ const t = useTranslations('teams.templates.deleteDialog');+ const deleteTemplate = useDeleteProjectTemplate(teamId);++ return (+ <ConfirmDialog+ title={t('title', { name: template.name })}+ confirmLabel={t('confirm')}+ onClose={onClose}+ onConfirm={async () => {+ await deleteTemplate.mutateAsync(template.id);+ onClose();+ }}+ >+ <p className="text-sm text-muted-foreground">{t('description')}</p>+ </ConfirmDialog>+ );+}diff --git a/apps/web/src/features/teams/components/templates/TeamTemplatePanel.tsx b/apps/web/src/features/teams/components/templates/TeamTemplatePanel.tsxnew file mode 100644index 00000000..d1928670--- /dev/null+++ b/apps/web/src/features/teams/components/templates/TeamTemplatePanel.tsx@@ -0,0 +1,90 @@+'use client';++import { useState } from 'react';+import { useRouter } from 'next/navigation';+import { LayoutTemplate, Plus, Trash2, X } from 'lucide-react';+import { useTranslations } from 'next-intl';+import type { ProjectTemplate } from '@/lib/api/endpoints/project-templates';+import { projectPath } from '@/utils/paths';+import { useExitOnEscape } from '@/hooks/useExitOnEscape';+import ProjectTemplateDetails from '@/components/common/project-template/ProjectTemplateDetails';+import NewProjectModal from '@/components/layout/NewProjectModal';+import { Button } from '@/components/ui/button';++// One template of the team in a right-hand side panel, the surface a project of the+// team opens in: what it is, what a project created from it starts with, and a project+// to create from it. Escape or a backdrop click closes it.+export default function TeamTemplatePanel({+ teamId,+ template,+ onDelete,+ onClose,+}: {+ teamId: number;+ template: ProjectTemplate;+ onDelete: () => void;+ onClose: () => void;+}) {+ const t = useTranslations('teams');+ const tCommon = useTranslations('common');+ const router = useRouter();+ const [creating, setCreating] = useState(false);++ useExitOnEscape(onClose);++ return (+ <div+ className="fixed inset-0 z-40 flex bg-black/20"+ onClick={(e) => e.target === e.currentTarget && onClose()}+ >+ <div className="ms-auto flex h-full w-full flex-col border-s bg-card sm:w-[680px] sm:max-w-[92vw]">+ <div className="flex shrink-0 items-center justify-between gap-3 bg-muted/30 px-6 py-4">+ <div className="flex min-w-0 items-center gap-2">+ <LayoutTemplate className="size-4 shrink-0 text-muted-foreground" />+ <h2 className="truncate text-base font-semibold" dir="auto">+ {template.name}+ </h2>+ </div>+ <Button+ variant="ghost"+ size="icon"+ className="size-7 shrink-0"+ onClick={onClose}+ title={tCommon('close')}+ >+ <X />+ </Button>+ </div>++ <div className="flex-1 overflow-y-auto px-6 py-6">+ <ProjectTemplateDetails teamId={teamId} template={template} />+ </div>++ <div className="flex shrink-0 items-center justify-between gap-3 border-t px-6 py-3">+ <Button+ variant="ghost"+ size="sm"+ className="text-muted-foreground hover:text-destructive"+ onClick={onDelete}+ >+ <Trash2 />+ {t('templates.deleteAction')}+ </Button>+ <Button size="sm" onClick={() => setCreating(true)}>+ <Plus />+ {t('panel.newProject')}+ </Button>+ </div>+ </div>++ {creating && (+ <NewProjectModal+ teamId={teamId}+ initialTemplateId={template.id}+ onClose={() => setCreating(false)}+ onCreated={(key) => router.push(projectPath(key))}+ />+ )}+ </div>+ );+}diff --git a/apps/web/src/features/teams/components/templates/TeamTemplatesSection.tsx b/apps/web/src/features/teams/components/templates/TeamTemplatesSection.tsxnew file mode 100644index 00000000..8ac86634--- /dev/null+++ b/apps/web/src/features/teams/components/templates/TeamTemplatesSection.tsx@@ -0,0 +1,46 @@+'use client';++import Link from 'next/link';+import { useTranslations } from 'next-intl';+import { teamSectionPath } from '@/utils/paths';+import { useTeam } from '@/services/teams.service';+import { useProjectTemplatesQuery } from '@/services/projectTemplates.service';+import { EmptyState } from '@/components/common/page/EmptyState';+import SectionPageView from '@/components/common/page/SectionPageView';+import ListSkeleton from '@/components/common/skeleton/ListSkeleton';+import { Button } from '@/components/ui/button';+import TeamTemplatesTable from './TeamTemplatesTable';++// The project templates of a team, which its owners and managers save from a project's+// row in Projects and pick when they create a project. A plain member reads a notice+// instead of the list.+export default function TeamTemplatesSection({ teamId }: { teamId: number }) {+ const t = useTranslations('teams');+ const team = useTeam(teamId);+ const canManage = team?.role === 'owner' || team?.role === 'manager';+ const { data: templates } = useProjectTemplatesQuery(canManage ? teamId : null);++ return (+ <SectionPageView+ title={t('sections.templates.title')}+ description={t('sections.templates.description')}+ wide+ >+ {!team ? (+ <ListSkeleton rows={2} rowClassName="h-12" />+ ) : !canManage ? (+ <p className="text-sm text-muted-foreground">{t('templates.ownerOnly')}</p>+ ) : !templates ? (+ <ListSkeleton rows={2} rowClassName="h-12" />+ ) : templates.length === 0 ? (+ <EmptyState title={t('templates.empty')} description={t('templates.emptyHint')}>+ <Button asChild size="sm" variant="outline">+ <Link href={teamSectionPath(team.ref, 'projects')}>{t('templates.openProjects')}</Link>+ </Button>+ </EmptyState>+ ) : (+ <TeamTemplatesTable teamId={teamId} templates={templates} />+ )}+ </SectionPageView>+ );+}diff --git a/apps/web/src/features/teams/components/templates/TeamTemplatesTable.tsx b/apps/web/src/features/teams/components/templates/TeamTemplatesTable.tsxnew file mode 100644index 00000000..ed76e1f2--- /dev/null+++ b/apps/web/src/features/teams/components/templates/TeamTemplatesTable.tsx@@ -0,0 +1,111 @@+'use client';++import { useState } from 'react';+import { Trash2 } from 'lucide-react';+import { useTranslations } from 'next-intl';+import type { ProjectTemplate } from '@/lib/api/endpoints/project-templates';+import { formatDate } from '@/utils/dates';+import RowAction from '@/components/common/RowAction';+import {+ Table,+ TableBody,+ TableCell,+ TableHead,+ TableHeader,+ TableRow,+} from '@/components/ui/table';+import TeamTemplateDeleteDialog from './TeamTemplateDeleteDialog';+import TeamTemplatePanel from './TeamTemplatePanel';++// The templates of the team. A row opens what the template holds in a side panel.+export default function TeamTemplatesTable({+ teamId,+ templates,+}: {+ teamId: number;+ templates: ProjectTemplate[];+}) {+ const t = useTranslations('teams');+ const tCommon = useTranslations('common');+ const [deleting, setDeleting] = useState<ProjectTemplate | null>(null);+ const [selectedId, setSelectedId] = useState<number | null>(null);+ // Read from the list, so the panel closes once its template is deleted.+ const selected = templates.find((template) => template.id === selectedId) ?? null;++ return (+ <div className="overflow-x-auto">+ <Table className="min-w-[560px] table-fixed">+ <colgroup>+ <col className="w-[66%]" />+ <col className="w-[20%]" />+ <col className="w-[14%]" />+ </colgroup>+ <TableHeader>+ <TableRow className="hover:bg-transparent">+ <TableHead className="text-xs font-medium text-muted-foreground">+ {t('columns.template')}+ </TableHead>+ <TableHead className="text-xs font-medium text-muted-foreground">+ {t('columns.created')}+ </TableHead>+ <TableHead className="text-end text-xs font-medium text-muted-foreground">+ {tCommon('actions')}+ </TableHead>+ </TableRow>+ </TableHeader>+ <TableBody>+ {templates.map((template) => (+ <TableRow+ key={template.id}+ className="cursor-pointer"+ onClick={() => setSelectedId(template.id)}+ >+ <TableCell className="px-3 py-3 whitespace-normal">+ <p className="text-sm font-medium wrap-anywhere" dir="auto">+ {template.name}+ </p>+ {template.description && (+ <p+ className="line-clamp-1 text-xs wrap-anywhere text-muted-foreground"+ dir="auto"+ title={template.description}+ >+ {template.description}+ </p>+ )}+ </TableCell>+ <TableCell className="px-3 py-3 text-sm text-muted-foreground">+ {formatDate(template.createdAt)}+ </TableCell>+ <TableCell className="px-3 py-2 text-end" onClick={(e) => e.stopPropagation()}>+ <RowAction+ icon={Trash2}+ label={t('templates.deleteAction')}+ destructive+ onClick={() => setDeleting(template)}+ />+ </TableCell>+ </TableRow>+ ))}+ </TableBody>+ </Table>++ {selected && (+ <TeamTemplatePanel+ teamId={teamId}+ template={selected}+ onDelete={() => setDeleting(selected)}+ onClose={() => setSelectedId(null)}+ />+ )}++ {deleting && (+ <TeamTemplateDeleteDialog+ teamId={teamId}+ template={deleting}+ onClose={() => setDeleting(null)}+ />+ )}+ </div>+ );+}diff --git a/apps/web/src/hooks/useCopyColumns.ts b/apps/web/src/hooks/useCopyColumns.tsnew file mode 100644index 00000000..b0f7cacf--- /dev/null+++ b/apps/web/src/hooks/useCopyColumns.ts@@ -0,0 +1,58 @@+import { useTranslations } from 'next-intl';+import { useCopySections } from '@/cloud';+import type { Messages } from '@/i18n/messages';+import type { CopyGroup, CopyOption } from '@/utils/copyOptions';++// The parts of a project a copy can carry over, in the columns they are shown in: the+// core's, with what the hosted build adds. With `template`, only what a project template+// carries.+export function useCopyColumns(template = false): CopyGroup[][] {+ const t = useTranslations('newProject');++ const option = (+ key: keyof Messages['newProject']['copyItems'],+ requires: string[] = [],+ inTemplate = true,+ ): CopyOption => ({ key, label: t(`copyItems.${key}`), requires, template: inTemplate });+ const group = (+ key: keyof Messages['newProject']['copyGroups'],+ options: CopyOption[],+ ): CopyGroup => ({ key, title: t(`copyGroups.${key}`), options });++ const columns = useCopySections([+ [+ group('workflow', [+ option('states'),+ option('issueTypes'),+ option('labels'),+ option('customFields', ['issueTypes']),+ option('issueTemplates', ['states', 'issueTypes', 'labels']),+ option('configuration'),+ ]),+ ],+ [+ group('automation', [+ option('actions', ['states', 'issueTypes', 'labels']),+ option('schedules', ['agents', 'states'], false),+ option('webhooks', [], false),+ ]),+ ],+ [group('aiTeam', [option('agents', [], false)])],+ [+ group('views', [+ option('views', ['states', 'issueTypes', 'labels', 'customFields']),+ option('dashboards'),+ ]),+ group('knowledge', [option('documents', [], false)]),+ ],+ ]);++ if (!template) return columns;+ return columns+ .map((column) =>+ column+ .map((g) => ({ ...g, options: g.options.filter((o) => o.template) }))+ .filter((g) => g.options.length > 0),+ )+ .filter((column) => column.length > 0);+}diff --git a/apps/web/src/lib/api/endpoints/project-templates.ts b/apps/web/src/lib/api/endpoints/project-templates.tsnew file mode 100644index 00000000..fc69f0ac--- /dev/null+++ b/apps/web/src/lib/api/endpoints/project-templates.ts@@ -0,0 +1,58 @@+import { request } from '@/lib/api/core/client';+import type { ActionDef } from '@/lib/api/endpoints/actions';+import type { Column } from '@/lib/api/endpoints/columns';+import type { CustomField } from '@/lib/api/endpoints/customFields';+import type { Dashboard } from '@/lib/api/endpoints/dashboards';+import type { IssueTemplate } from '@/lib/api/endpoints/issueTemplates';+import type { IssueType } from '@/lib/api/endpoints/issueTypes';+import type { Label, LabelGroup } from '@/lib/api/endpoints/labels';+import type { EstimateSettings, ProjectFeatures } from '@/lib/api/endpoints/settings';+import type { View } from '@/lib/api/endpoints/views';++// A saved copy of a project's configuration that new projects of the team start from.+export interface ProjectTemplate {+ id: number;+ name: string;+ description: string;+ createdAt: string;+}++// What a template holds. `sections` are the parts the hosted build adds, by the key of+// their copy option, with the names of what each holds.+export interface ProjectTemplateDetail extends ProjectTemplate {+ columns: Column[];+ issueTypes: IssueType[];+ labels: Label[];+ labelGroups: LabelGroup[];+ customFields: CustomField[];+ issueTemplates: IssueTemplate[];+ views: View[];+ dashboards: Dashboard[];+ actions: ActionDef[];+ features: ProjectFeatures;+ estimates: EstimateSettings;+ sections: { key: string; items: string[] }[];+}++export const getProjectTemplate = (teamId: number, templateId: number) =>+ request<ProjectTemplateDetail>(`/teams/${teamId}/project-templates/${templateId}`);++export const listProjectTemplates = (teamId: number) =>+ request<ProjectTemplate[]>(`/teams/${teamId}/project-templates`);++export const saveProjectTemplate = (+ teamId: number,+ input: {+ projectId: number;+ name: string;+ description?: string;+ include?: Record<string, boolean>;+ },+) =>+ request<ProjectTemplate>(`/teams/${teamId}/project-templates`, {+ method: 'POST',+ body: JSON.stringify(input),+ });++export const deleteProjectTemplate = (teamId: number, templateId: number) =>+ request<void>(`/teams/${teamId}/project-templates/${templateId}`, { method: 'DELETE' });diff --git a/apps/web/src/lib/api/endpoints/teams.ts b/apps/web/src/lib/api/endpoints/teams.tsindex 22018871..26e02cdf 100644--- a/apps/web/src/lib/api/endpoints/teams.ts+++ b/apps/web/src/lib/api/endpoints/teams.ts@@ -32,6 +32,7 @@ export interface Team {source: 'invite' | 'scim';joinedAt: string;projectCount: number;+ templateCount: number;memberCount: number;// How many of those members are owners: the last one cannot leave.ownerCount: number;@@ -164,24 +165,6 @@ export interface TeamProjectDefaults {defaultAgentIds: number[];}-// Parts of a source project the copy can carry over, one key per project settings-// section. Passed to copyTeamProject as an include map; omitted keys are not-// copied. The API force-enables dependencies (a view needs its-// states/types/labels/fields).-export type CopyProjectIncludeKey =- | 'states'- | 'issueTypes'- | 'labels'- | 'customFields'- | 'views'- | 'dashboards'- | 'documents'- | 'actions'- | 'configuration'- | 'webhooks'- | 'agents'- | 'schedules';-export const listTeams = () => request<Team[]>('/teams');export const getTeam = (teamId: number) => request<TeamDetail>(`/teams/${teamId}`);@@ -257,9 +240,16 @@ export const updateTeamProjectDefaults = (teamId: number, defaultAgentIds: numbe// The projects a team owns: created, copied, and deleted by the team's own ranks// (owner/manager create and copy, owner deletes) rather than by project membership.+// With templateId the project starts with what that project template holds.export const createTeamProject = (teamId: number,- input: { key: string; name: string; description?: string; preset?: string },+ input: {+ key: string;+ name: string;+ description?: string;+ preset?: string;+ templateId?: number;+ },) =>request<Project>(`/teams/${teamId}/projects`, {method: 'POST',@@ -273,7 +263,9 @@ export const copyTeamProject = (key: string;name: string;description?: string;- include?: Partial<Record<CopyProjectIncludeKey, boolean>>;+ // One key per part (useCopyColumns); an omitted key is not copied. The API+ // force-enables dependencies (a view needs its states/types/labels/fields).+ include?: Record<string, boolean>;},) =>request<Project>(`/teams/${teamId}/projects/${projectId}/copy`, {diff --git a/apps/web/src/services/projectTemplates.service.ts b/apps/web/src/services/projectTemplates.service.tsnew file mode 100644index 00000000..c5e3725c--- /dev/null+++ b/apps/web/src/services/projectTemplates.service.ts@@ -0,0 +1,54 @@+import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';+import {+ deleteProjectTemplate,+ getProjectTemplate,+ listProjectTemplates,+ saveProjectTemplate,+} from '@/lib/api/endpoints/project-templates';+import { qk } from '@/services/queryKeys';++// The team list carries how many templates each team holds, so a save or a delete+// refreshes it too.+function useTemplateMutation<TInput, TResult>(+ teamId: number,+ mutationFn: (input: TInput) => Promise<TResult>,+) {+ const qc = useQueryClient();+ return useMutation({+ mutationFn,+ onSuccess: () => {+ qc.invalidateQueries({ queryKey: qk.projectTemplates(teamId) });+ qc.invalidateQueries({ queryKey: qk.teams });+ },+ });+}++// The team's project templates. Pass null where the caller has no use for them, to skip+// the request.+export function useProjectTemplatesQuery(teamId: number | null) {+ return useQuery({+ queryKey: qk.projectTemplates(teamId ?? 0),+ queryFn: () => listProjectTemplates(teamId!),+ enabled: teamId != null,+ });+}++// What one template holds, read when its row is opened.+export function useProjectTemplateQuery(teamId: number, templateId: number) {+ return useQuery({+ queryKey: qk.projectTemplate(teamId, templateId),+ queryFn: () => getProjectTemplate(teamId, templateId),+ });+}++export function useSaveProjectTemplate(teamId: number) {+ return useTemplateMutation(teamId, (input: Parameters<typeof saveProjectTemplate>[1]) =>+ saveProjectTemplate(teamId, input),+ );+}++export function useDeleteProjectTemplate(teamId: number) {+ return useTemplateMutation(teamId, (templateId: number) =>+ deleteProjectTemplate(teamId, templateId),+ );+}diff --git a/apps/web/src/services/projects.service.ts b/apps/web/src/services/projects.service.tsindex 80ed8c0a..935c7a5a 100644--- a/apps/web/src/services/projects.service.ts+++ b/apps/web/src/services/projects.service.ts@@ -1,7 +1,6 @@import { useInfiniteQuery, useMutation, useQuery, useQueryClient } from '@tanstack/react-query';import { removeMember } from '@/lib/api/endpoints/members';import {- type CopyProjectIncludeKey,createTeamProject,copyTeamProject,updateTeamProject,@@ -110,8 +109,9 @@ export function useCreateProject() {key: string;name: string;description?: string;- include?: Partial<Record<CopyProjectIncludeKey, boolean>>;+ include?: Record<string, boolean>;preset?: string;+ templateId?: number;};}) =>copyFromId == nulldiff --git a/apps/web/src/services/queryKeys.ts b/apps/web/src/services/queryKeys.tsindex 36bc85cf..26753828 100644--- a/apps/web/src/services/queryKeys.ts+++ b/apps/web/src/services/queryKeys.ts@@ -34,6 +34,9 @@ export const qk = {scimGroups: (workspaceId: number | null) => [...scimKey(workspaceId), 'groups'] as const,scimProjects: (workspaceId: number | null) => [...scimKey(workspaceId), 'projects'] as const,teamProjectDefaults: (teamId: number) => ['team', teamId, 'project-defaults'] as const,+ projectTemplates: (teamId: number) => ['team', teamId, 'project-templates'] as const,+ projectTemplate: (teamId: number, templateId: number) =>+ ['team', teamId, 'project-templates', templateId] as const,// The members of a team and the projects it owns, each read by its own section. A// page is scoped by the search term and the window it was read with.teamMembers: (teamId: number, params: unknown) => ['team', teamId, 'members', params] as const,diff --git a/apps/web/src/utils/copyOptions.test.ts b/apps/web/src/utils/copyOptions.test.tsnew file mode 100644index 00000000..3af6b5bd--- /dev/null+++ b/apps/web/src/utils/copyOptions.test.ts@@ -0,0 +1,42 @@+import assert from 'node:assert/strict';+import { describe, it } from 'node:test';+import { includeOf, toggleInclude, type CopyGroup } from './copyOptions';++const option = (key: string, requires: string[] = []) => ({+ key,+ label: key,+ requires,+ template: true,+});++const columns: CopyGroup[][] = [+ [{ key: 'workflow', title: 'Workflow', options: [option('states'), option('labels')] }],+ [{ key: 'extra', title: 'Extra', options: [option('views', ['states', 'labels'])] }],+];++describe('includeOf', () => {+ it('counts an option the reader left alone as selected', () => {+ assert.deepEqual(includeOf(columns, { labels: false }), {+ states: true,+ labels: false,+ views: true,+ });+ });+});++describe('toggleInclude', () => {+ it('checks what an option requires', () => {+ const next = toggleInclude(+ columns,+ { states: false, labels: false, views: false },+ 'views',+ true,+ );+ assert.deepEqual(includeOf(columns, next), { states: true, labels: true, views: true });+ });++ it('clears what requires a cleared option', () => {+ const next = toggleInclude(columns, {}, 'labels', false);+ assert.deepEqual(includeOf(columns, next), { states: true, labels: false, views: false });+ });+});diff --git a/apps/web/src/utils/copyOptions.ts b/apps/web/src/utils/copyOptions.tsnew file mode 100644index 00000000..96c8349d--- /dev/null+++ b/apps/web/src/utils/copyOptions.ts@@ -0,0 +1,64 @@+// A part of a project a copy can carry over, and what it needs carried with it: a view,+// an action or an issue template points at states, types, labels and fields, and a+// schedule belongs to an agent and a state. Mirrors the API's normalizeInclude.+export interface CopyOption {+ key: string;+ label: string;+ requires: string[];+ // Whether a project template carries it.+ template: boolean;+}++export interface CopyGroup {+ key: string;+ title: string;+ options: CopyOption[];+}++// The reader's choices. An option left out of it is selected, so one the hosted build+// adds after the first render starts selected like the rest.+export type CopyInclude = Record<string, boolean>;++export const copyOptionsOf = (columns: CopyGroup[][]): CopyOption[] =>+ columns.flat().flatMap((group) => group.options);++export const isIncluded = (include: CopyInclude, key: string): boolean => include[key] !== false;++// The selection the API takes: every option shown, on or off.+export function includeOf(columns: CopyGroup[][], include: CopyInclude): Record<string, boolean> {+ return Object.fromEntries(+ copyOptionsOf(columns).map((option) => [option.key, isIncluded(include, option.key)]),+ );+}++// Checking an option checks what it requires; clearing one clears what requires it.+export function toggleInclude(+ columns: CopyGroup[][],+ include: CopyInclude,+ key: string,+ checked: boolean,+): CopyInclude {+ const options = copyOptionsOf(columns);+ const requires = (k: string) => options.find((option) => option.key === k)?.requires ?? [];+ const next = { ...include, [key]: checked };+ if (checked) {+ const stack = [...requires(key)];+ while (stack.length) {+ const dep = stack.pop()!;+ if (!isIncluded(next, dep)) next[dep] = true;+ stack.push(...requires(dep));+ }+ } else {+ let changed = true;+ while (changed) {+ changed = false;+ for (const option of options) {+ if (isIncluded(next, option.key) && option.requires.some((dep) => !isIncluded(next, dep))) {+ next[option.key] = false;+ changed = true;+ }+ }+ }+ }+ return next;+}diff --git a/apps/web/src/utils/paths.ts b/apps/web/src/utils/paths.tsindex 81a1370c..ddf8e099 100644--- a/apps/web/src/utils/paths.ts+++ b/apps/web/src/utils/paths.ts@@ -155,6 +155,7 @@ export const manageTeamsPath = () => '/account/teams';export type TeamSection =| 'info'| 'projects'+ | 'templates'| 'members'| 'roles'| 'integrations'diff --git a/packages/db/drizzle/0169_project_template.sql b/packages/db/drizzle/0169_project_template.sqlnew file mode 100644index 00000000..5a03b1b2--- /dev/null+++ b/packages/db/drizzle/0169_project_template.sql@@ -0,0 +1 @@+ALTER TABLE "project" ADD COLUMN "is_template" boolean DEFAULT false NOT NULL;\ No newline at end of filediff --git a/packages/db/drizzle/meta/0169_snapshot.json b/packages/db/drizzle/meta/0169_snapshot.jsonnew file mode 100644index 00000000..538f1f69--- /dev/null+++ b/packages/db/drizzle/meta/0169_snapshot.json@@ -0,0 +1,12851 @@+{+ "id": "daef6d96-f2ef-491e-9d3c-079b1f61f497",+ "prevId": "1903d312-c7c7-4060-8746-83d989f154fd",+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "account_user_id_user_id_fk": {+ "name": "account_user_id_user_id_fk",+ "tableFrom": "account",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "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",+ "tableTo": "agent_chat_message",+ "columnsFrom": [+ "message_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_chat_favorite_agent_id_ai_agent_id_fk": {+ "name": "agent_chat_favorite_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_chat_favorite",+ "tableTo": "ai_agent",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "where": "\"agent_chat_message\".\"status\" IN ('pending', 'streaming')",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "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",+ "tableTo": "agent_chat_thread",+ "columnsFrom": [+ "thread_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_chat_message_agent_id_ai_agent_id_fk": {+ "name": "agent_chat_message_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_chat_message",+ "tableTo": "ai_agent",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_chat_thread_agent_id_ai_agent_id_fk": {+ "name": "agent_chat_thread_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_chat_thread",+ "tableTo": "ai_agent",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_chat_thread_user_id_user_id_fk": {+ "name": "agent_chat_thread_user_id_user_id_fk",+ "tableFrom": "agent_chat_thread",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_chat_usage_agent_id_ai_agent_id_fk": {+ "name": "agent_chat_usage_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_chat_usage",+ "tableTo": "ai_agent",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_field_trigger_agent_id_ai_agent_id_fk": {+ "name": "agent_field_trigger_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_field_trigger",+ "tableTo": "ai_agent",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_field_trigger_field_id_custom_field_id_fk": {+ "name": "agent_field_trigger_field_id_custom_field_id_fk",+ "tableFrom": "agent_field_trigger",+ "tableTo": "custom_field",+ "columnsFrom": [+ "field_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_run_schedule_idx": {+ "name": "agent_run_schedule_idx",+ "columns": [+ {+ "expression": "schedule_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_run_project_idx": {+ "name": "agent_run_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "where": "\"agent_run\".\"issue_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_run_source_activity_idx": {+ "name": "agent_run_source_activity_idx",+ "columns": [+ {+ "expression": "source_activity_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"agent_run\".\"source_activity_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_run_agent_id_ai_agent_id_fk": {+ "name": "agent_run_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_run",+ "tableTo": "ai_agent",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_run_project_id_project_id_fk": {+ "name": "agent_run_project_id_project_id_fk",+ "tableFrom": "agent_run",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_run_issue_id_issue_id_fk": {+ "name": "agent_run_issue_id_issue_id_fk",+ "tableFrom": "agent_run",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_run_schedule_id_agent_schedule_id_fk": {+ "name": "agent_run_schedule_id_agent_schedule_id_fk",+ "tableFrom": "agent_run",+ "tableTo": "agent_schedule",+ "columnsFrom": [+ "schedule_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_run_source_activity_id_issue_activity_id_fk": {+ "name": "agent_run_source_activity_id_issue_activity_id_fk",+ "tableFrom": "agent_run",+ "tableTo": "issue_activity",+ "columnsFrom": [+ "source_activity_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "agent_run_document_id_project_document_id_fk": {+ "name": "agent_run_document_id_project_document_id_fk",+ "tableFrom": "agent_run",+ "tableTo": "project_document",+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_run_source_document_comment_id_document_comment_id_fk": {+ "name": "agent_run_source_document_comment_id_document_comment_id_fk",+ "tableFrom": "agent_run",+ "tableTo": "document_comment",+ "columnsFrom": [+ "source_document_comment_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "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",+ "tableTo": "agent_run",+ "columnsFrom": [+ "run_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_schedule_agent_idx": {+ "name": "agent_schedule_agent_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_schedule_project_idx": {+ "name": "agent_schedule_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_schedule_column_idx": {+ "name": "agent_schedule_column_idx",+ "columns": [+ {+ "expression": "column_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_schedule_agent_id_ai_agent_id_fk": {+ "name": "agent_schedule_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_schedule",+ "tableTo": "ai_agent",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_schedule_project_id_project_id_fk": {+ "name": "agent_schedule_project_id_project_id_fk",+ "tableFrom": "agent_schedule",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_schedule_column_id_project_column_id_fk": {+ "name": "agent_schedule_column_id_project_column_id_fk",+ "tableFrom": "agent_schedule",+ "tableTo": "project_column",+ "columnsFrom": [+ "column_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "agent_schedule_project_id_agent_id_name_unique": {+ "name": "agent_schedule_project_id_agent_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "agent_id",+ "name"+ ]+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_skill_team_id_team_id_fk": {+ "name": "agent_skill_team_id_team_id_fk",+ "tableFrom": "agent_skill",+ "tableTo": "team",+ "columnsFrom": [+ "team_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "agent_skill_team_id_name_unique": {+ "name": "agent_skill_team_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "team_id",+ "name"+ ]+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_skill_link_agent_id_ai_agent_id_fk": {+ "name": "agent_skill_link_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_skill_link",+ "tableTo": "ai_agent",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_skill_link_skill_id_agent_skill_id_fk": {+ "name": "agent_skill_link_skill_id_agent_skill_id_fk",+ "tableFrom": "agent_skill_link",+ "tableTo": "agent_skill",+ "columnsFrom": [+ "skill_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "where": "\"agent_tool\".\"credential_id\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_tool_team_idx": {+ "name": "agent_tool_team_idx",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_tool_credential_idx": {+ "name": "agent_tool_credential_idx",+ "columns": [+ {+ "expression": "credential_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_tool_team_id_team_id_fk": {+ "name": "agent_tool_team_id_team_id_fk",+ "tableFrom": "agent_tool",+ "tableTo": "team",+ "columnsFrom": [+ "team_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_tool_credential_id_integration_credential_id_fk": {+ "name": "agent_tool_credential_id_integration_credential_id_fk",+ "tableFrom": "agent_tool",+ "tableTo": "integration_credential",+ "columnsFrom": [+ "credential_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "agent_tool_team_id_tool_key_credential_id_unique": {+ "name": "agent_tool_team_id_tool_key_credential_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "team_id",+ "tool_key",+ "credential_id"+ ]+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_tool_link_agent_id_ai_agent_id_fk": {+ "name": "agent_tool_link_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_tool_link",+ "tableTo": "ai_agent",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "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",+ "tableTo": "agent_tool",+ "columnsFrom": [+ "agent_tool_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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\")",+ "asc": true,+ "isExpression": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "ai_agent_team_idx": {+ "name": "ai_agent_team_idx",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "ai_agent_team_id_team_id_fk": {+ "name": "ai_agent_team_id_team_id_fk",+ "tableFrom": "ai_agent",+ "tableTo": "team",+ "columnsFrom": [+ "team_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "ai_agent_user_id_user_id_fk": {+ "name": "ai_agent_user_id_user_id_fk",+ "tableFrom": "ai_agent",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "ai_agent_model_credential_id_integration_credential_id_fk": {+ "name": "ai_agent_model_credential_id_integration_credential_id_fk",+ "tableFrom": "ai_agent",+ "tableTo": "integration_credential",+ "columnsFrom": [+ "model_credential_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "ai_agent_owner_user_id_user_id_fk": {+ "name": "ai_agent_owner_user_id_user_id_fk",+ "tableFrom": "ai_agent",+ "tableTo": "user",+ "columnsFrom": [+ "owner_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "ai_agent_user_id_unique": {+ "name": "ai_agent_user_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "user_id"+ ]+ }+ },+ "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.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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "apikey_referenceId_idx": {+ "name": "apikey_referenceId_idx",+ "columns": [+ {+ "expression": "reference_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "apikey_key_idx": {+ "name": "apikey_key_idx",+ "columns": [+ {+ "expression": "key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "chat_attachment_project_id_project_id_fk": {+ "name": "chat_attachment_project_id_project_id_fk",+ "tableFrom": "chat_attachment",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "chat_attachment_uploaded_by_user_id_user_id_fk": {+ "name": "chat_attachment_uploaded_by_user_id_user_id_fk",+ "tableFrom": "chat_attachment",+ "tableTo": "user",+ "columnsFrom": [+ "uploaded_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "chat_attachment_public_id_unique": {+ "name": "chat_attachment_public_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "public_id"+ ]+ }+ },+ "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",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "custom_field_issue_type_id_issue_type_id_fk": {+ "name": "custom_field_issue_type_id_issue_type_id_fk",+ "tableFrom": "custom_field",+ "tableTo": "issue_type",+ "columnsFrom": [+ "issue_type_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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",+ "tableTo": "custom_field",+ "columnsFrom": [+ "field_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "custom_field_option_field_id_value_unique": {+ "name": "custom_field_option_field_id_value_unique",+ "nullsNotDistinct": false,+ "columns": [+ "field_id",+ "value"+ ]+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "cycle_project_id_project_id_fk": {+ "name": "cycle_project_id_project_id_fk",+ "tableFrom": "cycle",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "document_asset_document_id_project_document_id_fk": {+ "name": "document_asset_document_id_project_document_id_fk",+ "tableFrom": "document_asset",+ "tableTo": "project_document",+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "document_asset_uploaded_by_user_id_user_id_fk": {+ "name": "document_asset_uploaded_by_user_id_user_id_fk",+ "tableFrom": "document_asset",+ "tableTo": "user",+ "columnsFrom": [+ "uploaded_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "document_asset_public_id_unique": {+ "name": "document_asset_public_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "public_id"+ ]+ }+ },+ "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",+ "tableTo": "project_document",+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "document_comment_document_id_project_document_id_fk": {+ "name": "document_comment_document_id_project_document_id_fk",+ "tableFrom": "document_comment",+ "tableTo": "project_document",+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "document_comment_parent_id_document_comment_id_fk": {+ "name": "document_comment_parent_id_document_comment_id_fk",+ "tableFrom": "document_comment",+ "tableTo": "document_comment",+ "columnsFrom": [+ "parent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "document_comment_author_id_user_id_fk": {+ "name": "document_comment_author_id_user_id_fk",+ "tableFrom": "document_comment",+ "tableTo": "user",+ "columnsFrom": [+ "author_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "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",+ "tableTo": "project_document",+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "git_managed_repository_project_id_project_id_fk": {+ "name": "git_managed_repository_project_id_project_id_fk",+ "tableFrom": "git_managed_repository",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "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",+ "tableTo": "git_provider_connection",+ "columnsFrom": [+ "connection_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "git_managed_repository_project_connection_external_unique": {+ "name": "git_managed_repository_project_connection_external_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "connection_id",+ "external_id"+ ]+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "git_provider_connection_team_id_team_id_fk": {+ "name": "git_provider_connection_team_id_team_id_fk",+ "tableFrom": "git_provider_connection",+ "tableTo": "team",+ "columnsFrom": [+ "team_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "import_job_due_idx": {+ "name": "import_job_due_idx",+ "columns": [+ {+ "expression": "next_attempt_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"import_job\".\"status\" = 'pending'",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "import_job_project_id_project_id_fk": {+ "name": "import_job_project_id_project_id_fk",+ "tableFrom": "import_job",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "import_job_created_by_user_id_user_id_fk": {+ "name": "import_job_created_by_user_id_user_id_fk",+ "tableFrom": "import_job",+ "tableTo": "user",+ "columnsFrom": [+ "created_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "import_record_import_job_id_import_job_id_fk": {+ "name": "import_record_import_job_id_import_job_id_fk",+ "tableFrom": "import_record",+ "tableTo": "import_job",+ "columnsFrom": [+ "import_job_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "initiative_project_id_project_id_fk": {+ "name": "initiative_project_id_project_id_fk",+ "tableFrom": "initiative",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "initiative_owner_user_id_user_id_fk": {+ "name": "initiative_owner_user_id_user_id_fk",+ "tableFrom": "initiative",+ "tableTo": "user",+ "columnsFrom": [+ "owner_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "initiative_attachment_initiative_id_initiative_id_fk": {+ "name": "initiative_attachment_initiative_id_initiative_id_fk",+ "tableFrom": "initiative_attachment",+ "tableTo": "initiative",+ "columnsFrom": [+ "initiative_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "initiative_attachment_public_id_unique": {+ "name": "initiative_attachment_public_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "public_id"+ ]+ }+ },+ "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",+ "tableTo": "initiative",+ "columnsFrom": [+ "initiative_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "initiative_label_label_id_label_id_fk": {+ "name": "initiative_label_label_id_label_id_fk",+ "tableFrom": "initiative_label",+ "tableTo": "label",+ "columnsFrom": [+ "label_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "integration_credential_team_id_team_id_fk": {+ "name": "integration_credential_team_id_team_id_fk",+ "tableFrom": "integration_credential",+ "tableTo": "team",+ "columnsFrom": [+ "team_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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+ },+ "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,+ "where": "\"issue\".\"archived_at\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_project_title_idx": {+ "name": "issue_project_title_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "lower(btrim(\"title\"))",+ "asc": true,+ "isExpression": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_parent_idx": {+ "name": "issue_parent_idx",+ "columns": [+ {+ "expression": "parent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"issue\".\"parent_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_cycle_idx": {+ "name": "issue_cycle_idx",+ "columns": [+ {+ "expression": "cycle_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"issue\".\"cycle_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_initiative_idx": {+ "name": "issue_initiative_idx",+ "columns": [+ {+ "expression": "initiative_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"issue\".\"initiative_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_project_id_project_id_fk": {+ "name": "issue_project_id_project_id_fk",+ "tableFrom": "issue",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_type_id_issue_type_id_fk": {+ "name": "issue_type_id_issue_type_id_fk",+ "tableFrom": "issue",+ "tableTo": "issue_type",+ "columnsFrom": [+ "type_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "issue_initiative_id_initiative_id_fk": {+ "name": "issue_initiative_id_initiative_id_fk",+ "tableFrom": "issue",+ "tableTo": "initiative",+ "columnsFrom": [+ "initiative_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "issue_cycle_id_cycle_id_fk": {+ "name": "issue_cycle_id_cycle_id_fk",+ "tableFrom": "issue",+ "tableTo": "cycle",+ "columnsFrom": [+ "cycle_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "issue_column_id_project_column_id_fk": {+ "name": "issue_column_id_project_column_id_fk",+ "tableFrom": "issue",+ "tableTo": "project_column",+ "columnsFrom": [+ "column_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "issue_parent_id_issue_id_fk": {+ "name": "issue_parent_id_issue_id_fk",+ "tableFrom": "issue",+ "tableTo": "issue",+ "columnsFrom": [+ "parent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "issue_assignee_user_id_user_id_fk": {+ "name": "issue_assignee_user_id_user_id_fk",+ "tableFrom": "issue",+ "tableTo": "user",+ "columnsFrom": [+ "assignee_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "issue_delegate_user_id_user_id_fk": {+ "name": "issue_delegate_user_id_user_id_fk",+ "tableFrom": "issue",+ "tableTo": "user",+ "columnsFrom": [+ "delegate_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_share_token_unique": {+ "name": "issue_share_token_unique",+ "nullsNotDistinct": false,+ "columns": [+ "share_token"+ ]+ },+ "issue_project_id_sequence_number_unique": {+ "name": "issue_project_id_sequence_number_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "sequence_number"+ ]+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_activity_reply_idx": {+ "name": "issue_activity_reply_idx",+ "columns": [+ {+ "expression": "reply_to_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_activity_issue_id_issue_id_fk": {+ "name": "issue_activity_issue_id_issue_id_fk",+ "tableFrom": "issue_activity",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_activity_initiative_id_initiative_id_fk": {+ "name": "issue_activity_initiative_id_initiative_id_fk",+ "tableFrom": "issue_activity",+ "tableTo": "initiative",+ "columnsFrom": [+ "initiative_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_activity_reply_to_id_issue_activity_id_fk": {+ "name": "issue_activity_reply_to_id_issue_activity_id_fk",+ "tableFrom": "issue_activity",+ "tableTo": "issue_activity",+ "columnsFrom": [+ "reply_to_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_activity_actor_user_id_user_id_fk": {+ "name": "issue_activity_actor_user_id_user_id_fk",+ "tableFrom": "issue_activity",+ "tableTo": "user",+ "columnsFrom": [+ "actor_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_attachment_issue_id_issue_id_fk": {+ "name": "issue_attachment_issue_id_issue_id_fk",+ "tableFrom": "issue_attachment",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_attachment_public_id_unique": {+ "name": "issue_attachment_public_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "public_id"+ ]+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_checklist_issue_id_issue_id_fk": {+ "name": "issue_checklist_issue_id_issue_id_fk",+ "tableFrom": "issue_checklist",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_checklist_item_checklist_id_issue_checklist_id_fk": {+ "name": "issue_checklist_item_checklist_id_issue_checklist_id_fk",+ "tableFrom": "issue_checklist_item",+ "tableTo": "issue_checklist",+ "columnsFrom": [+ "checklist_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_cycle_cycle_idx": {+ "name": "issue_cycle_cycle_idx",+ "columns": [+ {+ "expression": "cycle_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "where": "\"issue_cycle\".\"left_at\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_cycle_issue_id_issue_id_fk": {+ "name": "issue_cycle_issue_id_issue_id_fk",+ "tableFrom": "issue_cycle",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_cycle_cycle_id_cycle_id_fk": {+ "name": "issue_cycle_cycle_id_cycle_id_fk",+ "tableFrom": "issue_cycle",+ "tableTo": "cycle",+ "columnsFrom": [+ "cycle_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "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",+ "tableTo": "issue_development_link",+ "columnsFrom": [+ "development_link_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_development_check_development_link_id_app_id_name_unique": {+ "name": "issue_development_check_development_link_id_app_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "development_link_id",+ "app_id",+ "name"+ ]+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_development_link_issue_id_issue_id_fk": {+ "name": "issue_development_link_issue_id_issue_id_fk",+ "tableFrom": "issue_development_link",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_development_link_issue_id_provider_repository_external_key_unique": {+ "name": "issue_development_link_issue_id_provider_repository_external_key_unique",+ "nullsNotDistinct": false,+ "columns": [+ "issue_id",+ "provider",+ "repository",+ "external_key"+ ]+ }+ },+ "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",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_field_option_field_id_custom_field_id_fk": {+ "name": "issue_field_option_field_id_custom_field_id_fk",+ "tableFrom": "issue_field_option",+ "tableTo": "custom_field",+ "columnsFrom": [+ "field_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "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",+ "tableTo": "custom_field_option",+ "columnsFrom": [+ "option_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_field_value_field_id_custom_field_id_fk": {+ "name": "issue_field_value_field_id_custom_field_id_fk",+ "tableFrom": "issue_field_value",+ "tableTo": "custom_field",+ "columnsFrom": [+ "field_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_field_value_value_user_id_user_id_fk": {+ "name": "issue_field_value_value_user_id_user_id_fk",+ "tableFrom": "issue_field_value",+ "tableTo": "user",+ "columnsFrom": [+ "value_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_field_value_issue_id_field_id_unique": {+ "name": "issue_field_value_issue_id_field_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "issue_id",+ "field_id"+ ]+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_import_project_id_project_id_fk": {+ "name": "issue_import_project_id_project_id_fk",+ "tableFrom": "issue_import",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_import_attachment_id_chat_attachment_id_fk": {+ "name": "issue_import_attachment_id_chat_attachment_id_fk",+ "tableFrom": "issue_import",+ "tableTo": "chat_attachment",+ "columnsFrom": [+ "attachment_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_import_public_id_unique": {+ "name": "issue_import_public_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "public_id"+ ]+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_key_alias_project_id_project_id_fk": {+ "name": "issue_key_alias_project_id_project_id_fk",+ "tableFrom": "issue_key_alias",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_key_alias_issue_id_issue_id_fk": {+ "name": "issue_key_alias_issue_id_issue_id_fk",+ "tableFrom": "issue_key_alias",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_label_label_id_label_id_fk": {+ "name": "issue_label_label_id_label_id_fk",+ "tableFrom": "issue_label",+ "tableTo": "label",+ "columnsFrom": [+ "label_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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\")",+ "asc": true,+ "isExpression": true,+ "nulls": "last"+ },+ {+ "expression": "greatest(\"source_issue_id\", \"target_issue_id\")",+ "asc": true,+ "isExpression": true,+ "nulls": "last"+ },+ {+ "expression": "kind",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_link_source_idx": {+ "name": "issue_link_source_idx",+ "columns": [+ {+ "expression": "source_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_link_target_idx": {+ "name": "issue_link_target_idx",+ "columns": [+ {+ "expression": "target_issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_link_source_issue_id_issue_id_fk": {+ "name": "issue_link_source_issue_id_issue_id_fk",+ "tableFrom": "issue_link",+ "tableTo": "issue",+ "columnsFrom": [+ "source_issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_link_target_issue_id_issue_id_fk": {+ "name": "issue_link_target_issue_id_issue_id_fk",+ "tableFrom": "issue_link",+ "tableTo": "issue",+ "columnsFrom": [+ "target_issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_status_column_idx": {+ "name": "issue_status_column_idx",+ "columns": [+ {+ "expression": "column_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"issue_status\".\"column_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_status_open_idx": {+ "name": "issue_status_open_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"issue_status\".\"left_at\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_status_issue_id_issue_id_fk": {+ "name": "issue_status_issue_id_issue_id_fk",+ "tableFrom": "issue_status",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_status_column_id_project_column_id_fk": {+ "name": "issue_status_column_id_project_column_id_fk",+ "tableFrom": "issue_status",+ "tableTo": "project_column",+ "columnsFrom": [+ "column_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "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",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_template_type_id_issue_type_id_fk": {+ "name": "issue_template_type_id_issue_type_id_fk",+ "tableFrom": "issue_template",+ "tableTo": "issue_type",+ "columnsFrom": [+ "type_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "issue_template_column_id_project_column_id_fk": {+ "name": "issue_template_column_id_project_column_id_fk",+ "tableFrom": "issue_template",+ "tableTo": "project_column",+ "columnsFrom": [+ "column_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "issue_template_assignee_user_id_user_id_fk": {+ "name": "issue_template_assignee_user_id_user_id_fk",+ "tableFrom": "issue_template",+ "tableTo": "user",+ "columnsFrom": [+ "assignee_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_template_project_id_name_unique": {+ "name": "issue_template_project_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "name"+ ]+ }+ },+ "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",+ "tableTo": "issue_template",+ "columnsFrom": [+ "template_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_template_label_label_id_label_id_fk": {+ "name": "issue_template_label_label_id_label_id_fk",+ "tableFrom": "issue_template_label",+ "tableTo": "label",+ "columnsFrom": [+ "label_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_type_project_id_name_unique": {+ "name": "issue_type_project_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "name"+ ]+ }+ },+ "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",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_watcher_user_id_user_id_fk": {+ "name": "issue_watcher_user_id_user_id_fk",+ "tableFrom": "issue_watcher",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_worklog_issue_id_issue_id_fk": {+ "name": "issue_worklog_issue_id_issue_id_fk",+ "tableFrom": "issue_worklog",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_worklog_user_id_user_id_fk": {+ "name": "issue_worklog_user_id_user_id_fk",+ "tableFrom": "issue_worklog",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "issue_worklog_minutes_check": {+ "name": "issue_worklog_minutes_check",+ "value": "\"issue_worklog\".\"minutes\" > 0"+ }+ },+ "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.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",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "label_group_id_label_group_id_fk": {+ "name": "label_group_id_label_group_id_fk",+ "tableFrom": "label",+ "tableTo": "label_group",+ "columnsFrom": [+ "group_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "label_project_id_name_unique": {+ "name": "label_project_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "name"+ ]+ }+ },+ "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",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "label_group_project_id_name_unique": {+ "name": "label_group_project_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "name"+ ]+ }+ },+ "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",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "model_price_workspace_id_provider_model_unique": {+ "name": "model_price_workspace_id_provider_model_unique",+ "nullsNotDistinct": false,+ "columns": [+ "workspace_id",+ "provider",+ "model"+ ]+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "note_board_project_id_project_id_fk": {+ "name": "note_board_project_id_project_id_fk",+ "tableFrom": "note_board",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "note_board_owner_user_id_user_id_fk": {+ "name": "note_board_owner_user_id_user_id_fk",+ "tableFrom": "note_board",+ "tableTo": "user",+ "columnsFrom": [+ "owner_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "note_board_created_by_user_id_user_id_fk": {+ "name": "note_board_created_by_user_id_user_id_fk",+ "tableFrom": "note_board",+ "tableTo": "user",+ "columnsFrom": [+ "created_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "note_board_member_board_id_note_board_id_fk": {+ "name": "note_board_member_board_id_note_board_id_fk",+ "tableFrom": "note_board_member",+ "tableTo": "note_board",+ "columnsFrom": [+ "board_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "note_board_member_user_id_user_id_fk": {+ "name": "note_board_member_user_id_user_id_fk",+ "tableFrom": "note_board_member",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "where": "\"notification\".\"read_at\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "notification_issue_idx": {+ "name": "notification_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"notification\".\"issue_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "notification_source_activity_idx": {+ "name": "notification_source_activity_idx",+ "columns": [+ {+ "expression": "source_activity_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"notification\".\"source_activity_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "notification_user_id_user_id_fk": {+ "name": "notification_user_id_user_id_fk",+ "tableFrom": "notification",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "notification_project_id_project_id_fk": {+ "name": "notification_project_id_project_id_fk",+ "tableFrom": "notification",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "notification_issue_id_issue_id_fk": {+ "name": "notification_issue_id_issue_id_fk",+ "tableFrom": "notification",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "notification_source_activity_id_issue_activity_id_fk": {+ "name": "notification_source_activity_id_issue_activity_id_fk",+ "tableFrom": "notification",+ "tableTo": "issue_activity",+ "columnsFrom": [+ "source_activity_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "notification_document_id_project_document_id_fk": {+ "name": "notification_document_id_project_document_id_fk",+ "tableFrom": "notification",+ "tableTo": "project_document",+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "notification_document_comment_id_document_comment_id_fk": {+ "name": "notification_document_comment_id_document_comment_id_fk",+ "tableFrom": "notification",+ "tableTo": "document_comment",+ "columnsFrom": [+ "document_comment_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "notification_actor_user_id_user_id_fk": {+ "name": "notification_actor_user_id_user_id_fk",+ "tableFrom": "notification",+ "tableTo": "user",+ "columnsFrom": [+ "actor_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "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,+ "where": "\"notification_delivery\".\"status\" = 'pending'",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "notification_delivery_project_id_project_id_fk": {+ "name": "notification_delivery_project_id_project_id_fk",+ "tableFrom": "notification_delivery",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "notification_delivery_channel_check": {+ "name": "notification_delivery_channel_check",+ "value": "\"notification_delivery\".\"channel\" IN ('email', 'telegram')"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "oauthAccessToken_sessionId_idx": {+ "name": "oauthAccessToken_sessionId_idx",+ "columns": [+ {+ "expression": "session_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "oauthAccessToken_userId_idx": {+ "name": "oauthAccessToken_userId_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "oauthAccessToken_authorizationCodeId_idx": {+ "name": "oauthAccessToken_authorizationCodeId_idx",+ "columns": [+ {+ "expression": "authorization_code_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "oauthAccessToken_refreshId_idx": {+ "name": "oauthAccessToken_refreshId_idx",+ "columns": [+ {+ "expression": "refresh_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "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",+ "tableTo": "oauth_client",+ "columnsFrom": [+ "client_id"+ ],+ "columnsTo": [+ "client_id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "oauth_access_token_session_id_session_id_fk": {+ "name": "oauth_access_token_session_id_session_id_fk",+ "tableFrom": "oauth_access_token",+ "tableTo": "session",+ "columnsFrom": [+ "session_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "oauth_access_token_user_id_user_id_fk": {+ "name": "oauth_access_token_user_id_user_id_fk",+ "tableFrom": "oauth_access_token",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "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",+ "tableTo": "oauth_refresh_token",+ "columnsFrom": [+ "refresh_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "oauth_access_token_token_unique": {+ "name": "oauth_access_token_token_unique",+ "nullsNotDistinct": false,+ "columns": [+ "token"+ ]+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "oauth_client_user_id_user_id_fk": {+ "name": "oauth_client_user_id_user_id_fk",+ "tableFrom": "oauth_client",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "oauth_client_client_id_unique": {+ "name": "oauth_client_client_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "client_id"+ ]+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "oauthClientResource_clientId_idx": {+ "name": "oauthClientResource_clientId_idx",+ "columns": [+ {+ "expression": "client_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "oauthClientResource_resourceId_idx": {+ "name": "oauthClientResource_resourceId_idx",+ "columns": [+ {+ "expression": "resource_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "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",+ "tableTo": "oauth_client",+ "columnsFrom": [+ "client_id"+ ],+ "columnsTo": [+ "client_id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "oauth_client_resource_resource_id_oauth_resource_identifier_fk": {+ "name": "oauth_client_resource_resource_id_oauth_resource_identifier_fk",+ "tableFrom": "oauth_client_resource",+ "tableTo": "oauth_resource",+ "columnsFrom": [+ "resource_id"+ ],+ "columnsTo": [+ "identifier"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "oauthConsent_userId_idx": {+ "name": "oauthConsent_userId_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "oauth_consent_client_id_oauth_client_client_id_fk": {+ "name": "oauth_consent_client_id_oauth_client_client_id_fk",+ "tableFrom": "oauth_consent",+ "tableTo": "oauth_client",+ "columnsFrom": [+ "client_id"+ ],+ "columnsTo": [+ "client_id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "oauth_consent_user_id_user_id_fk": {+ "name": "oauth_consent_user_id_user_id_fk",+ "tableFrom": "oauth_consent",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "oauthRefreshToken_sessionId_idx": {+ "name": "oauthRefreshToken_sessionId_idx",+ "columns": [+ {+ "expression": "session_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "oauthRefreshToken_userId_idx": {+ "name": "oauthRefreshToken_userId_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "oauthRefreshToken_authorizationCodeId_idx": {+ "name": "oauthRefreshToken_authorizationCodeId_idx",+ "columns": [+ {+ "expression": "authorization_code_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "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",+ "tableTo": "oauth_client",+ "columnsFrom": [+ "client_id"+ ],+ "columnsTo": [+ "client_id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "oauth_refresh_token_session_id_session_id_fk": {+ "name": "oauth_refresh_token_session_id_session_id_fk",+ "tableFrom": "oauth_refresh_token",+ "tableTo": "session",+ "columnsFrom": [+ "session_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "oauth_refresh_token_user_id_user_id_fk": {+ "name": "oauth_refresh_token_user_id_user_id_fk",+ "tableFrom": "oauth_refresh_token",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "oauth_refresh_token_token_unique": {+ "name": "oauth_refresh_token_token_unique",+ "nullsNotDistinct": false,+ "columns": [+ "token"+ ]+ }+ },+ "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",+ "nullsNotDistinct": false,+ "columns": [+ "identifier"+ ]+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "passkey_credentialID_idx": {+ "name": "passkey_credentialID_idx",+ "columns": [+ {+ "expression": "credential_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "passkey_user_id_user_id_fk": {+ "name": "passkey_user_id_user_id_fk",+ "tableFrom": "passkey",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "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()"+ },+ "is_template": {+ "name": "is_template",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "project_team_id_team_id_fk": {+ "name": "project_team_id_team_id_fk",+ "tableFrom": "project",+ "tableTo": "team",+ "columnsFrom": [+ "team_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "project_team_key_uq": {+ "name": "project_team_key_uq",+ "nullsNotDistinct": false,+ "columns": [+ "team_id",+ "key"+ ]+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_action_project_id_project_id_fk": {+ "name": "project_action_project_id_project_id_fk",+ "tableFrom": "project_action",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_column_auto_assign_user_id_user_id_fk": {+ "name": "project_column_auto_assign_user_id_user_id_fk",+ "tableFrom": "project_column",+ "tableTo": "user",+ "columnsFrom": [+ "auto_assign_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "project_column_project_id_position_unique": {+ "name": "project_column_project_id_position_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "position"+ ]+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_dashboard_project_id_project_id_fk": {+ "name": "project_dashboard_project_id_project_id_fk",+ "tableFrom": "project_dashboard",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "project_document_owner_idx": {+ "name": "project_document_owner_idx",+ "columns": [+ {+ "expression": "owner_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_document_project_id_project_id_fk": {+ "name": "project_document_project_id_project_id_fk",+ "tableFrom": "project_document",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_document_parent_id_project_document_id_fk": {+ "name": "project_document_parent_id_project_document_id_fk",+ "tableFrom": "project_document",+ "tableTo": "project_document",+ "columnsFrom": [+ "parent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "project_document_archived_by_ancestor_id_project_document_id_fk": {+ "name": "project_document_archived_by_ancestor_id_project_document_id_fk",+ "tableFrom": "project_document",+ "tableTo": "project_document",+ "columnsFrom": [+ "archived_by_ancestor_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "project_document_owner_user_id_user_id_fk": {+ "name": "project_document_owner_user_id_user_id_fk",+ "tableFrom": "project_document",+ "tableTo": "user",+ "columnsFrom": [+ "owner_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "project_document_created_by_user_id_user_id_fk": {+ "name": "project_document_created_by_user_id_user_id_fk",+ "tableFrom": "project_document",+ "tableTo": "user",+ "columnsFrom": [+ "created_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "project_document_updated_by_user_id_user_id_fk": {+ "name": "project_document_updated_by_user_id_user_id_fk",+ "tableFrom": "project_document",+ "tableTo": "user",+ "columnsFrom": [+ "updated_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_document_initiative_document_id_project_document_id_fk": {+ "name": "project_document_initiative_document_id_project_document_id_fk",+ "tableFrom": "project_document_initiative",+ "tableTo": "project_document",+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_document_initiative_initiative_id_initiative_id_fk": {+ "name": "project_document_initiative_initiative_id_initiative_id_fk",+ "tableFrom": "project_document_initiative",+ "tableTo": "initiative",+ "columnsFrom": [+ "initiative_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "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",+ "tableTo": "user",+ "columnsFrom": [+ "created_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_document_issue_document_id_project_document_id_fk": {+ "name": "project_document_issue_document_id_project_document_id_fk",+ "tableFrom": "project_document_issue",+ "tableTo": "project_document",+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_document_issue_issue_id_issue_id_fk": {+ "name": "project_document_issue_issue_id_issue_id_fk",+ "tableFrom": "project_document_issue",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "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",+ "tableTo": "user",+ "columnsFrom": [+ "created_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_document_preference_document_id_project_document_id_fk": {+ "name": "project_document_preference_document_id_project_document_id_fk",+ "tableFrom": "project_document_preference",+ "tableTo": "project_document",+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_document_preference_user_id_user_id_fk": {+ "name": "project_document_preference_user_id_user_id_fk",+ "tableFrom": "project_document_preference",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_document_revision_document_id_project_document_id_fk": {+ "name": "project_document_revision_document_id_project_document_id_fk",+ "tableFrom": "project_document_revision",+ "tableTo": "project_document",+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_document_revision_owner_user_id_user_id_fk": {+ "name": "project_document_revision_owner_user_id_user_id_fk",+ "tableFrom": "project_document_revision",+ "tableTo": "user",+ "columnsFrom": [+ "owner_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "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",+ "tableTo": "user",+ "columnsFrom": [+ "created_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "project_document_revision_document_version_unique": {+ "name": "project_document_revision_document_version_unique",+ "nullsNotDistinct": false,+ "columns": [+ "document_id",+ "version"+ ]+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_member_project_id_project_id_fk": {+ "name": "project_member_project_id_project_id_fk",+ "tableFrom": "project_member",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_member_user_id_user_id_fk": {+ "name": "project_member_user_id_user_id_fk",+ "tableFrom": "project_member",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_member_role_id_team_role_id_fk": {+ "name": "project_member_role_id_team_role_id_fk",+ "tableFrom": "project_member",+ "tableTo": "team_role",+ "columnsFrom": [+ "role_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "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",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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_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+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "project_view_owner_idx": {+ "name": "project_view_owner_idx",+ "columns": [+ {+ "expression": "owner_user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_view_project_id_project_id_fk": {+ "name": "project_view_project_id_project_id_fk",+ "tableFrom": "project_view",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_view_owner_user_id_user_id_fk": {+ "name": "project_view_owner_user_id_user_id_fk",+ "tableFrom": "project_view",+ "tableTo": "user",+ "columnsFrom": [+ "owner_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "project_view_share_token_unique": {+ "name": "project_view_share_token_unique",+ "nullsNotDistinct": false,+ "columns": [+ "share_token"+ ]+ }+ },+ "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",+ "tableTo": "project_view",+ "columnsFrom": [+ "view_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_view_favorite_user_id_user_id_fk": {+ "name": "project_view_favorite_user_id_user_id_fk",+ "tableFrom": "project_view_favorite",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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",+ "tableTo": "project_view",+ "columnsFrom": [+ "view_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_view_preference_user_id_user_id_fk": {+ "name": "project_view_preference_user_id_user_id_fk",+ "tableFrom": "project_view_preference",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "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,+ "where": "\"scim_group\".\"workspace_id\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "scim_group_workspace_id_workspace_id_fk": {+ "name": "scim_group_workspace_id_workspace_id_fk",+ "tableFrom": "scim_group",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "scim_group_workspace_id_display_name_unique": {+ "name": "scim_group_workspace_id_display_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "workspace_id",+ "display_name"+ ]+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "scim_group_mapping_group_id_scim_group_id_fk": {+ "name": "scim_group_mapping_group_id_scim_group_id_fk",+ "tableFrom": "scim_group_mapping",+ "tableTo": "scim_group",+ "columnsFrom": [+ "group_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "scim_group_mapping_project_id_project_id_fk": {+ "name": "scim_group_mapping_project_id_project_id_fk",+ "tableFrom": "scim_group_mapping",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "scim_group_mapping_role_id_team_role_id_fk": {+ "name": "scim_group_mapping_role_id_team_role_id_fk",+ "tableFrom": "scim_group_mapping",+ "tableTo": "team_role",+ "columnsFrom": [+ "role_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "scim_group_mapping_group_id_project_id_unique": {+ "name": "scim_group_mapping_group_id_project_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "group_id",+ "project_id"+ ]+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "scim_group_member_group_id_scim_group_id_fk": {+ "name": "scim_group_member_group_id_scim_group_id_fk",+ "tableFrom": "scim_group_member",+ "tableTo": "scim_group",+ "columnsFrom": [+ "group_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "scim_group_member_user_id_user_id_fk": {+ "name": "scim_group_member_user_id_user_id_fk",+ "tableFrom": "scim_group_member",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "where": "\"scim_user\".\"workspace_id\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "scim_user_user_idx": {+ "name": "scim_user_user_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "scim_user_workspace_id_workspace_id_fk": {+ "name": "scim_user_workspace_id_workspace_id_fk",+ "tableFrom": "scim_user",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "scim_user_user_id_user_id_fk": {+ "name": "scim_user_user_id_user_id_fk",+ "tableFrom": "scim_user",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "scim_user_workspace_id_user_id_unique": {+ "name": "scim_user_workspace_id_user_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "workspace_id",+ "user_id"+ ]+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "session_user_id_user_id_fk": {+ "name": "session_user_id_user_id_fk",+ "tableFrom": "session",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "session_token_unique": {+ "name": "session_token_unique",+ "nullsNotDistinct": false,+ "columns": [+ "token"+ ]+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "team_workspace_id_workspace_id_fk": {+ "name": "team_workspace_id_workspace_id_fk",+ "tableFrom": "team",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "team_slug_unique": {+ "name": "team_slug_unique",+ "nullsNotDistinct": false,+ "columns": [+ "slug"+ ]+ }+ },+ "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,+ "where": "\"team_invite\".\"status\" = 'pending' AND \"team_invite\".\"project_id\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "where": "\"team_invite\".\"status\" = 'pending' AND \"team_invite\".\"project_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "team_invite_team_idx": {+ "name": "team_invite_team_idx",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "team_invite_project_idx": {+ "name": "team_invite_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "team_invite_team_id_team_id_fk": {+ "name": "team_invite_team_id_team_id_fk",+ "tableFrom": "team_invite",+ "tableTo": "team",+ "columnsFrom": [+ "team_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "team_invite_project_id_project_id_fk": {+ "name": "team_invite_project_id_project_id_fk",+ "tableFrom": "team_invite",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "team_invite_role_id_team_role_id_fk": {+ "name": "team_invite_role_id_team_role_id_fk",+ "tableFrom": "team_invite",+ "tableTo": "team_role",+ "columnsFrom": [+ "role_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "team_invite_invited_by_user_id_user_id_fk": {+ "name": "team_invite_invited_by_user_id_user_id_fk",+ "tableFrom": "team_invite",+ "tableTo": "user",+ "columnsFrom": [+ "invited_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "team_invite_accepted_by_user_id_user_id_fk": {+ "name": "team_invite_accepted_by_user_id_user_id_fk",+ "tableFrom": "team_invite",+ "tableTo": "user",+ "columnsFrom": [+ "accepted_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "team_invite_token_unique": {+ "name": "team_invite_token_unique",+ "nullsNotDistinct": false,+ "columns": [+ "token"+ ]+ }+ },+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "team_member_team_id_team_id_fk": {+ "name": "team_member_team_id_team_id_fk",+ "tableFrom": "team_member",+ "tableTo": "team",+ "columnsFrom": [+ "team_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "team_member_user_id_user_id_fk": {+ "name": "team_member_user_id_user_id_fk",+ "tableFrom": "team_member",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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",+ "tableTo": "team",+ "columnsFrom": [+ "team_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "where": "\"team_role\".\"team_id\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "team_role_system_default_uq": {+ "name": "team_role_system_default_uq",+ "columns": [+ {+ "expression": "is_default",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"team_role\".\"team_id\" IS NULL AND \"team_role\".\"is_default\"",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "team_role_team_idx": {+ "name": "team_role_team_idx",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "team_role_team_id_team_id_fk": {+ "name": "team_role_team_id_team_id_fk",+ "tableFrom": "team_role",+ "tableTo": "team",+ "columnsFrom": [+ "team_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "team_role_team_id_name_unique": {+ "name": "team_role_team_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "team_id",+ "name"+ ]+ }+ },+ "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.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+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "user_email_unique": {+ "name": "user_email_unique",+ "nullsNotDistinct": false,+ "columns": [+ "email"+ ]+ },+ "user_username_unique": {+ "name": "user_username_unique",+ "nullsNotDistinct": false,+ "columns": [+ "username"+ ]+ }+ },+ "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",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_notification_preference_project_id_project_id_fk": {+ "name": "user_notification_preference_project_id_project_id_fk",+ "tableFrom": "user_notification_preference",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "user_notification_pref_user_project_unique": {+ "name": "user_notification_pref_user_project_unique",+ "nullsNotDistinct": false,+ "columns": [+ "user_id",+ "project_id"+ ]+ }+ },+ "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",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_preference_last_project_id_project_id_fk": {+ "name": "user_preference_last_project_id_project_id_fk",+ "tableFrom": "user_preference",+ "tableTo": "project",+ "columnsFrom": [+ "last_project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "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,+ "where": "\"user_telegram_account\".\"chat_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "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,+ "where": "\"user_telegram_account\".\"link_code\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "user_telegram_account_user_id_user_id_fk": {+ "name": "user_telegram_account_user_id_user_id_fk",+ "tableFrom": "user_telegram_account",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.verification": {+ "name": "verification",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "identifier": {+ "name": "identifier",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "value": {+ "name": "value",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp",+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {},+ "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,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "webhook_project_id_project_id_fk": {+ "name": "webhook_project_id_project_id_fk",+ "tableFrom": "webhook",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "where": "\"webhook_delivery\".\"status\" = 'pending'",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "webhook_delivery_webhook_idx": {+ "name": "webhook_delivery_webhook_idx",+ "columns": [+ {+ "expression": "webhook_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "webhook_delivery_webhook_id_webhook_id_fk": {+ "name": "webhook_delivery_webhook_id_webhook_id_fk",+ "tableFrom": "webhook_delivery",+ "tableTo": "webhook",+ "columnsFrom": [+ "webhook_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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,+ "where": "\"workspace_manager\".\"role\" = 'owner'",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "workspace_manager_user_idx": {+ "name": "workspace_manager_user_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "workspace_manager_workspace_id_workspace_id_fk": {+ "name": "workspace_manager_workspace_id_workspace_id_fk",+ "tableFrom": "workspace_manager",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "workspace_manager_user_id_user_id_fk": {+ "name": "workspace_manager_user_id_user_id_fk",+ "tableFrom": "workspace_manager",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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+ }+ },+ "enums": {},+ "schemas": {},+ "sequences": {},+ "roles": {},+ "policies": {},+ "views": {},+ "_meta": {+ "columns": {},+ "schemas": {},+ "tables": {}+ }+}diff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.jsonindex bb2e25bb..282591ba 100644--- a/packages/db/drizzle/meta/_journal.json+++ b/packages/db/drizzle/meta/_journal.json@@ -1184,6 +1184,13 @@"when": 1793317804099,"tag": "0168_view_preferences","breakpoints": true+ },+ {+ "idx": 169,+ "version": "7",+ "when": 1793390367322,+ "tag": "0169_project_template",+ "breakpoints": true}]-}\ No newline at end of file+}diff --git a/packages/db/src/schema/app.ts b/packages/db/src/schema/app.tsindex 44bd3806..e5d94952 100644--- a/packages/db/src/schema/app.ts+++ b/packages/db/src/schema/app.ts@@ -194,6 +194,10 @@ export const project = pgTable(// When set, the project is archived: read-only, left out of the members' project// lists, and its agent schedules do not run. Its rows are kept and it can be restored.archivedAt: timestamp('archived_at', { withTimezone: true }),+ // A project template of the team: a saved copy of a project's configuration that new+ // projects are created from. It has no members and is left out of every project list,+ // so nobody works in it.+ isTemplate: boolean('is_template').notNull().default(false),createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),},(t) => [unique('project_team_key_uq').on(t.teamId, t.key)],