⭐️⭐️⭐️ 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: add WIP limits to board columns (#146)
Ahmed Osama3f5cb37b8052
diff --git a/DESIGN.md b/DESIGN.mdindex 41dceeb0..b23cb636 100644--- a/DESIGN.md+++ b/DESIGN.md@@ -31,6 +31,11 @@ switch).in dark.- `destructive` — error / overdue / delete only. It serves two roles at once: `text-destructive`on the page, and a fill under the white label of a destructive button or badge.+- `warning` — a state that needs attention but has refused nothing, where `destructive` would+ overstate it: a soft WIP limit is at its maximum while a hard one has blocked the move. Text+ and low-opacity tint only; there is no warning button, so it is tuned for the page background+ alone. An amber rather than a bright yellow — yellow at a legible chroma has to drop this far+ in lightness to hold contrast against the light page.- `ring` — focus ring (keyboard a11y).- `chart-1…5` — a neutral grayscale ramp for charts. For categorical series that needto be told apart (priority, assignee), widgets use their own small hue palette; fordiff --git a/apps/api/src/issues/automation.ts b/apps/api/src/issues/automation.tsindex 27ae4124..ca484262 100644--- a/apps/api/src/issues/automation.ts+++ b/apps/api/src/issues/automation.ts@@ -49,7 +49,9 @@ async function completeParent(const closed = await closedColumnIds([...siblingColumnIds, parentColumnId]);if (closed.has(parentColumnId)) return;if (siblingColumnIds.some((id) => !closed.has(id))) return;- await updateIssue(parentId, { columnId: subtask.columnId }, actorUserId);+ await updateIssue(parentId, { columnId: subtask.columnId }, actorUserId, {+ skipIfColumnFull: true,+ });}// Moves the issue's still-open subtasks into the column it was just closed in.@@ -58,7 +60,9 @@ async function closeSubtasks(parent: IssueRow, actorUserId?: ActivityActor): Proconst closed = await closedColumnIds(subtasks.map((s) => s.columnId));for (const subtask of subtasks)if (!closed.has(subtask.columnId))- await updateIssue(subtask.id, { columnId: parent.columnId }, actorUserId);+ await updateIssue(subtask.id, { columnId: parent.columnId }, actorUserId, {+ skipIfColumnFull: true,+ });}async function isClosedColumn(columnId: number): Promise<boolean> {diff --git a/apps/api/src/issues/routes.ts b/apps/api/src/issues/routes.tsindex f3a97e3d..bff18100 100644--- a/apps/api/src/issues/routes.ts+++ b/apps/api/src/issues/routes.ts@@ -455,10 +455,12 @@ export const issueRoutes = new Elysia({ name: 'issues', detail: { tags: ['Issues),}),permission: ['work_items', 'create'],- response: { 201: IssueResponse, ...commonErrors },+ response: { 201: IssueResponse, ...commonErrors, ...errors(409) },detail: {summary: 'Create an issue',- description: 'Create an issue in a project.',+ description:+ 'Create an issue in a project. Fails with 409 (code wip_limit_exceeded) ' ++ 'when the target column is at a hard WIP limit.',...mcpTool('create_issue'),},},@@ -498,7 +500,7 @@ export const issueRoutes = new Elysia({ name: 'issues', detail: { tags: ['Issues}),}),permission: ['work_items', 'edit'],- response: { 200: t.Object({ updated: t.Number() }), ...commonErrors },+ response: { 200: t.Object({ updated: t.Number() }), ...commonErrors, ...errors(409) },detail: { summary: 'Bulk update issues' },},)@@ -842,10 +844,12 @@ export const issueRoutes = new Elysia({ name: 'issues', detail: { tags: ['Issues}),params: issueParams,workItem: 'edit',- response: { 200: IssueResponse, ...commonErrors },+ response: { 200: IssueResponse, ...commonErrors, ...errors(409) },detail: {summary: 'Update an issue',- description: 'Update an issue by its numeric id.',+ description:+ 'Update an issue by its numeric id. Moving it into a column that is at a ' ++ 'hard WIP limit fails with 409 (code wip_limit_exceeded).',...mcpTool('update_issue'),},},diff --git a/apps/api/src/issues/store.ts b/apps/api/src/issues/store.tsindex 078590f6..52c587a4 100644--- a/apps/api/src/issues/store.ts+++ b/apps/api/src/issues/store.ts@@ -25,6 +25,7 @@ import {isNotNull,isNull,lte,+ ne,notInArray,or,sql,@@ -55,6 +56,7 @@ import { cycleStatus, getCycleRef, type CycleStatus } from '#modules/cycles/servimport { getMembership } from '../members/store';import { enqueueAgentRun } from '#modules/agents/core/run-queue';import { applySubtaskAutomation } from './automation';+import { assertWipLimit, wipLimitBreach } from '#modules/columns/service';// Data access for issues and their per-issue data: labels, custom field values,// and selected options. The human identifier (e.g. "MKT-42") is the project key@@ -805,6 +807,7 @@ export async function createIssue(await assertInitiative(project.id, input.initiativeId);await assertCycle(project.id, input.cycleId);await assertColumn(project.id, input.columnId);+ await assertWipLimit(input.columnId);await assertIssueType(project.id, input.typeId);await assertParent(project.id, null, input.parentId);// Also checked by setIssueLabels below, but here it fails before the issue exists.@@ -933,11 +936,16 @@ export interface IssuePatch {// issue still sits in that column, so an automation acting on a state it read// earlier cannot overwrite a concurrent move. A failed guard writes nothing and// returns the current row.+//+// opts.skipIfColumnFull does the same for a hard WIP limit: the move is dropped+// instead of throwing. Automations set it, because they run after the write that+// triggered them — a throw there would report a move that already succeeded as+// failed, and abort the rest of the batch the automation is working through.export async function updateIssue(id: number,patch: IssuePatch,actor?: ActivityActor,- opts?: { onlyIfColumnId?: number },+ opts?: { onlyIfColumnId?: number; skipIfColumnFull?: boolean },): Promise<IssueRow | null> {const before = await loadSnapshot(id);if (!before) return null;@@ -946,6 +954,13 @@ export async function updateIssue(await assertInitiative(before.projectId, patch.initiativeId);await assertCycle(before.projectId, patch.cycleId, before.cycleId);await assertColumn(before.projectId, patch.columnId);+ // Only a move into a different column consumes capacity, so re-saving an issue+ // that already sits in a full column is never refused.+ if (patch.columnId !== undefined && patch.columnId !== before.columnId) {+ const breach = await wipLimitBreach(patch.columnId);+ if (breach && !opts?.skipIfColumnFull) throw breach;+ if (breach) return getIssue(id);+ }await assertIssueType(before.projectId, patch.typeId);await assertParent(before.projectId, id, patch.parentId);@@ -1149,10 +1164,28 @@ export async function bulkUpdateIssues(actorUserId?: string | null,): Promise<number> {const valid = await issuesInProject(projectId, ids);+ // The whole batch is checked against the limit before any of it is written:+ // per-issue checks inside the loop would move issues until the column filled up+ // and then fail, leaving the move half-applied.+ if (patch.columnId !== undefined) {+ const incoming = await countEnteringColumn(valid, patch.columnId);+ if (incoming > 0) await assertWipLimit(patch.columnId, incoming);+ }for (const id of valid) await updateIssue(id, patch, actorUserId);return valid.length;}+// How many of the listed issues are not already in the target column — the ones a+// move would actually add to it.+async function countEnteringColumn(ids: number[], columnId: number): Promise<number> {+ if (ids.length === 0) return 0;+ const [{ count }] = await db+ .select({ count: sql<number>`count(*)::int` })+ .from(issue)+ .where(and(inArray(issue.id, ids), ne(issue.columnId, columnId)));+ return count;+}+// Adds the given labels to every listed issue, keeping each issue's existing// labels. An issue that already carries all of them is left untouched. Returns how// many issues changed.diff --git a/apps/api/src/modules/columns/__tests__/integration/wipLimits.test.ts b/apps/api/src/modules/columns/__tests__/integration/wipLimits.test.tsnew file mode 100644index 00000000..b24d44eb--- /dev/null+++ b/apps/api/src/modules/columns/__tests__/integration/wipLimits.test.ts@@ -0,0 +1,352 @@+import { describe, it, expect, beforeEach } from 'bun:test';+import { authedApi, type Api } from '#tests/helpers/app';+import { signUpTestUser } from '#tests/helpers/auth';+import { resetDb } from '#tests/helpers/db';++// Work-in-progress limits on a column. wipLimit is how many issues the column+// should hold and wipMode decides what happens at that number: 'soft' is advisory+// (the board renders a warning, nothing is refused) and 'hard' rejects an issue+// entering a full column with 409 / wip_limit_exceeded.+//+// Enforcement lives in the store, so every write path is covered by it: creating+// an issue, updating one, and the bulk update the board's multi-select uses.++async function setupProject() {+ const owner = await signUpTestUser();+ const asOwner = authedApi(owner.cookie);+ await asOwner.projects.post({ key: 'MKT', name: 'Marketing' });+ return { asOwner };+}++async function columnByName(client: Api, name: string) {+ const view = await client.projects({ projectKey: 'MKT' }).get();+ return view.data!.columns.find((c) => c.name === name)!;+}++function createIssue(client: Api, columnId: number, title = 'Task') {+ return client.projects({ projectKey: 'MKT' }).issues.post({ columnId, title });+}++// Fills a column with `n` issues while it has no limit, so the fixture itself is+// never refused by the rule under test.+async function fill(client: Api, columnId: number, n: number) {+ const ids: number[] = [];+ for (let i = 0; i < n; i++) {+ const res = await createIssue(client, columnId, `Task ${i + 1}`);+ ids.push(res.data!.id);+ }+ return ids;+}++function setLimit(+ client: Api,+ columnId: number,+ wipLimit: number | null,+ wipMode?: 'soft' | 'hard',+) {+ return client+ .projects({ projectKey: 'MKT' })+ .columns({ columnId })+ .patch({ wipLimit, ...(wipMode ? { wipMode } : {}) });+}++describe('column WIP limits', () => {+ beforeEach(async () => {+ await resetDb();+ });++ describe('configuration', () => {+ it('defaults to no limit in soft mode', async () => {+ const { asOwner } = await setupProject();++ const column = await columnByName(asOwner, 'In Progress');+ expect(column).toMatchObject({ wipLimit: null, wipMode: 'soft' });+ });++ it('sets and clears a limit', async () => {+ const { asOwner } = await setupProject();+ const column = await columnByName(asOwner, 'In Progress');++ const set = await setLimit(asOwner, column.id, 3, 'hard');+ expect(set.status).toBe(200);+ expect(set.data).toMatchObject({ wipLimit: 3, wipMode: 'hard' });++ const cleared = await setLimit(asOwner, column.id, null);+ expect(cleared.status).toBe(200);+ // Clearing the limit leaves the mode alone; it is only read when a limit is set.+ expect(cleared.data).toMatchObject({ wipLimit: null, wipMode: 'hard' });+ });++ it('accepts a limit on create', async () => {+ const { asOwner } = await setupProject();++ const created = await asOwner+ .projects({ projectKey: 'MKT' })+ .columns.post({ name: 'Review', stateType: 'started', wipLimit: 2, wipMode: 'hard' });+ expect(created.status).toBe(201);+ expect(created.data).toMatchObject({ wipLimit: 2, wipMode: 'hard' });+ });++ it('rejects a limit below one', async () => {+ const { asOwner } = await setupProject();+ const column = await columnByName(asOwner, 'In Progress');++ expect((await setLimit(asOwner, column.id, 0)).status).toBe(400);+ expect((await setLimit(asOwner, column.id, -1)).status).toBe(400);+ });++ it('rejects an unknown mode', async () => {+ const { asOwner } = await setupProject();+ const column = await columnByName(asOwner, 'In Progress');++ const res = await asOwner+ .projects({ projectKey: 'MKT' })+ .columns({ columnId: column.id })+ // @ts-expect-error the schema allows only 'soft' and 'hard'+ .patch({ wipMode: 'blocking' });+ expect(res.status).toBe(400);+ });++ it('survives a project copy', async () => {+ const { asOwner } = await setupProject();+ const column = await columnByName(asOwner, 'In Progress');+ await setLimit(asOwner, column.id, 4, 'hard');++ const copy = await asOwner+ .projects({ projectKey: 'MKT' })+ .copy.post({ key: 'COPY', name: 'Copy' });+ expect(copy.status).toBe(201);++ const view = await asOwner.projects({ projectKey: 'COPY' }).get();+ const copied = view.data!.columns.find((c) => c.name === 'In Progress')!;+ expect(copied).toMatchObject({ wipLimit: 4, wipMode: 'hard' });+ });+ });++ describe('soft mode', () => {+ it('allows a move past the limit', async () => {+ const { asOwner } = await setupProject();+ const todo = await columnByName(asOwner, 'Todo');+ const progress = await columnByName(asOwner, 'In Progress');+ await fill(asOwner, progress.id, 2);+ await setLimit(asOwner, progress.id, 2, 'soft');+ const spare = (await createIssue(asOwner, todo.id)).data!;++ const moved = await asOwner.issues({ issueId: spare.id }).patch({ columnId: progress.id });+ expect(moved.status).toBe(200);+ expect(moved.data?.columnId).toBe(progress.id);+ });++ it('allows creating an issue past the limit', async () => {+ const { asOwner } = await setupProject();+ const progress = await columnByName(asOwner, 'In Progress');+ await fill(asOwner, progress.id, 1);+ await setLimit(asOwner, progress.id, 1, 'soft');++ expect((await createIssue(asOwner, progress.id)).status).toBe(201);+ });+ });++ describe('hard mode', () => {+ it('refuses a move into a full column with a machine-readable code', async () => {+ const { asOwner } = await setupProject();+ const todo = await columnByName(asOwner, 'Todo');+ const progress = await columnByName(asOwner, 'In Progress');+ await fill(asOwner, progress.id, 2);+ await setLimit(asOwner, progress.id, 2, 'hard');+ const spare = (await createIssue(asOwner, todo.id)).data!;++ const moved = await asOwner.issues({ issueId: spare.id }).patch({ columnId: progress.id });+ expect(moved.status).toBe(409);+ expect(moved.error?.value).toMatchObject({ code: 'wip_limit_exceeded' });+ expect((moved.error?.value as { error: string }).error).toContain('In Progress');++ // The refused move wrote nothing.+ const after = await asOwner.issues({ issueId: spare.id }).get();+ expect(after.data?.columnId).toBe(todo.id);+ });++ it('allows a move while the column is still under the limit', async () => {+ const { asOwner } = await setupProject();+ const todo = await columnByName(asOwner, 'Todo');+ const progress = await columnByName(asOwner, 'In Progress');+ await fill(asOwner, progress.id, 1);+ await setLimit(asOwner, progress.id, 2, 'hard');+ const spare = (await createIssue(asOwner, todo.id)).data!;++ expect(+ (await asOwner.issues({ issueId: spare.id }).patch({ columnId: progress.id })).status,+ ).toBe(200);+ });++ it('refuses creating an issue in a full column', async () => {+ const { asOwner } = await setupProject();+ const progress = await columnByName(asOwner, 'In Progress');+ await fill(asOwner, progress.id, 1);+ await setLimit(asOwner, progress.id, 1, 'hard');++ const res = await createIssue(asOwner, progress.id);+ expect(res.status).toBe(409);+ expect(res.error?.value).toMatchObject({ code: 'wip_limit_exceeded' });+ });++ it('still allows editing an issue already in a full column', async () => {+ const { asOwner } = await setupProject();+ const progress = await columnByName(asOwner, 'In Progress');+ const [first] = await fill(asOwner, progress.id, 2);+ await setLimit(asOwner, progress.id, 2, 'hard');++ // A patch that does not move the issue is not an entry into the column.+ const renamed = await asOwner.issues({ issueId: first }).patch({ title: 'Renamed' });+ expect(renamed.status).toBe(200);++ // Nor is one that names the column the issue already sits in.+ const resaved = await asOwner.issues({ issueId: first }).patch({ columnId: progress.id });+ expect(resaved.status).toBe(200);+ });++ it('lets an over-capacity column drain but takes nothing new', async () => {+ const { asOwner } = await setupProject();+ const todo = await columnByName(asOwner, 'Todo');+ const progress = await columnByName(asOwner, 'In Progress');+ const ids = await fill(asOwner, progress.id, 3);++ // Lowering the limit under the current count is allowed and keeps the issues.+ const lowered = await setLimit(asOwner, progress.id, 2, 'hard');+ expect(lowered.status).toBe(200);+ const spare = (await createIssue(asOwner, todo.id)).data!;+ expect(+ (await asOwner.issues({ issueId: spare.id }).patch({ columnId: progress.id })).status,+ ).toBe(409);++ // Moving one out leaves 2, still not under the limit of 2.+ await asOwner.issues({ issueId: ids[0] }).patch({ columnId: todo.id });+ expect(+ (await asOwner.issues({ issueId: spare.id }).patch({ columnId: progress.id })).status,+ ).toBe(409);++ // One more out leaves room for exactly one.+ await asOwner.issues({ issueId: ids[1] }).patch({ columnId: todo.id });+ expect(+ (await asOwner.issues({ issueId: spare.id }).patch({ columnId: progress.id })).status,+ ).toBe(200);+ });++ it('ignores archived issues when counting the column', async () => {+ const { asOwner } = await setupProject();+ const todo = await columnByName(asOwner, 'Todo');+ const progress = await columnByName(asOwner, 'In Progress');+ const [first] = await fill(asOwner, progress.id, 2);+ await setLimit(asOwner, progress.id, 2, 'hard');+ await asOwner.issues({ issueId: first }).archive.post();+ const spare = (await createIssue(asOwner, todo.id)).data!;++ // An archived issue is off the board, so it no longer occupies the column.+ expect(+ (await asOwner.issues({ issueId: spare.id }).patch({ columnId: progress.id })).status,+ ).toBe(200);+ });+ });++ describe('automation', () => {+ // Subtask automation runs after the write that set it off. A hard limit must not+ // turn a move that already succeeded into a failed request, so the automation+ // leaves the issue where it is instead.+ it('leaves a subtask put rather than failing the parent move', async () => {+ const { asOwner } = await setupProject();+ const todo = await columnByName(asOwner, 'Todo');+ const done = await columnByName(asOwner, 'Done');+ await asOwner+ .projects({ projectKey: 'MKT' })+ .settings.subtasks.patch({ completeParent: false, closeSubtasks: true });++ const parent = (await createIssue(asOwner, todo.id, 'Parent')).data!;+ const sub = await asOwner+ .projects({ projectKey: 'MKT' })+ .issues.post({ columnId: todo.id, title: 'Sub', parentId: parent.id });+ // Room for the parent and nothing else.+ await fill(asOwner, done.id, 1);+ await setLimit(asOwner, done.id, 2, 'hard');++ const moved = await asOwner.issues({ issueId: parent.id }).patch({ columnId: done.id });+ expect(moved.status).toBe(200);+ expect(moved.data?.columnId).toBe(done.id);++ const after = await asOwner.issues({ issueId: sub.data!.id }).get();+ expect(after.data?.columnId).toBe(todo.id);+ });++ it('still moves the subtask when the column has room', async () => {+ const { asOwner } = await setupProject();+ const todo = await columnByName(asOwner, 'Todo');+ const done = await columnByName(asOwner, 'Done');+ await asOwner+ .projects({ projectKey: 'MKT' })+ .settings.subtasks.patch({ completeParent: false, closeSubtasks: true });++ const parent = (await createIssue(asOwner, todo.id, 'Parent')).data!;+ const sub = await asOwner+ .projects({ projectKey: 'MKT' })+ .issues.post({ columnId: todo.id, title: 'Sub', parentId: parent.id });+ await setLimit(asOwner, done.id, 2, 'hard');++ await asOwner.issues({ issueId: parent.id }).patch({ columnId: done.id });++ const after = await asOwner.issues({ issueId: sub.data!.id }).get();+ expect(after.data?.columnId).toBe(done.id);+ });+ });++ describe('bulk update', () => {+ it('refuses the whole batch when it would breach the limit', async () => {+ const { asOwner } = await setupProject();+ const todo = await columnByName(asOwner, 'Todo');+ const progress = await columnByName(asOwner, 'In Progress');+ await fill(asOwner, progress.id, 1);+ await setLimit(asOwner, progress.id, 3, 'hard');+ const ids = await fill(asOwner, todo.id, 3);++ // Room for two, moving three: the batch is checked before anything is written,+ // so no issue moves rather than two moving and the third failing.+ const res = await asOwner+ .projects({ projectKey: 'MKT' })+ .issues.bulk.patch({ ids, patch: { columnId: progress.id } });+ expect(res.status).toBe(409);+ expect(res.error?.value).toMatchObject({ code: 'wip_limit_exceeded' });++ for (const id of ids) {+ const issue = await asOwner.issues({ issueId: id }).get();+ expect(issue.data?.columnId).toBe(todo.id);+ }+ });++ it('moves a batch that exactly fills the column', async () => {+ const { asOwner } = await setupProject();+ const todo = await columnByName(asOwner, 'Todo');+ const progress = await columnByName(asOwner, 'In Progress');+ await setLimit(asOwner, progress.id, 3, 'hard');+ const ids = await fill(asOwner, todo.id, 3);++ const res = await asOwner+ .projects({ projectKey: 'MKT' })+ .issues.bulk.patch({ ids, patch: { columnId: progress.id } });+ expect(res.status).toBe(200);+ expect(res.data).toMatchObject({ updated: 3 });+ });++ it('counts only the issues the move would add to the column', async () => {+ const { asOwner } = await setupProject();+ const todo = await columnByName(asOwner, 'Todo');+ const progress = await columnByName(asOwner, 'In Progress');+ const already = await fill(asOwner, progress.id, 2);+ await setLimit(asOwner, progress.id, 3, 'hard');+ const [incoming] = await fill(asOwner, todo.id, 1);++ // Two of the three are already there, so the batch adds one and fits.+ const res = await asOwner+ .projects({ projectKey: 'MKT' })+ .issues.bulk.patch({ ids: [...already, incoming], patch: { columnId: progress.id } });+ expect(res.status).toBe(200);+ });+ });+});diff --git a/apps/api/src/modules/columns/index.ts b/apps/api/src/modules/columns/index.tsindex a08a2dff..1940256a 100644--- a/apps/api/src/modules/columns/index.ts+++ b/apps/api/src/modules/columns/index.ts@@ -74,7 +74,8 @@ export const columnRoutes = new Elysia({ name: 'columns', detail: { tags: ['Coluresponse: { 200: ColumnResponse, ...commonErrors },detail: {summary: 'Update a column',- description: "Update a column's name, stateType, or color.",+ description:+ "Update a column's name, stateType, color, or its WIP limit " + '(wipLimit / wipMode).',...mcpTool('update_column'),},},diff --git a/apps/api/src/modules/columns/model.ts b/apps/api/src/modules/columns/model.tsindex daafa3bd..e15cd14d 100644--- a/apps/api/src/modules/columns/model.ts+++ b/apps/api/src/modules/columns/model.ts@@ -17,6 +17,8 @@ export const ColumnResponse = t.Object({stateType: t.String(),color: t.String(),position: t.Number(),+ wipLimit: t.Union([t.Number(), t.Null()]),+ wipMode: t.String(),});export const ColumnListResponse = t.Array(ColumnResponse);@@ -25,6 +27,23 @@ export const createColumnBody = t.Object({name: t.String({ minLength: 1 }),stateType,color: t.Optional(t.String()),+ wipLimit: t.Optional(+ t.Nullable(+ t.Integer({+ minimum: 1,+ description:+ 'How many issues this column should hold. null for no limit. ' ++ 'Enforced only when wipMode is "hard".',+ }),+ ),+ ),+ wipMode: t.Optional(+ t.Union([t.Literal('soft'), t.Literal('hard')], {+ description:+ 'What happens at wipLimit: "soft" only warns on the board, ' ++ '"hard" refuses an issue entering a full column with a 409.',+ }),+ ),});export const updateColumnBody = t.Partial(createColumnBody);diff --git a/apps/api/src/modules/columns/service.ts b/apps/api/src/modules/columns/service.tsindex 9237980c..373862f8 100644--- a/apps/api/src/modules/columns/service.ts+++ b/apps/api/src/modules/columns/service.ts@@ -1,5 +1,5 @@import { db, projectColumn, issue, issueLabel, issueFieldValue, issueFieldOption } from '@repo/db';-import { and, eq, inArray, sql } from 'drizzle-orm';+import { and, eq, inArray, isNull, sql } from 'drizzle-orm';import { HttpError } from '#shared/lib';import { recordActivityForIssues } from '../../issues/activity';@@ -10,6 +10,8 @@ export interface ColumnRow {stateType: string;color: string;position: number;+ wipLimit: number | null;+ wipMode: string;}function mapColumn(row: typeof projectColumn.$inferSelect): ColumnRow {@@ -20,9 +22,59 @@ function mapColumn(row: typeof projectColumn.$inferSelect): ColumnRow {stateType: row.stateType,color: row.color,position: row.position,+ wipLimit: row.wipLimit,+ wipMode: row.wipMode,};}+export const WIP_LIMIT_EXCEEDED = 'wip_limit_exceeded';++// The error for `incoming` issues entering a column that is at its work-in-progress+// limit, or null when they fit. Only an enforced limit ('hard') refuses; a soft one+// just drives the board's warning treatment. `incoming` is how many issues the write+// carries — a board drag can move a whole selection at once.+//+// Returned rather than thrown because the callers differ: a write a user asked for+// fails with it, while an automation moving issues on its own (subtask rules, a+// merged pull request) leaves the issue where it is instead of failing the action+// that set it off.+//+// The count and the write are separate statements, so two simultaneous moves can+// both pass and leave the column one over. That is left as is: a column over its+// limit is a state the board already has to render (a limit lowered under the+// current count does the same), and locking the column on every drag would cost+// more than the overshoot.+export async function wipLimitBreach(columnId: number, incoming = 1): Promise<HttpError | null> {+ const [column] = await db+ .select({+ name: projectColumn.name,+ limit: projectColumn.wipLimit,+ mode: projectColumn.wipMode,+ })+ .from(projectColumn)+ .where(eq(projectColumn.id, columnId));+ if (!column || column.limit == null || column.mode !== 'hard') return null;++ // Archived issues are off the board, so they do not occupy the column.+ const [{ count }] = await db+ .select({ count: sql<number>`count(*)::int` })+ .from(issue)+ .where(and(eq(issue.columnId, columnId), isNull(issue.archivedAt)));+ if (count + incoming <= column.limit) return null;++ return new HttpError(+ 409,+ `Column "${column.name}" is at its WIP limit of ${column.limit}`,+ WIP_LIMIT_EXCEEDED,+ );+}++// The same check for a write that must fail rather than skip.+export async function assertWipLimit(columnId: number, incoming = 1): Promise<void> {+ const breach = await wipLimitBreach(columnId, incoming);+ if (breach) throw breach;+}+// The work items view's left-to-right order: sorting by state type before position// keeps a newly added column next to the others of its type rather than at the end.const STATE_TYPE_ORDER = sql`CASE ${projectColumn.stateType}@@ -48,6 +100,8 @@ export async function createColumn(input: {name: string;stateType: string;color?: string;+ wipLimit?: number | null;+ wipMode?: string;}): Promise<ColumnRow> {const [{ pos }] = await db.select({ pos: sql<number>`COALESCE(MAX(${projectColumn.position}), -1) + 1` })@@ -61,6 +115,8 @@ export async function createColumn(input: {stateType: input.stateType,color: input.color ?? '#6b7280',position: Number(pos),+ wipLimit: input.wipLimit ?? null,+ wipMode: input.wipMode ?? 'soft',}).returning();return mapColumn(row);@@ -76,13 +132,22 @@ async function getColumnById(id: number): Promise<ColumnRow | null> {export async function updateColumn(id: number,projectId: number,- patch: { name?: string; color?: string; stateType?: string },+ patch: {+ name?: string;+ color?: string;+ stateType?: string;+ // null clears the limit; absent leaves it as it is.+ wipLimit?: number | null;+ wipMode?: string;+ },): Promise<ColumnRow | null> {const scope = and(eq(projectColumn.id, id), eq(projectColumn.projectId, projectId));const set: Partial<typeof projectColumn.$inferInsert> = {};if (patch.name !== undefined) set.name = patch.name;if (patch.color !== undefined) set.color = patch.color;if (patch.stateType !== undefined) set.stateType = patch.stateType;+ if (patch.wipLimit !== undefined) set.wipLimit = patch.wipLimit;+ if (patch.wipMode !== undefined) set.wipMode = patch.wipMode;if (Object.keys(set).length === 0) {const rows = await db.select().from(projectColumn).where(scope);return rows[0] ? mapColumn(rows[0]) : null;diff --git a/apps/api/src/modules/github/handler.ts b/apps/api/src/modules/github/handler.tsindex 3a0af6c9..229c9266 100644--- a/apps/api/src/modules/github/handler.ts+++ b/apps/api/src/modules/github/handler.ts@@ -67,7 +67,9 @@ export async function handlePullRequestEvent(const stateType = (await columnStateTypes([issue.columnId])).get(issue.columnId);if (stateType && CLOSED_STATE_TYPES.includes(stateType)) continue;await recordActivity(issue.id, [prEntry('merged')], GITHUB_ACTOR);- await updateIssue(issue.id, { columnId: targetId }, GITHUB_ACTOR);+ await updateIssue(issue.id, { columnId: targetId }, GITHUB_ACTOR, {+ skipIfColumnFull: true,+ });}return 'merged';}@@ -86,6 +88,7 @@ export async function handlePullRequestEvent(if (stateType === 'backlog' || stateType === 'unstarted')await updateIssue(issue.id, { columnId: targetId }, GITHUB_ACTOR, {onlyIfColumnId: issue.columnId,+ skipIfColumnFull: true,});}return 'opened';diff --git a/apps/api/src/planner.ts b/apps/api/src/planner.tsindex efe7582f..53c467ff 100644--- a/apps/api/src/planner.ts+++ b/apps/api/src/planner.ts@@ -52,7 +52,7 @@ export const planner = new Elysia({ name: 'planner' }).onError({ as: 'global' }, ({ code, error, set }) => {if (error instanceof HttpError) {set.status = error.status;- return { error: error.message };+ return error.code ? { error: error.message, code: error.code } : { error: error.message };}if (code === 'VALIDATION') {set.status = 400;diff --git a/apps/api/src/projects/copy.ts b/apps/api/src/projects/copy.tsindex 01b6f913..46c97860 100644--- a/apps/api/src/projects/copy.ts+++ b/apps/api/src/projects/copy.ts@@ -362,6 +362,8 @@ export async function copyProject(stateType: col.stateType,color: col.color,position: col.position,+ wipLimit: col.wipLimit,+ wipMode: col.wipMode,}).returning({ id: projectColumn.id });maps.column.set(col.id, created.id);diff --git a/apps/api/src/shared/lib.ts b/apps/api/src/shared/lib.tsindex 6ca88020..6a04279b 100644--- a/apps/api/src/shared/lib.ts+++ b/apps/api/src/shared/lib.ts@@ -4,10 +4,15 @@// An error carrying an HTTP status. Thrown from stores and routes; the planner// plugin's onError maps it to a { error } JSON response with that status.+//+// `code` names the failure for a caller that has to branch on it rather than show+// the message — an agent moving issues without a human watching. Most failures+// leave it unset: the status and the message are enough to render.export class HttpError extends Error {constructor(public status: number,message: string,+ public code?: string,) {super(message);}diff --git a/apps/api/src/shared/responses.ts b/apps/api/src/shared/responses.tsindex 544cc6f9..cc79f513 100644--- a/apps/api/src/shared/responses.ts+++ b/apps/api/src/shared/responses.ts@@ -5,7 +5,8 @@ import { t } from 'elysia';// validation rejection, 404 for NOT_FOUND, 409 for a unique_violation, 500// otherwise). Referenced by each route's `response` map so the OpenAPI docs// describe the error bodies alongside the success shape.-export const ErrorResponse = t.Object({ error: t.String() });+// `code` is present only on the failures that name themselves (see HttpError).+export const ErrorResponse = t.Object({ error: t.String(), code: t.Optional(t.String()) });// Maps the statuses a route can fail with to that one body. A route lists only// the codes it produces; spread the result into `response` next to the successdiff --git a/apps/web/messages/en/settings.json b/apps/web/messages/en/settings.jsonindex d3bbfb56..74dfd6c3 100644--- a/apps/web/messages/en/settings.json+++ b/apps/web/messages/en/settings.json@@ -373,7 +373,19 @@"importTitle": "Apply states from clipboard","importSummary": "{count, plural, one {# state} other {# states}} will be applied. A matching state keeps its group; only its color is updated.","importApply": "{count, plural, one {Apply # state} other {Apply # states}}",- "imported": "Applied states: {created} created, {updated} updated."+ "imported": "Applied states: {created} created, {updated} updated.",+ "wip": {+ "label": "Work-in-progress limit",+ "none": "No limit",+ "help": "How many issues this state should hold. The board shows the count against it.",+ "modeLabel": "At the limit",+ "softLabel": "Warn",+ "softHelp": "The board marks the state as full. Issues can still be moved into it.",+ "hardLabel": "Block",+ "hardHelp": "Issues cannot be moved into the state while it is full, from anywhere.",+ "badgeSoft": "max {limit}",+ "badgeHard": "max {limit}, enforced"+ }},"issueTypes": {"add": "Add type",diff --git a/apps/web/messages/en/workItems.json b/apps/web/messages/en/workItems.jsonindex 4d5de60d..09de1b63 100644--- a/apps/web/messages/en/workItems.json+++ b/apps/web/messages/en/workItems.json@@ -16,6 +16,13 @@"updatedOn": "Updated {date}","subtasksProgress": "Subtasks {done}/{total}","subtasksDone": "{done} of {total} subtasks done",+ "wip": {+ "reached": "{column} is at its limit of {limit} issues.",+ "tooltip": "Work-in-progress limit: {max}",+ "count": "{count} / {max}",+ "filteredCount": "{shown} of {total} / {max}",+ "filteredTooltip": "{shown} shown by the current filters. The limit of {max} counts all {total} issues in the column."+ },"columns": {"title": "Title","status": "State",diff --git a/apps/web/messages/ru/settings.json b/apps/web/messages/ru/settings.jsonindex c3f7f513..16d0f734 100644--- a/apps/web/messages/ru/settings.json+++ b/apps/web/messages/ru/settings.json@@ -373,7 +373,19 @@"importTitle": "Применить статусы из буфера обмена","importSummary": "Будет применено {count, plural, one {# статус} few {# статуса} many {# статусов} other {# статуса}}. Совпавший статус сохраняет свою группу; обновляется только цвет.","importApply": "{count, plural, one {Применить # статус} few {Применить # статуса} many {Применить # статусов} other {Применить # статуса}}",- "imported": "Применены статусы: {created} создано, {updated} обновлено."+ "imported": "Применены статусы: {created} создано, {updated} обновлено.",+ "wip": {+ "label": "Лимит задач в работе",+ "none": "Без лимита",+ "help": "Сколько задач должно быть в этом статусе. На доске количество показывается рядом с лимитом.",+ "modeLabel": "При достижении лимита",+ "softLabel": "Предупреждать",+ "softHelp": "Доска отмечает статус как заполненный. Задачи по-прежнему можно в него переносить.",+ "hardLabel": "Блокировать",+ "hardHelp": "Пока статус заполнен, задачи нельзя перенести в него ниоткуда.",+ "badgeSoft": "макс. {limit}",+ "badgeHard": "макс. {limit}, обязательно"+ }},"issueTypes": {"add": "Добавить тип",diff --git a/apps/web/messages/ru/workItems.json b/apps/web/messages/ru/workItems.jsonindex 549f13e4..3a0fb3af 100644--- a/apps/web/messages/ru/workItems.json+++ b/apps/web/messages/ru/workItems.json@@ -16,6 +16,13 @@"updatedOn": "Обновлено {date}","subtasksProgress": "Подзадачи {done}/{total}","subtasksDone": "Выполнено {done} из {total} подзадач",+ "wip": {+ "reached": "Статус «{column}» достиг предела в {limit} задач.",+ "tooltip": "Лимит задач в работе: {max}",+ "count": "{count} / {max}",+ "filteredCount": "{shown} из {total} / {max}",+ "filteredTooltip": "Текущие фильтры показывают {shown}. Лимит {max} считает все {total} задач в колонке."+ },"columns": {"title": "Название","status": "Статус",diff --git a/apps/web/messages/uk/settings.json b/apps/web/messages/uk/settings.jsonindex c653b9ab..5fbf7003 100644--- a/apps/web/messages/uk/settings.json+++ b/apps/web/messages/uk/settings.json@@ -373,7 +373,19 @@"importTitle": "Застосувати статуси з буфера обміну","importSummary": "Буде застосовано {count, plural, one {# статус} few {# статуси} many {# статусів} other {# статусів}}. Статус, що збігся, залишає свою групу; оновлюється лише колір.","importApply": "{count, plural, one {Застосувати # статус} few {Застосувати # статуси} many {Застосувати # статусів} other {Застосувати # статусів}}",- "imported": "Застосовано статуси: {created} створено, {updated} оновлено."+ "imported": "Застосовано статуси: {created} створено, {updated} оновлено.",+ "wip": {+ "label": "Ліміт задач у роботі",+ "none": "Без ліміту",+ "help": "Скільки задач має бути в цьому статусі. На дошці кількість показується поряд з лімітом.",+ "modeLabel": "При досягненні ліміту",+ "softLabel": "Попереджати",+ "softHelp": "Дошка позначає статус як заповнений. Задачі все одно можна до нього переносити.",+ "hardLabel": "Блокувати",+ "hardHelp": "Поки статус заповнений, задачі не можна перенести до нього звідусіль.",+ "badgeSoft": "макс. {limit}",+ "badgeHard": "макс. {limit}, обов'язково"+ }},"issueTypes": {"add": "Додати тип",diff --git a/apps/web/messages/uk/workItems.json b/apps/web/messages/uk/workItems.jsonindex 77528315..46df519b 100644--- a/apps/web/messages/uk/workItems.json+++ b/apps/web/messages/uk/workItems.json@@ -16,6 +16,13 @@"updatedOn": "Оновлено {date}","subtasksProgress": "Підзадачі {done}/{total}","subtasksDone": "Виконано {done} з {total} підзадач",+ "wip": {+ "reached": "Статус «{column}» досяг межі в {limit} задач.",+ "tooltip": "Ліміт задач у роботі: {max}",+ "count": "{count} / {max}",+ "filteredCount": "{shown} з {total} / {max}",+ "filteredTooltip": "Поточні фільтри показують {shown}. Ліміт {max} рахує всі {total} задач у колонці."+ },"columns": {"title": "Назва","status": "Статус",diff --git a/apps/web/messages/zh-CN/settings.json b/apps/web/messages/zh-CN/settings.jsonindex b2db3d34..9973982d 100644--- a/apps/web/messages/zh-CN/settings.json+++ b/apps/web/messages/zh-CN/settings.json@@ -373,7 +373,19 @@"importTitle": "从剪贴板应用状态","importSummary": "将应用 {count, plural, other {# 个状态}}。匹配的状态保留分组,只更新颜色。","importApply": "{count, plural, other {应用 # 个状态}}",- "imported": "已应用状态:新建 {created} 个,更新 {updated} 个。"+ "imported": "已应用状态:新建 {created} 个,更新 {updated} 个。",+ "wip": {+ "label": "在制品上限",+ "none": "不限制",+ "help": "该状态应容纳多少个工作项。看板会显示数量与上限的对比。",+ "modeLabel": "达到上限时",+ "softLabel": "提醒",+ "softHelp": "看板会将该状态标记为已满,但仍可将工作项移入。",+ "hardLabel": "阻止",+ "hardHelp": "该状态已满时,任何入口都无法将工作项移入。",+ "badgeSoft": "上限 {limit}",+ "badgeHard": "上限 {limit},强制"+ }},"issueTypes": {"add": "添加类型",diff --git a/apps/web/messages/zh-CN/workItems.json b/apps/web/messages/zh-CN/workItems.jsonindex ba70f60e..36f890bd 100644--- a/apps/web/messages/zh-CN/workItems.json+++ b/apps/web/messages/zh-CN/workItems.json@@ -16,6 +16,13 @@"updatedOn": "更新于 {date}","subtasksProgress": "子任务 {done}/{total}","subtasksDone": "已完成 {done}/{total} 个子任务",+ "wip": {+ "reached": "「{column}」已达到 {limit} 个工作项的上限。",+ "tooltip": "在制品上限:{max}",+ "count": "{count} / {max}",+ "filteredCount": "{shown}/{total} / {max}",+ "filteredTooltip": "当前筛选显示 {shown} 个。上限 {max} 计入该列的全部 {total} 个工作项。"+ },"columns": {"title": "标题","status": "状态",diff --git a/apps/web/src/app/globals.css b/apps/web/src/app/globals.cssindex e9b13e95..9fc610c4 100644--- a/apps/web/src/app/globals.css+++ b/apps/web/src/app/globals.css@@ -28,6 +28,7 @@--color-input: var(--input);--color-border: var(--border);--color-destructive: var(--destructive);+ --color-warning: var(--warning);--color-accent-foreground: var(--accent-foreground);--color-accent: var(--accent);--color-muted-foreground: var(--muted-foreground);@@ -84,6 +85,7 @@--accent: oklch(0.955 0 0);--accent-foreground: oklch(0.22 0 0);--destructive: oklch(0.505 0.21 27);+ --warning: oklch(0.56 0.13 75);--border: oklch(0.905 0 0);--input: oklch(0.88 0 0);--ring: oklch(0.62 0 0);@@ -133,6 +135,7 @@--accent: oklch(0.3 0 0);--accent-foreground: oklch(0.965 0 0);--destructive: oklch(0.77 0.18 22);+ --warning: oklch(0.82 0.14 80);--border: oklch(1 0 0 / 12%);--input: oklch(1 0 0 / 18%);--ring: oklch(0.62 0 0);diff --git a/apps/web/src/features/cycles/components/detail/CycleIssuesBoard.tsx b/apps/web/src/features/cycles/components/detail/CycleIssuesBoard.tsxindex 90ecf5c4..973c60d9 100644--- a/apps/web/src/features/cycles/components/detail/CycleIssuesBoard.tsx+++ b/apps/web/src/features/cycles/components/detail/CycleIssuesBoard.tsx@@ -4,6 +4,7 @@ import { useMemo } from 'react';import type { Cycle } from '@/lib/api';import { useShell } from '@/context/shellContext';import { applyFilters } from '@/utils/filters';+import { countIssuesByColumn } from '@/features/work-items/utils/wipLimit';import { useLocalBoardSettings } from '@/hooks/useLocalBoardSettings';import FilterBar from '@/components/layout/FilterBar';import DisplayPopover from '@/components/layout/DisplayPopover';@@ -36,6 +37,9 @@ export default function CycleIssuesBoard({ cycle }: { cycle: Cycle }) {const viewProps = {project: viewProject,filters: board.filters,+ // Counted across the whole project, not just this cycle: the limit belongs to+ // the column, and its other issues occupy it just the same.+ columnCounts: countIssuesByColumn(project.issues),customFields,settings: board.settings,onSettingsChange: board.changeSettings,diff --git a/apps/web/src/features/initiatives/components/detail/InitiativeIssuesBoard.tsx b/apps/web/src/features/initiatives/components/detail/InitiativeIssuesBoard.tsxindex 1233177a..ff8691ed 100644--- a/apps/web/src/features/initiatives/components/detail/InitiativeIssuesBoard.tsx+++ b/apps/web/src/features/initiatives/components/detail/InitiativeIssuesBoard.tsx@@ -3,6 +3,7 @@import { useMemo } from 'react';import { useShell } from '@/context/shellContext';import { applyFilters } from '@/utils/filters';+import { countIssuesByColumn } from '@/features/work-items/utils/wipLimit';import FilterBar from '@/components/layout/FilterBar';import DisplayPopover from '@/components/layout/DisplayPopover';import KanbanBoard from '@/features/work-items/components/kanban/KanbanBoard';@@ -33,6 +34,9 @@ export default function InitiativeIssuesBoard({ initiativeId }: { initiativeId:const viewProps = {project: viewProject,filters: board.filters,+ // Counted across the whole project, not just this initiative: the limit belongs+ // to the column, and its other issues occupy it just the same.+ columnCounts: countIssuesByColumn(project.issues),customFields,settings: board.settings,onSettingsChange: board.changeSettings,diff --git a/apps/web/src/features/settings/components/crud/SettingsWipLimitField.tsx b/apps/web/src/features/settings/components/crud/SettingsWipLimitField.tsxnew file mode 100644index 00000000..a60d3eef--- /dev/null+++ b/apps/web/src/features/settings/components/crud/SettingsWipLimitField.tsx@@ -0,0 +1,92 @@+import { useState } from 'react';+import { useTranslations } from 'next-intl';+import { Gauge } from 'lucide-react';+import { type WipMode } from '@/lib/api';+import { cn } from '@/lib/utils';+import { Button } from '@/components/ui/button';+import { Input } from '@/components/ui/input';+import { Label } from '@/components/ui/label';+import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';+import {+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+} from '@/components/ui/select';++// A state's work-in-progress limit, edited behind a small trigger so the row keeps+// its shape. The mode only matters once a limit is set, so it appears with one.+export default function SettingsWipLimitField({+ limit,+ mode,+ onChange,+}: {+ limit: number | null;+ mode: WipMode;+ onChange: (limit: number | null, mode: WipMode) => void;+}) {+ const t = useTranslations('settings.states.wip');+ const [open, setOpen] = useState(false);++ // An empty or unparseable box clears the limit; the API rejects anything below 1.+ function changeLimit(raw: string) {+ const next = Number.parseInt(raw, 10);+ onChange(Number.isFinite(next) && next > 0 ? next : null, mode);+ }++ return (+ <Popover open={open} onOpenChange={setOpen}>+ <PopoverTrigger asChild>+ <Button+ type="button"+ variant="ghost"+ size="sm"+ title={t('label')}+ className={cn(+ 'h-7 shrink-0 gap-1.5 px-2 text-muted-foreground',+ limit != null && 'text-foreground',+ )}+ >+ <Gauge className="size-4" />+ {limit != null && <span className="text-xs tabular-nums">{limit}</span>}+ </Button>+ </PopoverTrigger>+ <PopoverContent align="end" className="w-64 space-y-3">+ <div className="space-y-1.5">+ <Label htmlFor="wip-limit" className="text-xs">+ {t('label')}+ </Label>+ <Input+ id="wip-limit"+ type="number"+ min={1}+ value={limit ?? ''}+ placeholder={t('none')}+ onChange={(e) => changeLimit(e.target.value)}+ className="h-8"+ />+ <p className="text-xs text-muted-foreground">{t('help')}</p>+ </div>++ {limit != null && (+ <div className="space-y-1.5">+ <Label className="text-xs">{t('modeLabel')}</Label>+ <Select value={mode} onValueChange={(next) => onChange(limit, next as WipMode)}>+ <SelectTrigger className="h-8 w-full">+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ <SelectItem value="soft">{t('softLabel')}</SelectItem>+ <SelectItem value="hard">{t('hardLabel')}</SelectItem>+ </SelectContent>+ </Select>+ <p className="text-xs text-muted-foreground">+ {mode === 'hard' ? t('hardHelp') : t('softHelp')}+ </p>+ </div>+ )}+ </PopoverContent>+ </Popover>+ );+}diff --git a/apps/web/src/features/settings/components/states/SettingsStateRow.tsx b/apps/web/src/features/settings/components/states/SettingsStateRow.tsxindex a83b5e4e..368bb1ed 100644--- a/apps/web/src/features/settings/components/states/SettingsStateRow.tsx+++ b/apps/web/src/features/settings/components/states/SettingsStateRow.tsx@@ -57,6 +57,13 @@ export function SettingsStateRow({<ItemContent><ItemTitle>{column.name}</ItemTitle></ItemContent>+ {column.wipLimit != null && (+ <span className="shrink-0 text-xs text-muted-foreground tabular-nums">+ {column.wipMode === 'hard'+ ? t('wip.badgeHard', { limit: column.wipLimit })+ : t('wip.badgeSoft', { limit: column.wipLimit })}+ </span>+ )}<ItemActions className="opacity-0 group-hover/item:opacity-100">{canEdit && (<Buttondiff --git a/apps/web/src/features/settings/components/states/SettingsStates.tsx b/apps/web/src/features/settings/components/states/SettingsStates.tsxindex 1996c53e..7a14174f 100644--- a/apps/web/src/features/settings/components/states/SettingsStates.tsx+++ b/apps/web/src/features/settings/components/states/SettingsStates.tsx@@ -3,7 +3,7 @@ import { closestCenter, DndContext, type DragEndEvent } from '@dnd-kit/core';import { SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable';import { Plus } from 'lucide-react';import { useTranslations } from 'next-intl';-import { type Column, type ProjectDetail, type StateType } from '@/lib/api';+import { type Column, type ProjectDetail, type StateType, type WipMode } from '@/lib/api';import { useDndSensors } from '@/lib/dnd';import { STATE_TYPES } from '@/utils/fieldOptions';import { DEFAULT_COLOR } from '@/utils/project';@@ -12,6 +12,7 @@ import { ItemGroup } from '@/components/ui/item';import SettingsColorField from '../crud/SettingsColorField';import { SettingsEmpty } from '../crud/SettingsEmpty';import { SettingsInlineEditForm } from '../crud/SettingsInlineEditForm';+import SettingsWipLimitField from '../crud/SettingsWipLimitField';import { useSettingsCan } from '../../context/settingsPermission';import {useCreateColumn,@@ -30,6 +31,10 @@ export default function SettingsStates({ project }: { project: ProjectDetail })const [editingId, setEditingId] = useState<number | null>(null);const [editName, setEditName] = useState('');const [editColor, setEditColor] = useState(DEFAULT_COLOR);+ const [editWip, setEditWip] = useState<{ limit: number | null; mode: WipMode }>({+ limit: null,+ mode: 'soft',+ });const [deleting, setDeleting] = useState<Column | null>(null);const t = useTranslations('settings.states');const tCommon = useTranslations('common');@@ -90,13 +95,19 @@ export default function SettingsStates({ project }: { project: ProjectDetail })setEditingId(c.id);setEditName(c.name);setEditColor(c.color);+ setEditWip({ limit: c.wipLimit, mode: c.wipMode });}async function saveEdit(c: Column) {if (!editName.trim()) return;await updateColumn.mutateAsync({id: c.id,- patch: { name: editName.trim(), color: editColor },+ patch: {+ name: editName.trim(),+ color: editColor,+ wipLimit: editWip.limit,+ wipMode: editWip.mode,+ },});setEditingId(null);}@@ -148,6 +159,13 @@ export default function SettingsStates({ project }: { project: ProjectDetail })onSubmit={() => void saveEdit(c)}onCancel={() => setEditingId(null)}leading={<SettingsColorField value={editColor} onChange={setEditColor} />}+ trailing={+ <SettingsWipLimitField+ limit={editWip.limit}+ mode={editWip.mode}+ onChange={(limit, mode) => setEditWip({ limit, mode })}+ />+ }/>) : (<SettingsStateRowdiff --git a/apps/web/src/features/work-items/WorkItemsPage.tsx b/apps/web/src/features/work-items/WorkItemsPage.tsxindex f2e28ec1..4bbbc095 100644--- a/apps/web/src/features/work-items/WorkItemsPage.tsx+++ b/apps/web/src/features/work-items/WorkItemsPage.tsx@@ -10,6 +10,7 @@ import { useLiveRefresh } from '@/hooks/useLiveRefresh';import { revScope } from '@/utils/revScopes';import { qk } from '@/services/queryKeys';import { buildGroups, groupIssues } from '@/utils/project';+import { countIssuesByColumn } from './utils/wipLimit';import {restoreHiddenSections,withoutHiddenSections,@@ -72,6 +73,10 @@ export default function WorkItemsPage() {const changeSettings = (next: ViewSettings) =>editor.changeSettings(restoreHiddenSections(next, editor.settings, features));+ // From the unfiltered project, so a column's WIP limit is measured against every+ // issue in it rather than the ones the active filters leave on screen.+ const columnCounts = countIssuesByColumn(project.issues);+const timelineGroups = buildGroups(filteredProject,settings.group,@@ -115,6 +120,7 @@ export default function WorkItemsPage() {const viewProps = {project: filteredProject,filters: editor.effectiveFilters,+ columnCounts,customFields,settings,onSettingsChange: changeSettings,diff --git a/apps/web/src/features/work-items/components/kanban/BoardColumn.tsx b/apps/web/src/features/work-items/components/kanban/BoardColumn.tsxindex be707264..505e36cd 100644--- a/apps/web/src/features/work-items/components/kanban/BoardColumn.tsx+++ b/apps/web/src/features/work-items/components/kanban/BoardColumn.tsx@@ -15,7 +15,10 @@ import { CardDropSlot } from './CardDropSlot';import { DropLine } from '../shared/DropLine';import { SelectAllToggle } from './SelectAllToggle';import { useIsOverContainer } from '../../hooks/useIsOverContainer';+import { useIncomingCount } from '../../hooks/useIncomingCount';import { COLUMN_WIDTH } from '../../utils/kanban';+import { wipAllows, wipFullColor, WIP_FULL_TINT, type WipState } from '../../utils/wipLimit';+import { WipCount } from './WipCount';// The add button sits under the last card, outside the measured cards, so it// carries its own copy of the gap CardDropSlot puts above a card (pt-2).@@ -39,6 +42,9 @@ export function BoardColumn({onAddIssue,onHide,onCollapse,+ wip,+ filtered,+ boardIssues,readOnly,}: {project: ProjectDetail;@@ -56,6 +62,13 @@ export function BoardColumn({onAddIssue: () => void;onHide: () => void;onCollapse: () => void;+ // The column's WIP limit, or null when it has none or this board is not grouped+ // by status. `filtered` says whether the cards shown are a subset of the column.+ wip: WipState | null;+ filtered: boolean;+ // Every issue the board holds, to tell which of a drag's cards are already in+ // this column when only some of them are on screen.+ boardIssues: BoardIssue[];// In a read-only share the add affordance and select-all toggle are hidden.readOnly?: boolean;}) {@@ -63,11 +76,17 @@ export function BoardColumn({const { can } = usePermissions();const canCreateIssue = can('work_items', 'create') && !readOnly;const scrollRef = useRef<HTMLDivElement>(null);+ // A hard limit that is already full takes no card from elsewhere, so the column+ // stops being a drop target while such a drag is in flight. Cards already in it+ // still reorder within it — that adds nothing to the column.+ const incoming = useIncomingCount(group, boardIssues);+ const closed = incoming > 0 && !wipAllows(wip, incoming);// The scroll area is the append drop target; merge its ref with the virtualizer// scroll element ref.const columnId = `col:${group.key}`;const { setNodeRef: dropRef, isOver } = useDroppable({id: columnId,+ disabled: closed,data: { onDrop: (ids: number[]) => onMoveIssue(ids, group, issues.length) },});const mergedRef = useCallback(@@ -90,7 +109,10 @@ export function BoardColumn({return (<div- className="group/column flex h-full shrink-0 flex-col rounded-md bg-kanban-column px-3 py-2"+ className={cn(+ 'group/column flex h-full shrink-0 flex-col rounded-md bg-kanban-column px-3 py-2',+ wip?.full && WIP_FULL_TINT[wipFullColor(wip)],+ )}style={{ width: COLUMN_WIDTH }}>{/* Stop header clicks (select-all, collapse, hide, add) from reaching the@@ -99,7 +121,7 @@ export function BoardColumn({<div className="flex items-center gap-2 text-sm font-medium text-foreground"><GroupDot group={group} />{group.name}- <span className="text-muted-foreground">{issues.length}</span>+ <WipCount filteredCount={issues.length} wip={wip} filtered={filtered} /></div><div className="flex items-center gap-1">{!readOnly && <SelectAllToggle ids={issues.map((i) => i.id)} />}@@ -166,7 +188,7 @@ export function BoardColumn({drop in that gap inserts. */}<CardDropSlotissueId={issue.id}- disabled={!manualOrder}+ disabled={!manualOrder || closed}onDrop={(ids) => onMoveIssue(ids, group, vi.index)}><BoardCarddiff --git a/apps/web/src/features/work-items/components/kanban/CollapsedColumn.tsx b/apps/web/src/features/work-items/components/kanban/CollapsedColumn.tsxindex ee735df6..136c110f 100644--- a/apps/web/src/features/work-items/components/kanban/CollapsedColumn.tsx+++ b/apps/web/src/features/work-items/components/kanban/CollapsedColumn.tsx@@ -2,8 +2,10 @@ import { ChevronsLeftRight, Plus } from 'lucide-react';import { useTranslations } from 'next-intl';import { type IssueGroup } from '@/utils/project';import { usePermissions } from '@/hooks/usePermissions';+import { cn } from '@/lib/utils';import { Button } from '@/components/ui/button';import { GroupDot } from '../shared/GroupDot';+import { type WipState, WIP_FULL_TEXT, wipFullColor } from '../../utils/wipLimit';// A column collapsed to a narrow vertical strip. It stays in place (in column// order) with its name reading vertically and its count visible; collapsing only@@ -11,12 +13,16 @@ import { GroupDot } from '../shared/GroupDot';export function CollapsedColumn({group,count,+ wip,onExpand,onAddIssue,readOnly,}: {group: IssueGroup;count: number;+ // The column's WIP limit, or null when it has none. The strip is too narrow for+ // the full `count / max`, so a full column only colours its count.+ wip: WipState | null;onExpand: () => void;onAddIssue: () => void;// In a read-only share the add affordance is hidden.@@ -50,7 +56,11 @@ export function CollapsedColumn({<GroupDot group={group} /><div className="flex flex-1 items-start gap-2 text-sm font-medium [writing-mode:vertical-rl]"><span className="text-foreground">{group.name}</span>- <span className="text-muted-foreground">{count}</span>+ <span+ className={cn(wip?.full ? WIP_FULL_TEXT[wipFullColor(wip)] : 'text-muted-foreground')}+ >+ {count}+ </span></div></div>);diff --git a/apps/web/src/features/work-items/components/kanban/FlatBoard.tsx b/apps/web/src/features/work-items/components/kanban/FlatBoard.tsxindex 54e4ab93..767ff661 100644--- a/apps/web/src/features/work-items/components/kanban/FlatBoard.tsx+++ b/apps/web/src/features/work-items/components/kanban/FlatBoard.tsx@@ -11,8 +11,11 @@ import {type WorkItemsViewProps,type IssueGroup,} from '@/utils/project';+import { isActiveFilterSet } from '@/utils/filters';import { useBoardDnd } from '../../hooks/useBoardDnd';import { useSortedOrderMessage } from '../../hooks/useSortedOrderMessage';+import { useWipLimitMessage } from '../../hooks/useWipLimitMessage';+import { countEntering, wipAllows, wipStateFor } from '../../utils/wipLimit';import { useGroupLabels } from '@/hooks/useGroupLabels';import { useSelection } from '../../context/useSelection';import { boardCollision, issuesToMove } from '../../utils/kanban';@@ -21,12 +24,14 @@ import { GroupDot } from '../shared/GroupDot';import { CardOverlay } from './CardOverlay';import { BoardColumn } from './BoardColumn';import { CollapsedColumn } from './CollapsedColumn';+import { WipCount } from './WipCount';// Flat board: one vertically-virtualized column per group, laid out horizontally,// with a trailing "Hidden" panel for manually-hidden columns.export default function FlatBoard({project,filters,+ columnCounts,settings,onSettingsChange,onOpenIssue,@@ -36,8 +41,10 @@ export default function FlatBoard({const t = useTranslations('workItems');const groupLabels = useGroupLabels();const sortedOrderMessage = useSortedOrderMessage();+ const wipLimitMessage = useWipLimitMessage();const dnd = useBoardDnd(project.project.key, readOnly);const selection = useSelection();+ const filtered = isActiveFilterSet(filters);// Hidden columns live in the view's display (settings.hiddenGroups); toggling// one writes through onSettingsChange (a display edit on a saved view, saved on@@ -83,6 +90,8 @@ export default function FlatBoard({// since that changes the grouping field rather than the order.const manualOrder = settings.sort.field === 'manual';+ const wipOf = (group: IssueGroup) => wipStateFor(group, project.columns, columnCounts);+function moveIssue(issueIds: number[], group: IssueGroup, index: number) {const assign = group.assign;if (!assign) return;@@ -92,6 +101,13 @@ export default function FlatBoard({toast.info(sortedOrderMessage(settings.sort.field));return;}+ // Refused here rather than left to the server: the move is optimistic, so a+ // card would otherwise land in the column and snap back out of it.+ const wip = wipOf(group);+ if (wip && !wipAllows(wip, countEntering(ids, sorted, group))) {+ toast.info(wipLimitMessage(group.name, wip.limit));+ return;+ }const positions = positionsAt(target, index, ids.length);ids.forEach((id, n) => dnd.move(id, { ...assign, position: positions[n] }));}@@ -120,6 +136,7 @@ export default function FlatBoard({key={group.key}group={group}count={issuesByGroup.get(group.key)?.length ?? 0}+ wip={wipOf(group)}onExpand={() => setCollapsed(group.key, false)}onAddIssue={() => addIssueTo(group)}readOnly={readOnly}@@ -133,6 +150,9 @@ export default function FlatBoard({maps={maps}properties={settings.properties}manualOrder={manualOrder}+ wip={wipOf(group)}+ filtered={filtered}+ boardIssues={sorted}onMoveIssue={moveIssue}onOpenIssue={onOpenIssue}onAddIssue={() => addIssueTo(group)}@@ -158,9 +178,11 @@ export default function FlatBoard({<div className="flex items-center gap-2 text-foreground"><GroupDot group={group} />{group.name}- <span className="text-muted-foreground">- {issuesByGroup.get(group.key)?.length ?? 0}- </span>+ <WipCount+ filteredCount={issuesByGroup.get(group.key)?.length ?? 0}+ wip={wipOf(group)}+ filtered={filtered}+ /></div><Buttonvariant="ghost"diff --git a/apps/web/src/features/work-items/components/kanban/SwimlaneBoard.tsx b/apps/web/src/features/work-items/components/kanban/SwimlaneBoard.tsxindex 4dc25329..8267fb31 100644--- a/apps/web/src/features/work-items/components/kanban/SwimlaneBoard.tsx+++ b/apps/web/src/features/work-items/components/kanban/SwimlaneBoard.tsx@@ -14,12 +14,16 @@ import {type WorkItemsViewProps,type IssueGroup,} from '@/utils/project';+import { isActiveFilterSet } from '@/utils/filters';import { usePersistedSet } from '@/hooks/usePersistedSet';import { useBoardDnd } from '../../hooks/useBoardDnd';import { useSortedOrderMessage } from '../../hooks/useSortedOrderMessage';+import { useWipLimitMessage } from '../../hooks/useWipLimitMessage';+import { countEntering, wipAllows, wipStateFor } from '../../utils/wipLimit';import { useGroupLabels } from '@/hooks/useGroupLabels';import { useSelection } from '../../context/useSelection';import { GroupDot } from '../shared/GroupDot';+import { WipCount } from './WipCount';import { SelectAllToggle } from './SelectAllToggle';import { CardOverlay } from './CardOverlay';import { SwimlaneCell } from './SwimlaneCell';@@ -47,12 +51,15 @@ interface SwimlaneRow {export default function SwimlaneBoard({project,filters,+ columnCounts,settings,onOpenIssue,readOnly,}: WorkItemsViewProps) {const sortedOrderMessage = useSortedOrderMessage();+ const wipLimitMessage = useWipLimitMessage();const groupLabels = useGroupLabels();+ const filtered = isActiveFilterSet(filters);const dnd = useBoardDnd(project.project.key, readOnly);const selection = useSelection();const collapsed = usePersistedSet(collapsedSwimlanesKey(project.project.id, settings.subgroup));@@ -122,6 +129,8 @@ export default function SwimlaneBoard({// since that changes the grouping fields rather than the order.const manualOrder = settings.sort.field === 'manual';+ const wipOf = (column: IssueGroup) => wipStateFor(column, project.columns, columnCounts);+function moveIssue(swimlane: IssueGroup,column: IssueGroup,@@ -136,6 +145,13 @@ export default function SwimlaneBoard({toast.info(sortedOrderMessage(settings.sort.field));return;}+ // Measured against the whole column, across every swimlane: moving a card+ // between two swimlanes of the same column adds nothing to it.+ const wip = wipOf(column);+ if (wip && !wipAllows(wip, countEntering(ids, sorted, column))) {+ toast.info(wipLimitMessage(column.name, wip.limit));+ return;+ }const positions = positionsAt(cellIssues, index, ids.length);ids.forEach((id, n) => dnd.move(id, { ...assign, position: positions[n] }));}@@ -173,7 +189,13 @@ export default function SwimlaneBoard({><GroupDot group={column} /><span className="truncate">{column.name}</span>- <span className="text-muted-foreground">{columnTotals.get(column.key) ?? 0}</span>+ {/* The limit is the whole column's, so it sits here rather than on+ the swimlane cells, whose counts stay plain. */}+ <WipCount+ filteredCount={columnTotals.get(column.key) ?? 0}+ wip={wipOf(column)}+ filtered={filtered}+ />{!readOnly && (<SelectAllToggle ids={idsByColumn.get(column.key) ?? []} className="ml-auto" />)}diff --git a/apps/web/src/features/work-items/components/kanban/WipCount.tsx b/apps/web/src/features/work-items/components/kanban/WipCount.tsxnew file mode 100644index 00000000..68da68ab--- /dev/null+++ b/apps/web/src/features/work-items/components/kanban/WipCount.tsx@@ -0,0 +1,46 @@+import { useTranslations } from 'next-intl';+import { cn } from '@/lib/utils';+import { type WipState, WIP_FULL_TEXT, wipFullColor } from '../../utils/wipLimit';++// The issue count in a column header. Without a WIP limit it is the bare number+// the board has always shown; with one it reads `count / max` and is marked at or+// past the limit — red where a hard limit refuses work, yellow where a soft one+// only warns.+//+// The count is the column's real occupancy rather than the cards on screen, so the+// limit reads the same to every viewer. Where filters hide some of them, the number+// the cards below add up to is shown alongside it.+export function WipCount({+ filteredCount,+ wip,+ filtered,+}: {+ filteredCount: number;+ wip: WipState | null;+ filtered: boolean;+}) {+ const t = useTranslations('workItems.wip');++ if (!wip) return <span className="text-muted-foreground">{filteredCount}</span>;++ // Only worth two numbers when the filters actually hide some of the column.+ const partial = filtered && filteredCount !== wip.count;++ return (+ <span+ className={cn(+ 'tabular-nums',+ wip.full ? `font-medium ${WIP_FULL_TEXT[wipFullColor(wip)]}` : 'text-muted-foreground',+ )}+ title={+ partial+ ? t('filteredTooltip', { shown: filteredCount, total: wip.count, max: wip.limit })+ : t('tooltip', { max: wip.limit })+ }+ >+ {partial+ ? t('filteredCount', { shown: filteredCount, total: wip.count, max: wip.limit })+ : t('count', { count: wip.count, max: wip.limit })}+ </span>+ );+}diff --git a/apps/web/src/features/work-items/components/public/ReadOnlyBoard.tsx b/apps/web/src/features/work-items/components/public/ReadOnlyBoard.tsxindex 1adef899..590c9c39 100644--- a/apps/web/src/features/work-items/components/public/ReadOnlyBoard.tsx+++ b/apps/web/src/features/work-items/components/public/ReadOnlyBoard.tsx@@ -46,6 +46,9 @@ export default function ReadOnlyBoard({project: boardProject,// The view's filters stay on the server, which sends only the issues they match.filters: EMPTY_FILTER_SET,+ // No real column totals to measure a limit against for the same reason, and a+ // share has nothing to drop anyway: empty leaves the counters plain.+ columnCounts: new Map(),customFields: project.customFields,settings,onSettingsChange: noop,diff --git a/apps/web/src/features/work-items/hooks/useIncomingCount.ts b/apps/web/src/features/work-items/hooks/useIncomingCount.tsnew file mode 100644index 00000000..c18465d9--- /dev/null+++ b/apps/web/src/features/work-items/hooks/useIncomingCount.ts@@ -0,0 +1,15 @@+import { useDndContext } from '@dnd-kit/core';+import { type Issue } from '@/lib/api';+import { type IssueGroup } from '@/utils/project';+import { draggedIds } from '../utils/kanban';+import { countEntering } from '../utils/wipLimit';++// How many of the cards in the current drag would be new to `group`'s column. A+// drag carries the whole selection when the grabbed card is part of it, and some of+// those may already sit in that column — reordering them there, or moving them+// between its swimlanes, adds nothing to it. Zero when nothing is being dragged.+export function useIncomingCount(group: IssueGroup, issues: Issue[]): number {+ const { active } = useDndContext();+ if (!active) return 0;+ return countEntering(draggedIds(active), issues, group);+}diff --git a/apps/web/src/features/work-items/hooks/useWipLimitMessage.ts b/apps/web/src/features/work-items/hooks/useWipLimitMessage.tsnew file mode 100644index 00000000..b422df1f--- /dev/null+++ b/apps/web/src/features/work-items/hooks/useWipLimitMessage.ts@@ -0,0 +1,11 @@+'use client';++import { useTranslations } from 'next-intl';++// Why a card cannot enter a column: it is at the work-in-progress limit its+// settings enforce. Names the column and the limit, so the reader knows what to+// change without leaving the board.+export function useWipLimitMessage() {+ const t = useTranslations('workItems');+ return (column: string, limit: number) => t('wip.reached', { column, limit });+}diff --git a/apps/web/src/features/work-items/utils/wipLimit.ts b/apps/web/src/features/work-items/utils/wipLimit.tsnew file mode 100644index 00000000..3cca1208--- /dev/null+++ b/apps/web/src/features/work-items/utils/wipLimit.ts@@ -0,0 +1,91 @@+import { type Column, type WipMode } from '@/lib/api';+import { type IssueGroup } from '@/utils/project';++// A column's work-in-progress limit as the board reads it.+//+// `count` is the column's real occupancy, not the number of cards on screen: a+// limit belongs to the state, so measuring it against a filtered view would make+// the same column look full to one viewer and empty to another. `full` is at *or+// past* the limit, since a column can already be over one that was lowered under it.+export interface WipState {+ count: number;+ limit: number;+ mode: WipMode;+ full: boolean;+}++// The limit of the column a board group stands for, or null when the group is not+// a column (the board also groups by assignee, priority, cycle…) or that column+// has no limit set.+export function wipStateFor(+ group: IssueGroup,+ columns: Column[],+ counts: Map<number, number>,+): WipState | null {+ const columnId = group.assign?.columnId;+ if (columnId == null) return null;+ const column = columns.find((c) => c.id === columnId);+ if (!column || column.wipLimit == null) return null;++ const count = counts.get(columnId) ?? 0;+ return {+ count,+ limit: column.wipLimit,+ mode: column.wipMode,+ full: count >= column.wipLimit,+ };+}++export type WipFullColor = 'destructive' | 'warning';++// The colour a full column is marked in, by what its limit does: a hard limit has+// refused work, a soft one only warns.+export function wipFullColor(state: WipState): WipFullColor {+ return state.mode === 'hard' ? 'destructive' : 'warning';+}++// Tailwind matches class names as literal strings, so the two variants are spelled+// out rather than built from the colour name.+export const WIP_FULL_TEXT: Record<WipFullColor, string> = {+ destructive: 'text-destructive',+ warning: 'text-warning',+};++export const WIP_FULL_TINT: Record<WipFullColor, string> = {+ destructive: 'bg-destructive/5',+ warning: 'bg-warning/5',+};++// Whether `incoming` more issues may enter the column. Only a hard limit refuses;+// a soft one is advisory, and a column with no limit is always open.+export function wipAllows(state: WipState | null, incoming: number): boolean {+ if (!state || state.mode !== 'hard') return true;+ return state.count + incoming <= state.limit;+}++// How many of the moved issues are not already in the column the group stands for+// — the ones that would actually add to its occupancy. Reordering a card within+// its column, or moving it between two swimlanes of the same column, adds none.+//+// `issues` is what the board is showing, so an id it does not know is one the+// active filters hide. Those count as entering: the alternative is to assume they+// are already in the column and let a move through that the API would refuse.+export function countEntering(+ movedIds: number[],+ issues: { id: number; columnId: number }[],+ group: IssueGroup,+): number {+ const columnId = group.assign?.columnId;+ if (columnId == null) return movedIds.length;+ const byId = new Map(issues.map((issue) => [issue.id, issue.columnId]));+ return movedIds.filter((id) => byId.get(id) !== columnId).length;+}++// Issues per column across the whole project, ignoring the active filters.+// Archived issues are never in the payload, so they are already out of the count,+// which matches how the API counts a column.+export function countIssuesByColumn(issues: { columnId: number }[]): Map<number, number> {+ const counts = new Map<number, number>();+ for (const issue of issues) counts.set(issue.columnId, (counts.get(issue.columnId) ?? 0) + 1);+ return counts;+}diff --git a/apps/web/src/lib/api.ts b/apps/web/src/lib/api.tsindex 4b4ac5e3..0695cb77 100644--- a/apps/web/src/lib/api.ts+++ b/apps/web/src/lib/api.ts@@ -23,10 +23,13 @@ export function resolveApiUrl(url: string): string {// 403 (no access to the project / not owner), 404 (not found) and 400 (a// validation or business-rule failure). `message` is the API's `{ error }` text// when present, so existing consumers that read `error.message` keep working.+// `code` names the failure where the API sends one, for a caller that has to+// branch on it rather than show the message.export class ApiError extends Error {constructor(readonly status: number,message: string,+ readonly code?: string,) {super(message);this.name = 'ApiError';@@ -48,7 +51,7 @@ async function request<T>(path: string, init?: RequestInit): Promise<T> {});if (!res.ok) {const body = await res.json().catch(() => null);- throw new ApiError(res.status, body?.error ?? `${res.status} ${res.statusText}`);+ throw new ApiError(res.status, body?.error ?? `${res.status} ${res.statusText}`, body?.code);}if (res.status === 204) return undefined as T;return res.json();@@ -111,8 +114,14 @@ export interface Column {stateType: StateType;color: string;position: number;+ // How many issues the column should hold, or null for no limit. wipMode decides+ // whether passing it only warns on the board or is refused outright.+ wipLimit: number | null;+ wipMode: WipMode;}+export type WipMode = 'soft' | 'hard';+export interface IssueType {id: number;projectId: number;@@ -2090,7 +2099,13 @@ export const api = {createColumn: (projectKey: string,- input: { name: string; stateType: StateType; color?: string },+ input: {+ name: string;+ stateType: StateType;+ color?: string;+ wipLimit?: number | null;+ wipMode?: WipMode;+ },) =>request<Column>(`/projects/${projectKey}/columns`, {method: 'POST',@@ -2099,7 +2114,14 @@ export const api = {updateColumn: (projectKey: string,columnId: number,- patch: { name?: string; stateType?: StateType; color?: string },+ patch: {+ name?: string;+ stateType?: StateType;+ color?: string;+ // null clears the limit; absent leaves it as it is.+ wipLimit?: number | null;+ wipMode?: WipMode;+ },) =>request<Column>(`/projects/${projectKey}/columns/${columnId}`, {method: 'PATCH',diff --git a/apps/web/src/utils/project.ts b/apps/web/src/utils/project.tsindex 6aaec4c0..eb89f196 100644--- a/apps/web/src/utils/project.ts+++ b/apps/web/src/utils/project.ts@@ -54,6 +54,10 @@ export interface WorkItemsViewProps {// The conditions the project's issues were filtered by. The layouts re-read them// to leave out the groups those conditions exclude (see buildGroups).filters: FilterSet;+ // Issues per column id before those filters are applied. A column's WIP limit is+ // measured against this rather than the cards on screen, so the limit means the+ // same thing to every viewer whatever they have filtered.+ columnCounts: Map<number, number>;// Custom field definitions applicable to this project (global + the project's// type-scoped fields). The Table view renders enabled ones as columns.customFields: CustomField[];diff --git a/packages/db/drizzle/0076_demonic_shaman.sql b/packages/db/drizzle/0076_demonic_shaman.sqlnew file mode 100644index 00000000..708b65c5--- /dev/null+++ b/packages/db/drizzle/0076_demonic_shaman.sql@@ -0,0 +1,4 @@+ALTER TABLE "project_column" ADD COLUMN "wip_limit" integer;--> statement-breakpoint+ALTER TABLE "project_column" ADD COLUMN "wip_mode" text DEFAULT 'soft' NOT NULL;--> statement-breakpoint+ALTER TABLE "project_column" ADD CONSTRAINT "project_column_wip_mode_check" CHECK ("project_column"."wip_mode" IN ('soft', 'hard'));--> statement-breakpoint+ALTER TABLE "project_column" ADD CONSTRAINT "project_column_wip_limit_check" CHECK ("project_column"."wip_limit" IS NULL OR "project_column"."wip_limit" > 0);\ No newline at end of filediff --git a/packages/db/drizzle/meta/0076_snapshot.json b/packages/db/drizzle/meta/0076_snapshot.jsonnew file mode 100644index 00000000..feb9b70c--- /dev/null+++ b/packages/db/drizzle/meta/0076_snapshot.json@@ -0,0 +1,6128 @@+{+ "id": "9b540250-e0d2-45a8-94a5-f23260f000ac",+ "prevId": "9a1fe2c2-7cc9-4bd1-8410-e7ad66b7d0cf",+ "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.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.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.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.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()"+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "default": "'user'"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "user_email_unique": {+ "name": "user_email_unique",+ "nullsNotDistinct": false,+ "columns": [+ "email"+ ]+ }+ },+ "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.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+ },+ "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+ },+ "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+ },+ "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_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": {}+ }+ },+ "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_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"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "agent_run_status_check": {+ "name": "agent_run_status_check",+ "value": "\"agent_run\".\"status\" IN ('pending', 'success', 'failed')"+ },+ "agent_run_trigger_check": {+ "name": "agent_run_trigger_check",+ "value": "\"agent_run\".\"trigger\" IN ('mention', 'delegation', 'schedule', 'manual')"+ }+ },+ "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+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "prompt": {+ "name": "prompt",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "cron": {+ "name": "cron",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "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": true+ },+ "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": {}+ }+ },+ "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"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "agent_schedule_agent_id_name_unique": {+ "name": "agent_schedule_agent_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "agent_id",+ "name"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {+ "agent_schedule_status_check": {+ "name": "agent_schedule_status_check",+ "value": "\"agent_schedule\".\"status\" IN ('active', 'paused')"+ }+ },+ "isRLSEnabled": false+ },+ "public.agent_skill": {+ "name": "agent_skill",+ "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": "''"+ },+ "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_project_idx": {+ "name": "agent_skill_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_skill_project_id_project_id_fk": {+ "name": "agent_skill_project_id_project_id_fk",+ "tableFrom": "agent_skill",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "agent_skill_project_id_name_unique": {+ "name": "agent_skill_project_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_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+ },+ "project_id": {+ "name": "project_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": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_tool_project_idx": {+ "name": "agent_tool_project_idx",+ "columns": [+ {+ "expression": "project_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_project_id_project_id_fk": {+ "name": "agent_tool_project_id_project_id_fk",+ "tableFrom": "agent_tool",+ "tableTo": "project",+ "columnsFrom": [+ "project_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_project_id_tool_key_credential_id_unique": {+ "name": "agent_tool_project_id_tool_key_credential_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_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+ },+ "project_id": {+ "name": "project_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+ },+ "max_steps": {+ "name": "max_steps",+ "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+ },+ "role_id": {+ "name": "role_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "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+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "ai_agent_project_idx": {+ "name": "ai_agent_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "ai_agent_project_id_project_id_fk": {+ "name": "ai_agent_project_id_project_id_fk",+ "tableFrom": "ai_agent",+ "tableTo": "project",+ "columnsFrom": [+ "project_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_role_id_project_role_id_fk": {+ "name": "ai_agent_role_id_project_role_id_fk",+ "tableFrom": "ai_agent",+ "tableTo": "project_role",+ "columnsFrom": [+ "role_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "ai_agent_project_id_username_unique": {+ "name": "ai_agent_project_id_username_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "username"+ ]+ },+ "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')"+ }+ },+ "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.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+ },+ "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')"+ }+ },+ "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+ },+ "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.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_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+ },+ "project_id": {+ "name": "project_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_project_idx": {+ "name": "integration_credential_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "integration_credential_project_id_project_id_fk": {+ "name": "integration_credential_project_id_project_id_fk",+ "tableFrom": "integration_credential",+ "tableTo": "project",+ "columnsFrom": [+ "project_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+ },+ "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_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": {}+ }+ },+ "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": {},+ "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+ },+ "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+ },+ "subject": {+ "name": "subject",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "from_text": {+ "name": "from_text",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "to_text": {+ "name": "to_text",+ "type": "text",+ "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_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_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_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+ }+ },+ "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"+ }+ },+ "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_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_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.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.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": true+ },+ "source_activity_id": {+ "name": "source_activity_id",+ "type": "integer",+ "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": {}+ }+ },+ "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_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')"+ }+ },+ "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.project": {+ "name": "project",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "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+ },+ "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+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "project_key_unique": {+ "name": "project_key_unique",+ "nullsNotDistinct": false,+ "columns": [+ "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'"+ },+ "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"+ }+ },+ "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_invite": {+ "name": "project_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()"+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "email": {+ "name": "email",+ "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+ },+ "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": {+ "project_invite_pending_uq": {+ "name": "project_invite_pending_uq",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "email",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"project_invite\".\"status\" = 'pending'",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "project_invite_project_idx": {+ "name": "project_invite_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_invite_project_id_project_id_fk": {+ "name": "project_invite_project_id_project_id_fk",+ "tableFrom": "project_invite",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_invite_role_id_project_role_id_fk": {+ "name": "project_invite_role_id_project_role_id_fk",+ "tableFrom": "project_invite",+ "tableTo": "project_role",+ "columnsFrom": [+ "role_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "project_invite_invited_by_user_id_user_id_fk": {+ "name": "project_invite_invited_by_user_id_user_id_fk",+ "tableFrom": "project_invite",+ "tableTo": "user",+ "columnsFrom": [+ "invited_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "project_invite_accepted_by_user_id_user_id_fk": {+ "name": "project_invite_accepted_by_user_id_user_id_fk",+ "tableFrom": "project_invite",+ "tableTo": "user",+ "columnsFrom": [+ "accepted_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "project_invite_token_unique": {+ "name": "project_invite_token_unique",+ "nullsNotDistinct": false,+ "columns": [+ "token"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {+ "project_invite_role_check": {+ "name": "project_invite_role_check",+ "value": "\"project_invite\".\"role\" IN ('owner', 'member')"+ },+ "project_invite_status_check": {+ "name": "project_invite_status_check",+ "value": "\"project_invite\".\"status\" IN ('pending', 'accepted', 'rejected')"+ }+ },+ "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": "''"+ },+ "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_project_role_id_fk": {+ "name": "project_member_role_id_project_role_id_fk",+ "tableFrom": "project_member",+ "tableTo": "project_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')"+ }+ },+ "isRLSEnabled": false+ },+ "public.project_notification_setting": {+ "name": "project_notification_setting",+ "schema": "",+ "columns": {+ "project_id": {+ "name": "project_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": {+ "project_notification_setting_project_id_project_id_fk": {+ "name": "project_notification_setting_project_id_project_id_fk",+ "tableFrom": "project_notification_setting",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_role": {+ "name": "project_role",+ "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+ },+ "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": {+ "project_role_default_uq": {+ "name": "project_role_default_uq",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"project_role\".\"is_default\"",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "project_role_project_idx": {+ "name": "project_role_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_role_project_id_project_id_fk": {+ "name": "project_role_project_id_project_id_fk",+ "tableFrom": "project_role",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "project_role_project_id_name_unique": {+ "name": "project_role_project_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "name"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "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+ },+ "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": {}+ }+ },+ "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"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "project_view_share_token_unique": {+ "name": "project_view_share_token_unique",+ "nullsNotDistinct": false,+ "columns": [+ "share_token"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "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.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.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+ },+ "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', 'ai-chat')"+ },+ "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.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+ }+ },+ "enums": {},+ "schemas": {},+ "sequences": {},+ "roles": {},+ "policies": {},+ "views": {},+ "_meta": {+ "columns": {},+ "schemas": {},+ "tables": {}+ }+}\ No newline at end of filediff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.jsonindex 4fc35e3d..dc51240b 100644--- a/packages/db/drizzle/meta/_journal.json+++ b/packages/db/drizzle/meta/_journal.json@@ -533,6 +533,13 @@"when": 1786628860087,"tag": "0075_left_rafael_vega","breakpoints": true+ },+ {+ "idx": 76,+ "version": "7",+ "when": 1786713287358,+ "tag": "0076_demonic_shaman",+ "breakpoints": true}]}\ No newline at end of filediff --git a/packages/db/src/schema/app.ts b/packages/db/src/schema/app.tsindex f4b3f5b6..c7455460 100644--- a/packages/db/src/schema/app.ts+++ b/packages/db/src/schema/app.ts@@ -276,6 +276,12 @@ export const projectColumn = pgTable(stateType: text('state_type').notNull().default('unstarted'),color: text('color').notNull().default('#6b7280'),position: integer('position').notNull(),+ // The work-in-progress limit: how many issues the column should hold. NULL is+ // no limit, which is what every column starts as. wipMode decides what happens+ // at the limit — 'soft' only warns, 'hard' refuses further issues — and is only+ // read when wipLimit is set.+ wipLimit: integer('wip_limit'),+ wipMode: text('wip_mode').notNull().default('soft'),createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),},(t) => [@@ -283,6 +289,8 @@ export const projectColumn = pgTable('project_column_state_type_check',sql`${t.stateType} IN ('backlog', 'unstarted', 'started', 'completed', 'canceled')`,),+ check('project_column_wip_mode_check', sql`${t.wipMode} IN ('soft', 'hard')`),+ check('project_column_wip_limit_check', sql`${t.wipLimit} IS NULL OR ${t.wipLimit} > 0`),unique().on(t.projectId, t.position),],);