⭐️⭐️⭐️ 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 checklists to board cards (#96)
Ahmed Osama4fc44c9dbe89
diff --git a/apps/api/src/issues/__tests__/integration/checklists.test.ts b/apps/api/src/issues/__tests__/integration/checklists.test.tsnew file mode 100644index 00000000..54d6a278--- /dev/null+++ b/apps/api/src/issues/__tests__/integration/checklists.test.ts@@ -0,0 +1,360 @@+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';++// Checklists: an issue holds several checklists, each holding checkbox items. Both+// are ordered by position within their parent and come back with the issue read+// (GET /issues/:issueId → `checklists`). A checklist and its items are part of the+// issue, so they take the same work_items permission. The structural changes are+// written to the activity feed; checking a box is not.++interface Setup {+ asOwner: Api;+ columnId: number;+}++async function setupProject(): Promise<Setup> {+ const owner = await signUpTestUser();+ const asOwner = authedApi(owner.cookie);+ await asOwner.projects.post({ key: 'MKT', name: 'Marketing' });+ const view = await asOwner.projects({ projectKey: 'MKT' }).get();+ return { asOwner, columnId: view.data!.columns[0].id };+}++function createIssue(client: Api, columnId: number, title = 'Task') {+ return client.projects({ projectKey: 'MKT' }).issues.post({ columnId, title });+}++// An issue with one checklist on it, the shape most of the tests start from.+async function issueWithChecklist(client: Api, columnId: number, title = 'Release steps') {+ const issue = (await createIssue(client, columnId)).data!;+ const checklist = (await client.issues({ issueId: issue.id }).checklists.post({ title })).data!;+ return { issue, checklist };+}++function addItem(client: Api, checklistId: number, content: string) {+ return client.checklists({ checklistId }).items.post({ content });+}++async function read(client: Api, issueId: number) {+ const res = await client.issues({ issueId }).get();+ return res.data!;+}++async function feedActions(client: Api, issueId: number) {+ const res = await client.issues({ issueId }).feed.get({ query: {} });+ return res.data!.items.map((item) => item.action);+}++describe('checklists', () => {+ beforeEach(async () => {+ await resetDb();+ });++ describe('create', () => {+ it('adds a checklist and carries it on the issue read', async () => {+ const { asOwner, columnId } = await setupProject();+ const { issue, checklist } = await issueWithChecklist(asOwner, columnId);++ expect(checklist).toMatchObject({ title: 'Release steps', items: [] });+ expect(await read(asOwner, issue.id)).toMatchObject({+ checklists: [{ id: checklist.id, title: 'Release steps', items: [] }],+ });+ });++ it('rejects an empty title with 400', async () => {+ const { asOwner, columnId } = await setupProject();+ const issue = (await createIssue(asOwner, columnId)).data!;++ const res = await asOwner.issues({ issueId: issue.id }).checklists.post({ title: '' });+ expect(res.status).toBe(400);+ });++ it('rejects a title over 200 characters with 400', async () => {+ const { asOwner, columnId } = await setupProject();+ const issue = (await createIssue(asOwner, columnId)).data!;++ const res = await asOwner+ .issues({ issueId: issue.id })+ .checklists.post({ title: 'x'.repeat(201) });+ expect(res.status).toBe(400);+ });++ it('returns 404 for an unknown issue', async () => {+ const { asOwner, columnId } = await setupProject();+ const issue = (await createIssue(asOwner, columnId)).data!;++ const res = await asOwner+ .issues({ issueId: issue.id + 999 })+ .checklists.post({ title: 'Nowhere' });+ expect(res.status).toBe(404);+ });++ it('denies a non-member with 403', async () => {+ const { asOwner, columnId } = await setupProject();+ const issue = (await createIssue(asOwner, columnId)).data!;+ const outsider = authedApi((await signUpTestUser()).cookie);++ const res = await outsider.issues({ issueId: issue.id }).checklists.post({ title: 'Mine' });+ expect(res.status).toBe(403);+ });+ });++ describe('items', () => {+ it('appends items in the order they were added', async () => {+ const { asOwner, columnId } = await setupProject();+ const { issue, checklist } = await issueWithChecklist(asOwner, columnId);++ await addItem(asOwner, checklist.id, 'Tag the release');+ await addItem(asOwner, checklist.id, 'Publish the notes');++ expect(await read(asOwner, issue.id)).toMatchObject({+ checklists: [+ {+ id: checklist.id,+ items: [+ { content: 'Tag the release', done: false },+ { content: 'Publish the notes', done: false },+ ],+ },+ ],+ });+ });++ it('checks an item off', async () => {+ const { asOwner, columnId } = await setupProject();+ const { issue, checklist } = await issueWithChecklist(asOwner, columnId);+ const item = (await addItem(asOwner, checklist.id, 'Tag the release')).data!;++ const res = await asOwner.checklists.items({ itemId: item.id }).patch({ done: true });+ expect(res.status).toBe(200);+ expect(res.data).toMatchObject({ id: item.id, done: true });+ expect((await read(asOwner, issue.id)).checklists[0].items).toMatchObject([+ { id: item.id, done: true },+ ]);+ });++ it('edits an item and leaves its checked state alone', async () => {+ const { asOwner, columnId } = await setupProject();+ const { checklist } = await issueWithChecklist(asOwner, columnId);+ const item = (await addItem(asOwner, checklist.id, 'Tag the relase')).data!;+ await asOwner.checklists.items({ itemId: item.id }).patch({ done: true });++ const res = await asOwner.checklists+ .items({ itemId: item.id })+ .patch({ content: 'Tag the release' });+ expect(res.data).toMatchObject({ content: 'Tag the release', done: true });+ });++ it('returns the item unchanged when the patch carries no fields', async () => {+ const { asOwner, columnId } = await setupProject();+ const { checklist } = await issueWithChecklist(asOwner, columnId);+ const item = (await addItem(asOwner, checklist.id, 'Tag the release')).data!;+ await asOwner.checklists.items({ itemId: item.id }).patch({ done: true });++ const res = await asOwner.checklists.items({ itemId: item.id }).patch({});+ expect(res.status).toBe(200);+ expect(res.data).toMatchObject({ id: item.id, content: 'Tag the release', done: true });+ });++ it('rejects empty content with 400', async () => {+ const { asOwner, columnId } = await setupProject();+ const { checklist } = await issueWithChecklist(asOwner, columnId);++ const res = await addItem(asOwner, checklist.id, '');+ expect(res.status).toBe(400);+ });++ it('deletes an item', async () => {+ const { asOwner, columnId } = await setupProject();+ const { issue, checklist } = await issueWithChecklist(asOwner, columnId);+ const item = (await addItem(asOwner, checklist.id, 'Tag the release')).data!;++ const res = await asOwner.checklists.items({ itemId: item.id }).delete();+ expect(res.status).toBe(204);+ expect((await read(asOwner, issue.id)).checklists[0].items).toEqual([]);+ });++ it('returns 404 for an unknown item', async () => {+ const { asOwner, columnId } = await setupProject();+ const { checklist } = await issueWithChecklist(asOwner, columnId);+ const item = (await addItem(asOwner, checklist.id, 'Tag the release')).data!;++ const res = await asOwner.checklists.items({ itemId: item.id + 999 }).delete();+ expect(res.status).toBe(404);+ });++ it('denies a non-member with 403', async () => {+ const { asOwner, columnId } = await setupProject();+ const { checklist } = await issueWithChecklist(asOwner, columnId);+ const outsider = authedApi((await signUpTestUser()).cookie);++ const res = await addItem(outsider, checklist.id, 'Mine');+ expect(res.status).toBe(403);+ });+ });++ describe('rename and delete', () => {+ it('renames a checklist', async () => {+ const { asOwner, columnId } = await setupProject();+ const { checklist } = await issueWithChecklist(asOwner, columnId);++ const res = await asOwner+ .checklists({ checklistId: checklist.id })+ .patch({ title: 'Launch steps' });+ expect(res.status).toBe(200);+ expect(res.data).toMatchObject({ id: checklist.id, title: 'Launch steps' });+ });++ it('deletes a checklist and its items with it', async () => {+ const { asOwner, columnId } = await setupProject();+ const { issue, checklist } = await issueWithChecklist(asOwner, columnId);+ const item = (await addItem(asOwner, checklist.id, 'Tag the release')).data!;++ const res = await asOwner.checklists({ checklistId: checklist.id }).delete();+ expect(res.status).toBe(204);+ expect((await read(asOwner, issue.id)).checklists).toEqual([]);+ // The item went with the checklist, so nothing addresses it any more.+ expect((await asOwner.checklists.items({ itemId: item.id }).delete()).status).toBe(404);+ });++ it('returns 404 for an unknown checklist', async () => {+ const { asOwner, columnId } = await setupProject();+ const { checklist } = await issueWithChecklist(asOwner, columnId);++ const res = await asOwner.checklists({ checklistId: checklist.id + 999 }).delete();+ expect(res.status).toBe(404);+ });+ });++ describe('reorder', () => {+ it("sets the order of an issue's checklists", async () => {+ const { asOwner, columnId } = await setupProject();+ const { issue, checklist: first } = await issueWithChecklist(asOwner, columnId, 'First');+ const second = (+ await asOwner.issues({ issueId: issue.id }).checklists.post({ title: 'Second' })+ ).data!;++ const res = await asOwner+ .issues({ issueId: issue.id })+ .checklists.reorder.put({ orderedIds: [second.id, first.id] });+ expect(res.status).toBe(200);+ expect(res.data!.map((list) => list.id)).toEqual([second.id, first.id]);+ expect((await read(asOwner, issue.id)).checklists.map((list) => list.id)).toEqual([+ second.id,+ first.id,+ ]);+ });++ it('sets the order of the items within a checklist', async () => {+ const { asOwner, columnId } = await setupProject();+ const { issue, checklist } = await issueWithChecklist(asOwner, columnId);+ const first = (await addItem(asOwner, checklist.id, 'First')).data!;+ const second = (await addItem(asOwner, checklist.id, 'Second')).data!;++ const res = await asOwner+ .checklists({ checklistId: checklist.id })+ .items.reorder.put({ orderedIds: [second.id, first.id] });+ expect(res.status).toBe(200);+ expect(res.data!.map((item) => item.id)).toEqual([second.id, first.id]);+ expect((await read(asOwner, issue.id)).checklists[0].items.map((item) => item.id)).toEqual([+ second.id,+ first.id,+ ]);+ });++ it('ignores an id belonging to another checklist', async () => {+ const { asOwner, columnId } = await setupProject();+ const { issue, checklist } = await issueWithChecklist(asOwner, columnId);+ const mine = (await addItem(asOwner, checklist.id, 'Mine')).data!;+ const other = (+ await asOwner.issues({ issueId: issue.id }).checklists.post({ title: 'Other' })+ ).data!;+ const first = (await addItem(asOwner, other.id, 'Foreign first')).data!;+ const second = (await addItem(asOwner, other.id, 'Foreign second')).data!;++ const res = await asOwner+ .checklists({ checklistId: checklist.id })+ .items.reorder.put({ orderedIds: [second.id, mine.id] });+ expect(res.status).toBe(200);+ expect(res.data!.map((item) => item.id)).toEqual([mine.id]);+ // The foreign item kept both its checklist and its position on it — a+ // reorder scoped only by item id would have moved it to the front.+ expect((await read(asOwner, issue.id)).checklists[1].items.map((item) => item.id)).toEqual([+ first.id,+ second.id,+ ]);+ });++ it('rejects an empty id list with 400', async () => {+ const { asOwner, columnId } = await setupProject();+ const { checklist } = await issueWithChecklist(asOwner, columnId);++ const res = await asOwner+ .checklists({ checklistId: checklist.id })+ .items.reorder.put({ orderedIds: [] });+ expect(res.status).toBe(400);+ });+ });++ // Structural changes belong in the feed; a checkbox toggle is the most frequent+ // write here and would bury the rest of it.+ describe('activity', () => {+ it('logs the checklist and item changes', async () => {+ const { asOwner, columnId } = await setupProject();+ const { issue, checklist } = await issueWithChecklist(asOwner, columnId);+ const item = (await addItem(asOwner, checklist.id, 'Tag the release')).data!;+ await asOwner.checklists({ checklistId: checklist.id }).patch({ title: 'Launch steps' });+ await asOwner.checklists.items({ itemId: item.id }).delete();++ const feed = await asOwner.issues({ issueId: issue.id }).feed.get({ query: {} });+ expect(feed.data!.items).toContainEqual(+ expect.objectContaining({ action: 'checklist_add', toText: 'Release steps' }),+ );+ expect(feed.data!.items).toContainEqual(+ expect.objectContaining({+ action: 'checklist_item_add',+ subject: 'Release steps',+ toText: 'Tag the release',+ }),+ );+ expect(feed.data!.items).toContainEqual(+ expect.objectContaining({+ action: 'checklist_rename',+ fromText: 'Release steps',+ toText: 'Launch steps',+ }),+ );+ expect(feed.data!.items).toContainEqual(+ expect.objectContaining({+ action: 'checklist_item_remove',+ fromText: 'Tag the release',+ }),+ );+ });++ it('logs the checklist removal', async () => {+ const { asOwner, columnId } = await setupProject();+ const { issue, checklist } = await issueWithChecklist(asOwner, columnId);+ await asOwner.checklists({ checklistId: checklist.id }).delete();++ const feed = await asOwner.issues({ issueId: issue.id }).feed.get({ query: {} });+ expect(feed.data!.items).toContainEqual(+ expect.objectContaining({ action: 'checklist_remove', fromText: 'Release steps' }),+ );+ });++ it('writes nothing when an item is only checked off', async () => {+ const { asOwner, columnId } = await setupProject();+ const { issue, checklist } = await issueWithChecklist(asOwner, columnId);+ const item = (await addItem(asOwner, checklist.id, 'Tag the release')).data!;+ const before = await feedActions(asOwner, issue.id);++ await asOwner.checklists.items({ itemId: item.id }).patch({ done: true });+ await asOwner.checklists.items({ itemId: item.id }).patch({ done: false });++ expect(await feedActions(asOwner, issue.id)).toEqual(before);+ });+ });+});diff --git a/apps/api/src/issues/checklists.ts b/apps/api/src/issues/checklists.tsnew file mode 100644index 00000000..eecf1aae--- /dev/null+++ b/apps/api/src/issues/checklists.ts@@ -0,0 +1,288 @@+import { db, issueChecklist, issueChecklistItem } from '@repo/db';+import { and, asc, eq, inArray, sql } from 'drizzle-orm';+import { HttpError } from '../shared/lib';+import { recordActivity } from './activity';++// Checklists on an issue: a list of steps too small to be subtasks of their own.+// An issue holds several checklists, each holding its items; both are ordered by+// position within their parent.+//+// Activity is recorded for the structural changes (a checklist or an item added,+// renamed or removed) but never for checking a box: a toggle is the most frequent+// write there is here, and logging it would bury the rest of the feed.++export interface ChecklistItemRow {+ id: number;+ content: string;+ done: boolean;+ position: number;+}++export interface ChecklistRow {+ id: number;+ title: string;+ position: number;+ items: ChecklistItemRow[];+}++// The DTO columns, shared by the reads and by the writes that return the row they+// changed.+const checklistColumns = {+ id: issueChecklist.id,+ title: issueChecklist.title,+ position: issueChecklist.position,+};++const itemColumns = {+ id: issueChecklistItem.id,+ content: issueChecklistItem.content,+ done: issueChecklistItem.done,+ position: issueChecklistItem.position,+};++// The issue a checklist belongs to and its title, which the activity entries for+// its items carry as their subject. Throws when there is no such checklist.+async function checklistContext(checklistId: number): Promise<{ issueId: number; title: string }> {+ const rows = await db+ .select({ issueId: issueChecklist.issueId, title: issueChecklist.title })+ .from(issueChecklist)+ .where(eq(issueChecklist.id, checklistId));+ if (!rows[0]) throw new HttpError(404, 'Checklist not found');+ return rows[0];+}++// The issue a checklist hangs on, for the route guard that resolves it to a project.+export async function getChecklistIssueId(checklistId: number): Promise<number | null> {+ const rows = await db+ .select({ issueId: issueChecklist.issueId })+ .from(issueChecklist)+ .where(eq(issueChecklist.id, checklistId));+ return rows[0]?.issueId ?? null;+}++// The issue an item hangs on, through its checklist.+export async function getChecklistItemIssueId(itemId: number): Promise<number | null> {+ const rows = await db+ .select({ issueId: issueChecklist.issueId })+ .from(issueChecklistItem)+ .innerJoin(issueChecklist, eq(issueChecklist.id, issueChecklistItem.checklistId))+ .where(eq(issueChecklistItem.id, itemId));+ return rows[0]?.issueId ?? null;+}++// Every checklist of an issue with its items, both in display order. Two reads+// joined in memory rather than one row-multiplying join, so a checklist with no+// items still comes back.+export async function listChecklists(issueId: number): Promise<ChecklistRow[]> {+ const lists = await db+ .select(checklistColumns)+ .from(issueChecklist)+ .where(eq(issueChecklist.issueId, issueId))+ .orderBy(asc(issueChecklist.position), asc(issueChecklist.id));+ if (lists.length === 0) return [];++ const items = await db+ .select({+ id: issueChecklistItem.id,+ checklistId: issueChecklistItem.checklistId,+ content: issueChecklistItem.content,+ done: issueChecklistItem.done,+ position: issueChecklistItem.position,+ })+ .from(issueChecklistItem)+ .where(+ inArray(+ issueChecklistItem.checklistId,+ lists.map((list) => list.id),+ ),+ )+ .orderBy(asc(issueChecklistItem.position), asc(issueChecklistItem.id));++ const byChecklist = new Map<number, ChecklistItemRow[]>();+ for (const { checklistId, ...item } of items) {+ const bucket = byChecklist.get(checklistId);+ if (bucket) bucket.push(item);+ else byChecklist.set(checklistId, [item]);+ }+ return lists.map((list) => ({ ...list, items: byChecklist.get(list.id) ?? [] }));+}++export async function createChecklist(+ issueId: number,+ title: string,+ actorUserId?: string | null,+): Promise<ChecklistRow> {+ const [row] = await db+ .insert(issueChecklist)+ .values({+ issueId,+ title,+ // A sparse float, leaving room to insert between two rows without a renumber.+ position: sql<number>`(select coalesce(max(${issueChecklist.position}), 0) + 1000 from ${issueChecklist} where ${eq(issueChecklist.issueId, issueId)})`,+ })+ .returning(checklistColumns);++ await recordActivity(issueId, [{ action: 'checklist_add', toText: title }], actorUserId);+ return { ...row, items: [] };+}++export async function renameChecklist(+ checklistId: number,+ title: string,+ actorUserId?: string | null,+): Promise<ChecklistRow> {+ const previous = await checklistContext(checklistId);+ const [row] = await db+ .update(issueChecklist)+ .set({ title })+ .where(eq(issueChecklist.id, checklistId))+ .returning(checklistColumns);++ // Renaming to the title it already has is not a change worth a feed entry.+ if (previous.title !== title) {+ await recordActivity(+ previous.issueId,+ [{ action: 'checklist_rename', fromText: previous.title, toText: title }],+ actorUserId,+ );+ }+ return { ...row, items: await listItems(checklistId) };+}++// Deletes a checklist; its items go with it through the FK cascade. Returns false+// when there is no such checklist.+export async function deleteChecklist(+ checklistId: number,+ actorUserId?: string | null,+): Promise<boolean> {+ const [removed] = await db+ .delete(issueChecklist)+ .where(eq(issueChecklist.id, checklistId))+ .returning({ issueId: issueChecklist.issueId, title: issueChecklist.title });+ if (!removed) return false;++ await recordActivity(+ removed.issueId,+ [{ action: 'checklist_remove', fromText: removed.title }],+ actorUserId,+ );+ return true;+}++// Sets the order of an issue's checklists to orderedIds. Ids that belong to another+// issue are not matched by the update, so they cannot be moved through it; ids the+// caller left out keep their position and sort after the ones it listed.+export async function reorderChecklists(+ issueId: number,+ orderedIds: number[],+): Promise<ChecklistRow[]> {+ await db.transaction(async (tx) => {+ for (const [position, id] of orderedIds.entries()) {+ await tx+ .update(issueChecklist)+ .set({ position })+ .where(and(eq(issueChecklist.id, id), eq(issueChecklist.issueId, issueId)));+ }+ });+ return listChecklists(issueId);+}++async function listItems(checklistId: number): Promise<ChecklistItemRow[]> {+ return db+ .select(itemColumns)+ .from(issueChecklistItem)+ .where(eq(issueChecklistItem.checklistId, checklistId))+ .orderBy(asc(issueChecklistItem.position), asc(issueChecklistItem.id));+}++export async function createChecklistItem(+ checklistId: number,+ content: string,+ actorUserId?: string | null,+): Promise<ChecklistItemRow> {+ const checklist = await checklistContext(checklistId);+ const [row] = await db+ .insert(issueChecklistItem)+ .values({+ checklistId,+ content,+ position: sql<number>`(select coalesce(max(${issueChecklistItem.position}), 0) + 1000 from ${issueChecklistItem} where ${eq(issueChecklistItem.checklistId, checklistId)})`,+ })+ .returning(itemColumns);++ await recordActivity(+ checklist.issueId,+ [{ action: 'checklist_item_add', subject: checklist.title, toText: content }],+ actorUserId,+ );+ return row;+}++export async function updateChecklistItem(+ itemId: number,+ patch: { content?: string; done?: boolean },+): Promise<ChecklistItemRow> {+ // Both fields are optional, so a patch can carry neither. Drizzle rejects an+ // empty `set`, so read the item back instead of writing nothing.+ if (patch.content === undefined && patch.done === undefined) {+ const [current] = await db+ .select(itemColumns)+ .from(issueChecklistItem)+ .where(eq(issueChecklistItem.id, itemId));+ if (!current) throw new HttpError(404, 'Checklist item not found');+ return current;+ }++ const [row] = await db+ .update(issueChecklistItem)+ .set(patch)+ .where(eq(issueChecklistItem.id, itemId))+ .returning(itemColumns);+ if (!row) throw new HttpError(404, 'Checklist item not found');+ return row;+}++export async function deleteChecklistItem(+ itemId: number,+ actorUserId?: string | null,+): Promise<boolean> {+ const [removed] = await db+ .delete(issueChecklistItem)+ .where(eq(issueChecklistItem.id, itemId))+ .returning({+ checklistId: issueChecklistItem.checklistId,+ content: issueChecklistItem.content,+ });+ if (!removed) return false;++ const checklist = await checklistContext(removed.checklistId);+ await recordActivity(+ checklist.issueId,+ [+ {+ action: 'checklist_item_remove',+ subject: checklist.title,+ fromText: removed.content,+ },+ ],+ actorUserId,+ );+ return true;+}++// Sets the order of a checklist's items, scoped to that checklist the same way+// reorderChecklists is scoped to its issue.+export async function reorderChecklistItems(+ checklistId: number,+ orderedIds: number[],+): Promise<ChecklistItemRow[]> {+ await db.transaction(async (tx) => {+ for (const [position, id] of orderedIds.entries()) {+ await tx+ .update(issueChecklistItem)+ .set({ position })+ .where(and(eq(issueChecklistItem.id, id), eq(issueChecklistItem.checklistId, checklistId)));+ }+ });+ return listItems(checklistId);+}diff --git a/apps/api/src/issues/routes.ts b/apps/api/src/issues/routes.tsindex 8564e718..0df2f5b7 100644--- a/apps/api/src/issues/routes.ts+++ b/apps/api/src/issues/routes.ts@@ -50,6 +50,19 @@ import {type SubtaskMode,} from './subtasks';import { listIssueWatchers, setIssueWatching } from './watchers';+import {+ createChecklist,+ createChecklistItem,+ deleteChecklist,+ deleteChecklistItem,+ getChecklistIssueId,+ getChecklistItemIssueId,+ listChecklists,+ renameChecklist,+ reorderChecklistItems,+ reorderChecklists,+ updateChecklistItem,+} from './checklists';// Numeric path params are validated (and coerced string -> number) with t.Numeric,// so a non-numeric id is rejected with a 400 before reaching the store.@@ -202,8 +215,44 @@ const IssueWatcherResponse = t.Object({image: t.Nullable(t.String()),});+// ChecklistItemRow / ChecklistRow from checklists.ts.+const ChecklistItemResponse = t.Object({+ id: t.Number(),+ content: t.String(),+ done: t.Boolean(),+ position: t.Number(),+});++const ChecklistResponse = t.Object({+ id: t.Number(),+ title: t.String(),+ position: t.Number(),+ items: t.Array(ChecklistItemResponse),+});++const ChecklistTitleSchema = t.String({+ minLength: 1,+ maxLength: 200,+ description: 'Title of the checklist.',+});++const ChecklistItemContentSchema = t.String({+ minLength: 1,+ maxLength: 500,+ description: 'Text of the checklist item.',+});++// A reorder sends the ids in their new order. Ids outside the parent in the path+// are ignored, and ones left out keep their position after the listed ones.+const OrderedIdsSchema = t.Object({+ orderedIds: t.Array(t.Integer(), { minItems: 1 }),+});++const checklistParams = t.Object({ checklistId: t.Numeric() });+const checklistItemParams = t.Object({ itemId: t.Numeric() });+// GET /issues/:issueId returns the full issue plus its custom field values, its-// relations to other issues, and the members watching it.+// relations to other issues, the members watching it, and its checklists.const IssueWithFieldsResponse = t.Composite([IssueResponse,t.Object({@@ -212,6 +261,7 @@ const IssueWithFieldsResponse = t.Composite([watchers: t.Array(IssueWatcherResponse),parent: t.Nullable(IssueRefResponse),subtasks: t.Array(IssueRefResponse),+ checklists: t.Array(ChecklistResponse),}),]);@@ -312,12 +362,22 @@ const TimelineSegmentResponse = t.Object({export const issueRoutes = new Elysia({ name: 'issues', detail: { tags: ['Issues'] } }).use(authContext).use(guards)- // Guard for routes that address an issue by its own id (no :projectKey in the- // path). Set `workItem: "<action>"` in the route options.+ // Guards for routes that address an entity by its own id (no :projectKey in the+ // path). Set `workItem` / `checklist` / `checklistItem` to the action in the+ // route options. A checklist and its items are part of the issue they hang on,+ // so all three resolve to the same work_items permission..macro({workItem: entityGuard('work_items', 'Issue not found', (p) =>getIssueProjectId(Number(p.issueId)),),+ checklist: entityGuard('work_items', 'Checklist not found', async (p) => {+ const issueId = await getChecklistIssueId(Number(p.checklistId));+ return issueId == null ? null : getIssueProjectId(issueId);+ }),+ checklistItem: entityGuard('work_items', 'Checklist item not found', async (p) => {+ const issueId = await getChecklistItemIssueId(Number(p.itemId));+ return issueId == null ? null : getIssueProjectId(issueId);+ }),}).post('/projects/:projectKey/issues',@@ -717,7 +777,8 @@ export const issueRoutes = new Elysia({ name: 'issues', detail: { tags: ['Issuesconst watchers = await listIssueWatchers(project.id, issue.id);const parent = await getParentRef(issue.parentId);const subtasks = await listSubtasks(issue.id);- return { ...issue, fields, links, watchers, parent, subtasks };+ const checklists = await listChecklists(issue.id);+ return { ...issue, fields, links, watchers, parent, subtasks, checklists };},{params: t.Object({ projectKey: t.String(), sequenceNumber: t.Numeric() }),@@ -758,7 +819,8 @@ export const issueRoutes = new Elysia({ name: 'issues', detail: { tags: ['Issuesconst watchers = await listIssueWatchers(issue.projectId, issue.id);const parent = await getParentRef(issue.parentId);const subtasks = await listSubtasks(issue.id);- return { ...issue, fields, links, watchers, parent, subtasks };+ const checklists = await listChecklists(issue.id);+ return { ...issue, fields, links, watchers, parent, subtasks, checklists };},{params: issueParams,@@ -1073,6 +1135,211 @@ export const issueRoutes = new Elysia({ name: 'issues', detail: { tags: ['Issues},)+ // Checklists on the issue: lists of small steps that do not warrant a subtask.+ // The issue read already carries them, so this list route is for a refresh+ // after a checklist write rather than the first render.+ .get('/issues/:issueId/checklists', async ({ params }) => listChecklists(params.issueId), {+ params: issueParams,+ workItem: 'read',+ response: {+ 200: t.Array(ChecklistResponse),+ 400: ErrorResponse,+ 401: ErrorResponse,+ 403: ErrorResponse,+ 404: ErrorResponse,+ },+ detail: {+ summary: "List an issue's checklists",+ description: 'Every checklist of an issue with its items, both in display order.',+ },+ })++ .post(+ '/issues/:issueId/checklists',+ async ({ params, body, user, set }) => {+ set.status = 201;+ return createChecklist(params.issueId, body.title, requireUser(user).id);+ },+ {+ body: t.Object({ title: ChecklistTitleSchema }),+ params: issueParams,+ workItem: 'edit',+ response: {+ 201: ChecklistResponse,+ 400: ErrorResponse,+ 401: ErrorResponse,+ 403: ErrorResponse,+ 404: ErrorResponse,+ },+ detail: {+ summary: 'Add a checklist',+ description: 'Add a checklist to an issue. It starts empty; add its items separately.',+ },+ },+ )++ // Registered before /checklists/:checklistId so the literal segment wins over+ // the parameter.+ .put(+ '/issues/:issueId/checklists/reorder',+ async ({ params, body }) => reorderChecklists(params.issueId, body.orderedIds),+ {+ body: OrderedIdsSchema,+ params: issueParams,+ workItem: 'edit',+ response: {+ 200: t.Array(ChecklistResponse),+ 400: ErrorResponse,+ 401: ErrorResponse,+ 403: ErrorResponse,+ 404: ErrorResponse,+ },+ detail: {+ summary: "Reorder an issue's checklists",+ description: "Set the display order of an issue's checklists.",+ },+ },+ )++ .patch(+ '/checklists/:checklistId',+ async ({ params, body, user }) =>+ renameChecklist(params.checklistId, body.title, requireUser(user).id),+ {+ body: t.Object({ title: ChecklistTitleSchema }),+ params: checklistParams,+ checklist: 'edit',+ response: {+ 200: ChecklistResponse,+ 400: ErrorResponse,+ 401: ErrorResponse,+ 403: ErrorResponse,+ 404: ErrorResponse,+ },+ detail: { summary: 'Rename a checklist', description: "Change a checklist's title." },+ },+ )++ // Deleting a checklist deletes its items with it.+ .delete(+ '/checklists/:checklistId',+ async ({ params, user }) => {+ const removed = await deleteChecklist(params.checklistId, requireUser(user).id);+ if (!removed) throw new HttpError(404, 'Checklist not found');+ return noContent();+ },+ {+ params: checklistParams,+ checklist: 'edit',+ response: {+ 204: t.Void(),+ 400: ErrorResponse,+ 401: ErrorResponse,+ 403: ErrorResponse,+ 404: ErrorResponse,+ },+ detail: {+ summary: 'Delete a checklist',+ description: 'Delete a checklist and every item on it.',+ },+ },+ )++ .post(+ '/checklists/:checklistId/items',+ async ({ params, body, user, set }) => {+ set.status = 201;+ return createChecklistItem(params.checklistId, body.content, requireUser(user).id);+ },+ {+ body: t.Object({ content: ChecklistItemContentSchema }),+ params: checklistParams,+ checklist: 'edit',+ response: {+ 201: ChecklistItemResponse,+ 400: ErrorResponse,+ 401: ErrorResponse,+ 403: ErrorResponse,+ 404: ErrorResponse,+ },+ detail: {+ summary: 'Add a checklist item',+ description: 'Append an item to a checklist.',+ },+ },+ )++ .put(+ '/checklists/:checklistId/items/reorder',+ async ({ params, body }) => reorderChecklistItems(params.checklistId, body.orderedIds),+ {+ body: OrderedIdsSchema,+ params: checklistParams,+ checklist: 'edit',+ response: {+ 200: t.Array(ChecklistItemResponse),+ 400: ErrorResponse,+ 401: ErrorResponse,+ 403: ErrorResponse,+ 404: ErrorResponse,+ },+ detail: {+ summary: 'Reorder checklist items',+ description: 'Set the display order of the items within one checklist.',+ },+ },+ )++ // Edits the text, the checked state, or both. Checking a box is the most+ // frequent write here, so it is deliberately not written to the activity feed.+ .patch(+ '/checklists/items/:itemId',+ async ({ params, body }) => updateChecklistItem(params.itemId, body),+ {+ body: t.Object({+ content: t.Optional(ChecklistItemContentSchema),+ done: t.Optional(t.Boolean({ description: 'Whether the item is checked off.' })),+ }),+ params: checklistItemParams,+ checklistItem: 'edit',+ response: {+ 200: ChecklistItemResponse,+ 400: ErrorResponse,+ 401: ErrorResponse,+ 403: ErrorResponse,+ 404: ErrorResponse,+ },+ detail: {+ summary: 'Update a checklist item',+ description: "Change a checklist item's text, its checked state, or both.",+ },+ },+ )++ .delete(+ '/checklists/items/:itemId',+ async ({ params, user }) => {+ const removed = await deleteChecklistItem(params.itemId, requireUser(user).id);+ if (!removed) throw new HttpError(404, 'Checklist item not found');+ return noContent();+ },+ {+ params: checklistItemParams,+ checklistItem: 'edit',+ response: {+ 204: t.Void(),+ 400: ErrorResponse,+ 401: ErrorResponse,+ 403: ErrorResponse,+ 404: ErrorResponse,+ },+ detail: {+ summary: 'Delete a checklist item',+ description: 'Remove one item from a checklist.',+ },+ },+ )+// Follows the issue: the caller receives every notification it produces until// they unwatch it. Only ever the caller — one member does not subscribe// another. Reading the issue is enough, since watching adds no other access.diff --git a/apps/web/src/features/issue/components/detail/IssueChecklistAddInput.tsx b/apps/web/src/features/issue/components/detail/IssueChecklistAddInput.tsxnew file mode 100644index 00000000..01bccf05--- /dev/null+++ b/apps/web/src/features/issue/components/detail/IssueChecklistAddInput.tsx@@ -0,0 +1,55 @@+import { useEffect, useRef, useState } from 'react';+import { Input } from '@/components/ui/input';++// The one-line input that adds a checklist or an item. Enter submits and keeps the+// field focused so a list can be typed in one go; Escape and blurring an empty+// field close it.+export default function IssueChecklistAddInput({+ placeholder,+ maxLength,+ onSubmit,+ onClose,+}: {+ placeholder: string;+ // Matches the API's own bound, so an over-long entry is stopped here rather+ // than coming back as a 400.+ maxLength: number;+ onSubmit: (value: string) => void;+ onClose: () => void;+}) {+ const [value, setValue] = useState('');+ const ref = useRef<HTMLInputElement>(null);++ useEffect(() => {+ ref.current?.focus();+ }, []);++ function submit() {+ const trimmed = value.trim();+ if (!trimmed) return;+ onSubmit(trimmed);+ setValue('');+ ref.current?.focus();+ }++ return (+ <Input+ ref={ref}+ value={value}+ placeholder={placeholder}+ maxLength={maxLength}+ className="h-8"+ onChange={(e) => setValue(e.target.value)}+ onBlur={() => {+ if (!value.trim()) onClose();+ }}+ onKeyDown={(e) => {+ if (e.key === 'Enter') {+ e.preventDefault();+ submit();+ }+ if (e.key === 'Escape') onClose();+ }}+ />+ );+}diff --git a/apps/web/src/features/issue/components/detail/IssueChecklistCard.tsx b/apps/web/src/features/issue/components/detail/IssueChecklistCard.tsxnew file mode 100644index 00000000..4965447c--- /dev/null+++ b/apps/web/src/features/issue/components/detail/IssueChecklistCard.tsx@@ -0,0 +1,126 @@+import { useState } from 'react';+import { DndContext, closestCenter, type DragEndEvent } from '@dnd-kit/core';+import { SortableContext, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable';+import { CSS } from '@dnd-kit/utilities';+import { Plus } from 'lucide-react';+import { type Checklist } from '@/lib/api';+import { Button } from '@/components/ui/button';+import { useDndSensors } from '@/lib/dnd';+import { cn } from '@/lib/utils';+import { CHECKLIST_ITEM_MAX, reorderIds } from '../../utils/checklists';+import {+ useCreateChecklistItem,+ useDeleteChecklist,+ useDeleteChecklistItem,+ useRenameChecklist,+ useReorderChecklistItems,+ useUpdateChecklistItem,+} from '../../services/checklists.service';+import IssueChecklistAddInput from './IssueChecklistAddInput';+import IssueChecklistHeader from './IssueChecklistHeader';+import IssueChecklistItemRow from './IssueChecklistItemRow';++// One checklist: its title row and its items. The items are sortable within this+// checklist only — the SortableContext holds just its own item ids, so a row+// cannot be dragged into a different checklist.+export default function IssueChecklistCard({+ issueId,+ checklist,+ canEdit,+}: {+ issueId: number;+ checklist: Checklist;+ canEdit: boolean;+}) {+ const [adding, setAdding] = useState(false);+ const sensors = useDndSensors();+ const renameChecklist = useRenameChecklist();+ const deleteChecklist = useDeleteChecklist();+ const createItem = useCreateChecklistItem();+ const updateItem = useUpdateChecklistItem();+ const deleteItem = useDeleteChecklistItem();+ const reorderItems = useReorderChecklistItems();++ const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({+ id: checklist.id,+ disabled: !canEdit,+ });++ function handleDragEnd({ active, over }: DragEndEvent) {+ if (!over) return;+ const orderedIds = reorderIds(checklist.items, Number(active.id), Number(over.id));+ if (orderedIds) reorderItems.mutate({ issueId, checklistId: checklist.id, orderedIds });+ }++ return (+ <div+ ref={setNodeRef}+ style={{ transform: CSS.Transform.toString(transform), transition }}+ className={cn('group/list rounded-md border p-2', isDragging && 'opacity-40')}+ >+ <IssueChecklistHeader+ checklist={checklist}+ canEdit={canEdit}+ attributes={attributes}+ listeners={listeners}+ onRename={(title) => renameChecklist.mutate({ issueId, checklistId: checklist.id, title })}+ onDelete={() => deleteChecklist.mutate({ issueId, checklistId: checklist.id })}+ />++ <DndContext sensors={sensors} collisionDetection={closestCenter} onDragEnd={handleDragEnd}>+ <SortableContext+ items={checklist.items.map((item) => item.id)}+ strategy={verticalListSortingStrategy}+ >+ {checklist.items.map((item) => (+ <IssueChecklistItemRow+ key={item.id}+ item={item}+ canEdit={canEdit}+ onToggle={(done) =>+ updateItem.mutate({+ issueId,+ checklistId: checklist.id,+ itemId: item.id,+ patch: { done },+ })+ }+ onRename={(content) =>+ updateItem.mutate({+ issueId,+ checklistId: checklist.id,+ itemId: item.id,+ patch: { content },+ })+ }+ onRemove={() => deleteItem.mutate({ issueId, itemId: item.id })}+ />+ ))}+ </SortableContext>+ </DndContext>++ {canEdit &&+ (adding ? (+ <div className="mt-1 px-2">+ <IssueChecklistAddInput+ placeholder="Add an item…"+ maxLength={CHECKLIST_ITEM_MAX}+ onSubmit={(content) =>+ createItem.mutate({ issueId, checklistId: checklist.id, content })+ }+ onClose={() => setAdding(false)}+ />+ </div>+ ) : (+ <Button+ variant="ghost"+ size="sm"+ className="mt-1 h-7 w-full justify-start gap-1.5 text-muted-foreground"+ onClick={() => setAdding(true)}+ >+ <Plus className="size-4" /> Add an item+ </Button>+ ))}+ </div>+ );+}diff --git a/apps/web/src/features/issue/components/detail/IssueChecklistEditableText.tsx b/apps/web/src/features/issue/components/detail/IssueChecklistEditableText.tsxnew file mode 100644index 00000000..0c054333--- /dev/null+++ b/apps/web/src/features/issue/components/detail/IssueChecklistEditableText.tsx@@ -0,0 +1,75 @@+import { useEffect, useRef, useState } from 'react';+import { cn } from '@/lib/utils';++// A checklist title or item text, edited in place. Reads as plain text until it is+// clicked; Enter and blur commit, Escape puts the original back. An empty value is+// not a delete — it reverts, since deleting has its own control.+export default function IssueChecklistEditableText({+ value,+ maxLength,+ onCommit,+ readOnly,+ className,+}: {+ value: string;+ // Matches the API's own bound on this field.+ maxLength: number;+ onCommit: (next: string) => void;+ readOnly: boolean;+ className?: string;+}) {+ const [editing, setEditing] = useState(false);+ const [draft, setDraft] = useState(value);+ const ref = useRef<HTMLInputElement>(null);++ useEffect(() => {+ if (editing) ref.current?.select();+ }, [editing]);++ function commit() {+ const trimmed = draft.trim();+ if (trimmed && trimmed !== value) onCommit(trimmed);+ else setDraft(value);+ setEditing(false);+ }++ if (readOnly) return <span className={className}>{value}</span>;++ if (!editing)+ return (+ <button+ type="button"+ className={cn('flex-1 cursor-text truncate text-left', className)}+ onClick={() => {+ setDraft(value);+ setEditing(true);+ }}+ >+ {value}+ </button>+ );++ return (+ <input+ ref={ref}+ value={draft}+ maxLength={maxLength}+ className={cn(+ 'flex-1 rounded-sm bg-transparent ring-1 ring-ring/40 outline-none focus:ring-ring',+ className,+ )}+ onChange={(e) => setDraft(e.target.value)}+ onBlur={commit}+ onKeyDown={(e) => {+ if (e.key === 'Enter') {+ e.preventDefault();+ commit();+ }+ if (e.key === 'Escape') {+ setDraft(value);+ setEditing(false);+ }+ }}+ />+ );+}diff --git a/apps/web/src/features/issue/components/detail/IssueChecklistGrip.tsx b/apps/web/src/features/issue/components/detail/IssueChecklistGrip.tsxnew file mode 100644index 00000000..0c32e319--- /dev/null+++ b/apps/web/src/features/issue/components/detail/IssueChecklistGrip.tsx@@ -0,0 +1,37 @@+import { type useSortable } from '@dnd-kit/sortable';+import { GripVertical } from 'lucide-react';++// Taken from useSortable's own return type: dnd-kit does not export the listener+// map type from its package root, and reaching into its dist/ internals for it+// would break on any repackaging.+type Sortable = ReturnType<typeof useSortable>;++// The drag handle of a checklist or one of its items. The row itself is the+// sortable node and this is its handle, so the checkbox and the inline text stay+// clickable. Without the permission to edit it renders as a spacer, keeping the+// row's columns aligned with the ones that do have a handle.+export default function IssueChecklistGrip({+ canEdit,+ attributes,+ listeners,+ className,+}: {+ canEdit: boolean;+ attributes: Sortable['attributes'];+ listeners: Sortable['listeners'];+ className: string;+}) {+ if (!canEdit) return <span className="-ml-1 size-4" />;++ return (+ <button+ type="button"+ {...attributes}+ {...listeners}+ className={`-ml-1 cursor-grab touch-none text-muted-foreground/50 ${className}`}+ title="Drag to reorder"+ >+ <GripVertical className="size-4" />+ </button>+ );+}diff --git a/apps/web/src/features/issue/components/detail/IssueChecklistHeader.tsx b/apps/web/src/features/issue/components/detail/IssueChecklistHeader.tsxnew file mode 100644index 00000000..b0e84395--- /dev/null+++ b/apps/web/src/features/issue/components/detail/IssueChecklistHeader.tsx@@ -0,0 +1,66 @@+import { type useSortable } from '@dnd-kit/sortable';+import { Trash2 } from 'lucide-react';+import { type Checklist } from '@/lib/api';+import { Button } from '@/components/ui/button';+import { CHECKLIST_TITLE_MAX } from '../../utils/checklists';+import IssueChecklistEditableText from './IssueChecklistEditableText';+import IssueChecklistGrip from './IssueChecklistGrip';++type Sortable = ReturnType<typeof useSortable>;++// The title row of one checklist: its drag handle, the title edited in place, how+// many of its items are done, and the control that deletes the whole list.+export default function IssueChecklistHeader({+ checklist,+ canEdit,+ attributes,+ listeners,+ onRename,+ onDelete,+}: {+ checklist: Checklist;+ canEdit: boolean;+ attributes: Sortable['attributes'];+ listeners: Sortable['listeners'];+ onRename: (title: string) => void;+ onDelete: () => void;+}) {+ const done = checklist.items.filter((item) => item.done).length;++ return (+ <div className="mb-1 flex items-center gap-2 px-1">+ <IssueChecklistGrip+ canEdit={canEdit}+ attributes={attributes}+ listeners={listeners}+ className="group-hover/list:text-muted-foreground"+ />++ <IssueChecklistEditableText+ value={checklist.title}+ maxLength={CHECKLIST_TITLE_MAX}+ readOnly={!canEdit}+ onCommit={onRename}+ className="text-sm font-medium"+ />++ {checklist.items.length > 0 && (+ <span className="shrink-0 text-xs text-muted-foreground tabular-nums">+ {done}/{checklist.items.length}+ </span>+ )}++ {canEdit && (+ <Button+ variant="ghost"+ size="icon"+ className="size-6 shrink-0 opacity-0 group-hover/list:opacity-100 hover:text-destructive"+ aria-label={`Delete checklist ${checklist.title}`}+ onClick={onDelete}+ >+ <Trash2 className="size-3.5" />+ </Button>+ )}+ </div>+ );+}diff --git a/apps/web/src/features/issue/components/detail/IssueChecklistItemRow.tsx b/apps/web/src/features/issue/components/detail/IssueChecklistItemRow.tsxnew file mode 100644index 00000000..2d39540c--- /dev/null+++ b/apps/web/src/features/issue/components/detail/IssueChecklistItemRow.tsx@@ -0,0 +1,76 @@+import { useSortable } from '@dnd-kit/sortable';+import { CSS } from '@dnd-kit/utilities';+import { X } from 'lucide-react';+import { type ChecklistItem } from '@/lib/api';+import { Button } from '@/components/ui/button';+import { Checkbox } from '@/components/ui/checkbox';+import { cn } from '@/lib/utils';+import { CHECKLIST_ITEM_MAX } from '../../utils/checklists';+import IssueChecklistEditableText from './IssueChecklistEditableText';+import IssueChecklistGrip from './IssueChecklistGrip';++// One checkbox line. The row is the sortable node and the grip is its handle, so+// the checkbox and the text stay clickable while dragging is possible.+export default function IssueChecklistItemRow({+ item,+ canEdit,+ onToggle,+ onRename,+ onRemove,+}: {+ item: ChecklistItem;+ canEdit: boolean;+ onToggle: (done: boolean) => void;+ onRename: (content: string) => void;+ onRemove: () => void;+}) {+ const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({+ id: item.id,+ disabled: !canEdit,+ });++ return (+ <div+ ref={setNodeRef}+ style={{ transform: CSS.Transform.toString(transform), transition }}+ className={cn(+ 'group flex items-center gap-2 rounded-md px-2 py-1 hover:bg-accent/50',+ isDragging && 'opacity-40',+ )}+ >+ <IssueChecklistGrip+ canEdit={canEdit}+ attributes={attributes}+ listeners={listeners}+ className="group-hover:text-muted-foreground"+ />++ <Checkbox+ checked={item.done}+ disabled={!canEdit}+ aria-label={item.content}+ onCheckedChange={(checked) => onToggle(checked === true)}+ />++ <IssueChecklistEditableText+ value={item.content}+ maxLength={CHECKLIST_ITEM_MAX}+ readOnly={!canEdit}+ onCommit={onRename}+ className={cn('text-sm', item.done && 'text-muted-foreground line-through')}+ />++ {canEdit && (+ <Button+ variant="ghost"+ size="icon"+ className="size-6 shrink-0 opacity-0 group-hover:opacity-100 hover:text-destructive"+ aria-label={`Remove ${item.content}`}+ onClick={onRemove}+ >+ <X className="size-3.5" />+ </Button>+ )}+ </div>+ );+}diff --git a/apps/web/src/features/issue/components/detail/IssueChecklistsPanel.tsx b/apps/web/src/features/issue/components/detail/IssueChecklistsPanel.tsxnew file mode 100644index 00000000..b1ce1a51--- /dev/null+++ b/apps/web/src/features/issue/components/detail/IssueChecklistsPanel.tsx@@ -0,0 +1,95 @@+import { useState } from 'react';+import { DndContext, closestCenter, type DragEndEvent } from '@dnd-kit/core';+import { SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable';+import { Plus } from 'lucide-react';+import { type IssueWithLinks } from '@/lib/api';+import { usePermissions } from '@/hooks/usePermissions';+import { Button } from '@/components/ui/button';+import { useDndSensors } from '@/lib/dnd';+import { CHECKLIST_TITLE_MAX, checklistProgress, reorderIds } from '../../utils/checklists';+import { usePersistedOpen } from '../../hooks/usePersistedOpen';+import { useCreateChecklist, useReorderChecklists } from '../../services/checklists.service';+import IssueChecklistAddInput from './IssueChecklistAddInput';+import IssueChecklistCard from './IssueChecklistCard';+import IssueSectionHeading from './IssueSectionHeading';++// The issue's checklists: lists of small steps that do not warrant subtasks of+// their own. The tally counts every item of every checklist, so the heading says+// how much of the card is done without expanding it.+export default function IssueChecklistsPanel({ issue }: { issue: IssueWithLinks }) {+ const { can } = usePermissions();+ const canEdit = can('work_items', 'edit');+ const [adding, setAdding] = useState(false);+ const { open, toggle } = usePersistedOpen('issue-checklists-open');+ const sensors = useDndSensors();+ const createChecklist = useCreateChecklist();+ const reorderChecklists = useReorderChecklists();++ const checklists = issue.checklists;+ const progress = checklistProgress(checklists);+ const tally = progress.total > 0 ? `${progress.done}/${progress.total}` : undefined;++ function handleDragEnd({ active, over }: DragEndEvent) {+ if (!over) return;+ const orderedIds = reorderIds(checklists, Number(active.id), Number(over.id));+ if (orderedIds) reorderChecklists.mutate({ issueId: issue.id, orderedIds });+ }++ return (+ <div className={`mt-6 border-t pt-5 ${open ? '' : '-mb-2'}`}>+ <div className={`flex h-7 items-center justify-between gap-3 ${open ? 'mb-3' : ''}`}>+ <IssueSectionHeading label="Checklists" open={open} onToggle={toggle} tally={tally} />+ {open && canEdit && !adding && (+ <Button variant="ghost" size="sm" className="h-7 gap-1.5" onClick={() => setAdding(true)}>+ <Plus className="size-4" /> Add+ </Button>+ )}+ </div>++ {open && (+ <>+ {checklists.length === 0 && !adding ? (+ <p className="rounded-md border border-dashed p-4 text-center text-sm text-muted-foreground">+ {canEdit+ ? 'Use Add to track small steps without creating subtasks.'+ : 'No checklists yet.'}+ </p>+ ) : (+ <DndContext+ sensors={sensors}+ collisionDetection={closestCenter}+ onDragEnd={handleDragEnd}+ >+ <SortableContext+ items={checklists.map((checklist) => checklist.id)}+ strategy={verticalListSortingStrategy}+ >+ <div className="flex flex-col gap-2">+ {checklists.map((checklist) => (+ <IssueChecklistCard+ key={checklist.id}+ issueId={issue.id}+ checklist={checklist}+ canEdit={canEdit}+ />+ ))}+ </div>+ </SortableContext>+ </DndContext>+ )}++ {adding && (+ <div className="mt-2">+ <IssueChecklistAddInput+ placeholder="Checklist title…"+ maxLength={CHECKLIST_TITLE_MAX}+ onSubmit={(title) => createChecklist.mutate({ issueId: issue.id, title })}+ onClose={() => setAdding(false)}+ />+ </div>+ )}+ </>+ )}+ </div>+ );+}diff --git a/apps/web/src/features/issue/components/detail/IssueDetailContent.tsx b/apps/web/src/features/issue/components/detail/IssueDetailContent.tsxindex d65c9bc2..1ee4b4d1 100644--- a/apps/web/src/features/issue/components/detail/IssueDetailContent.tsx+++ b/apps/web/src/features/issue/components/detail/IssueDetailContent.tsx@@ -4,6 +4,7 @@ import { usePermissions } from '@/hooks/usePermissions';import { useIssueDetail } from '../../hooks/useIssueDetail';import { usePersistedOpen } from '../../hooks/usePersistedOpen';import IssueAttachmentsPanel from './IssueAttachmentsPanel';+import IssueChecklistsPanel from './IssueChecklistsPanel';import IssueLinksPanel from './IssueLinksPanel';import IssueSubtasksPanel from './IssueSubtasksPanel';import IssueActivityFeed from './IssueActivityFeed';@@ -146,6 +147,8 @@ export default function IssueDetailContent({<IssueSubtasksPanel project={project} issue={issue} />+ <IssueChecklistsPanel issue={issue} />+<IssueLinksPanel project={project} issue={issue} /></>);diff --git a/apps/web/src/features/issue/services/checklists.service.ts b/apps/web/src/features/issue/services/checklists.service.tsnew file mode 100644index 00000000..398fac43--- /dev/null+++ b/apps/web/src/features/issue/services/checklists.service.ts@@ -0,0 +1,139 @@+// Checklists on an issue. They come with the issue detail read, so every mutation+// refreshes that query rather than one of its own. Checking a box and dragging a+// row write to the cache first: both are direct manipulations of something already+// on screen, and waiting for the round trip would make them feel broken.++import { useMutation, useQueryClient } from '@tanstack/react-query';+import { api, type Checklist, type IssueWithLinks } from '@/lib/api';+import { qk } from '@/services/queryKeys';++// Puts a list in the order given by ids. Ids that are not in the list are skipped,+// and anything the caller left out keeps its place at the end — the same rule the+// API applies, so the optimistic order matches what comes back.+function applyOrder<T extends { id: number }>(rows: T[], orderedIds: number[]): T[] {+ const byId = new Map(rows.map((row) => [row.id, row]));+ const ordered = orderedIds.map((id) => byId.get(id)).filter((row): row is T => !!row);+ const moved = new Set(ordered.map((row) => row.id));+ return [...ordered, ...rows.filter((row) => !moved.has(row.id))];+}++// The write-then-refresh mutations: the server owns the result, so the cache is+// only invalidated. The feed is refreshed too, since these are the changes that+// are logged to it.+function useChecklistMutation<TVars extends { issueId: number }>(+ run: (vars: TVars) => Promise<unknown>,+) {+ const qc = useQueryClient();+ return useMutation({+ mutationFn: run,+ onSuccess: (_data, { issueId }) => {+ void qc.invalidateQueries({ queryKey: qk.issue(issueId) });+ void qc.invalidateQueries({ queryKey: qk.feed(issueId) });+ },+ });+}++// The mutations that show their result before the server confirms it: the change+// is written into the cached issue, rolled back if the request fails, and settled+// by a refetch either way. None of them are logged to the feed, so only the issue+// is invalidated.+function useOptimisticChecklistMutation<TVars extends { issueId: number }>(+ run: (vars: TVars) => Promise<unknown>,+ change: (checklists: Checklist[], vars: TVars) => Checklist[],+) {+ const qc = useQueryClient();+ return useMutation({+ mutationFn: run,+ onMutate: async (vars: TVars) => {+ const key = qk.issue(vars.issueId);+ await qc.cancelQueries({ queryKey: key });+ const previous = qc.getQueryData<IssueWithLinks>(key);+ if (previous) {+ qc.setQueryData<IssueWithLinks>(key, {+ ...previous,+ checklists: change(previous.checklists, vars),+ });+ }+ return { previous };+ },+ onError: (_err, { issueId }, context) => {+ if (context?.previous) qc.setQueryData(qk.issue(issueId), context.previous);+ },+ onSettled: (_data, _err, { issueId }) => {+ void qc.invalidateQueries({ queryKey: qk.issue(issueId) });+ },+ });+}++export function useCreateChecklist() {+ return useChecklistMutation((vars: { issueId: number; title: string }) =>+ api.createChecklist(vars.issueId, vars.title),+ );+}++export function useRenameChecklist() {+ return useChecklistMutation((vars: { issueId: number; checklistId: number; title: string }) =>+ api.renameChecklist(vars.checklistId, vars.title),+ );+}++export function useDeleteChecklist() {+ return useChecklistMutation((vars: { issueId: number; checklistId: number }) =>+ api.deleteChecklist(vars.checklistId),+ );+}++export function useCreateChecklistItem() {+ return useChecklistMutation((vars: { issueId: number; checklistId: number; content: string }) =>+ api.createChecklistItem(vars.checklistId, vars.content),+ );+}++export function useDeleteChecklistItem() {+ return useChecklistMutation((vars: { issueId: number; itemId: number }) =>+ api.deleteChecklistItem(vars.itemId),+ );+}++export function useUpdateChecklistItem() {+ return useOptimisticChecklistMutation(+ (vars: {+ issueId: number;+ checklistId: number;+ itemId: number;+ patch: { content?: string; done?: boolean };+ }) => api.updateChecklistItem(vars.itemId, vars.patch),+ (checklists, { checklistId, itemId, patch }) =>+ checklists.map((checklist) =>+ checklist.id === checklistId+ ? {+ ...checklist,+ items: checklist.items.map((item) =>+ item.id === itemId ? { ...item, ...patch } : item,+ ),+ }+ : checklist,+ ),+ );+}++export function useReorderChecklists() {+ return useOptimisticChecklistMutation(+ (vars: { issueId: number; orderedIds: number[] }) =>+ api.reorderChecklists(vars.issueId, vars.orderedIds),+ (checklists, { orderedIds }) => applyOrder(checklists, orderedIds),+ );+}++export function useReorderChecklistItems() {+ return useOptimisticChecklistMutation(+ (vars: { issueId: number; checklistId: number; orderedIds: number[] }) =>+ api.reorderChecklistItems(vars.checklistId, vars.orderedIds),+ (checklists, { checklistId, orderedIds }) =>+ checklists.map((checklist) =>+ checklist.id === checklistId+ ? { ...checklist, items: applyOrder(checklist.items, orderedIds) }+ : checklist,+ ),+ );+}diff --git a/apps/web/src/features/issue/utils/activityText.tsx b/apps/web/src/features/issue/utils/activityText.tsxindex 2a3cf1de..491833ed 100644--- a/apps/web/src/features/issue/utils/activityText.tsx+++ b/apps/web/src/features/issue/utils/activityText.tsx@@ -9,6 +9,7 @@ import {CirclePlus,FileText,Link2,+ ListChecks,ListTree,Pencil,Shapes,@@ -43,6 +44,11 @@ export const ACTION_ICON: Record<ActivityAction, LucideIcon> = {parent: ListTree,subtask_add: ListTree,subtask_remove: ListTree,+ checklist_add: ListChecks,+ checklist_rename: ListChecks,+ checklist_remove: ListChecks,+ checklist_item_add: ListChecks,+ checklist_item_remove: ListChecks,field: Pencil,archived: Archive,restored: ArchiveRestore,@@ -149,6 +155,34 @@ export function describeActivity(a: FeedItem): { line: ReactNode; popover?: strireturn { line: <>added subtask {strong(a.toText)}</> };case 'subtask_remove':return { line: <>removed subtask {strong(a.fromText)}</> };+ case 'checklist_add':+ return { line: <>added checklist {strong(`“${a.toText}”`)}</> };+ case 'checklist_rename':+ return {+ line: (+ <>+ renamed checklist {strong(`“${a.fromText}”`)} to {strong(`“${a.toText}”`)}+ </>+ ),+ };+ case 'checklist_remove':+ return { line: <>removed checklist {strong(`“${a.fromText}”`)}</> };+ case 'checklist_item_add':+ return {+ line: (+ <>+ added {strong(`“${a.toText}”`)} to {strong(a.subject)}+ </>+ ),+ };+ case 'checklist_item_remove':+ return {+ line: (+ <>+ removed {strong(`“${a.fromText}”`)} from {strong(a.subject)}+ </>+ ),+ };case 'field':if (isLong(a.toText)) return { line: <>updated {strong(a.subject)}</>, popover: a.toText };return a.toTextdiff --git a/apps/web/src/features/issue/utils/checklists.ts b/apps/web/src/features/issue/utils/checklists.tsnew file mode 100644index 00000000..ed3639cf--- /dev/null+++ b/apps/web/src/features/issue/utils/checklists.ts@@ -0,0 +1,31 @@+import { arrayMove } from '@dnd-kit/sortable';++// The bounds the API validates against, mirrored so the inputs stop an over-long+// value before it becomes a rejected request.+export const CHECKLIST_TITLE_MAX = 200;+export const CHECKLIST_ITEM_MAX = 500;++// The id order a drag produces: the dragged row moved to where the row it was+// dropped on sits. Returns null when the drag changes nothing, so the caller can+// skip the write.+export function reorderIds(+ rows: { id: number }[],+ draggedId: number,+ targetId: number,+): number[] | null {+ const ids = rows.map((row) => row.id);+ const from = ids.indexOf(draggedId);+ const to = ids.indexOf(targetId);+ if (from === -1 || to === -1 || from === to) return null;+ return arrayMove(ids, from, to);+}++// How many of an issue's checklist items are checked off, across all of its+// checklists — the tally on the section heading.+export function checklistProgress(checklists: { items: { done: boolean }[] }[]): {+ done: number;+ total: number;+} {+ const items = checklists.flatMap((checklist) => checklist.items);+ return { done: items.filter((item) => item.done).length, total: items.length };+}diff --git a/apps/web/src/lib/api.ts b/apps/web/src/lib/api.tsindex 5bfca441..0dd2bed5 100644--- a/apps/web/src/lib/api.ts+++ b/apps/web/src/lib/api.ts@@ -1290,6 +1290,11 @@ export type ActivityAction =| 'parent'| 'subtask_add'| 'subtask_remove'+ | 'checklist_add'+ | 'checklist_rename'+ | 'checklist_remove'+ | 'checklist_item_add'+ | 'checklist_item_remove'| 'field'| 'archived'| 'restored';@@ -1496,15 +1501,33 @@ export interface SubtaskDisposition {newParentId?: number;}-// The issue as the detail routes return it: with its relations, its watchers, and-// its place in the subtask hierarchy. The public share bundle carries an-// IssueDetail instead — a shared page does not expose the issues on the other end-// of a relation, nor who follows the issue.+// One checkbox line of a checklist.+export interface ChecklistItem {+ id: number;+ content: string;+ done: boolean;+ position: number;+}++// A checklist on an issue: steps too small to be subtasks of their own. Both the+// checklists of an issue and the items of a checklist come back in display order.+export interface Checklist {+ id: number;+ title: string;+ position: number;+ items: ChecklistItem[];+}++// The issue as the detail routes return it: with its relations, its watchers, its+// place in the subtask hierarchy, and its checklists. The public share bundle+// carries an IssueDetail instead — a shared page does not expose the issues on the+// other end of a relation, nor who follows the issue.export interface IssueWithLinks extends IssueDetail {links: IssueLink[];watchers: IssueWatcher[];parent: IssueRef | null;subtasks: IssueRef[];+ checklists: Checklist[];}// Public read-only share bundles, returned by the /share/* routes with no session.@@ -2103,6 +2126,46 @@ export const api = {body: JSON.stringify(input),}),+ // Checklists on an issue. The issue read already carries them, so listChecklists+ // is for a refresh after a write rather than the first render. A reorder sends+ // the ids in their new order and returns the reordered list.+ listChecklists: (issueId: number) => request<Checklist[]>(`/issues/${issueId}/checklists`),+ createChecklist: (issueId: number, title: string) =>+ request<Checklist>(`/issues/${issueId}/checklists`, {+ method: 'POST',+ body: JSON.stringify({ title }),+ }),+ renameChecklist: (checklistId: number, title: string) =>+ request<Checklist>(`/checklists/${checklistId}`, {+ method: 'PATCH',+ body: JSON.stringify({ title }),+ }),+ deleteChecklist: (checklistId: number) =>+ request<void>(`/checklists/${checklistId}`, { method: 'DELETE' }),+ reorderChecklists: (issueId: number, orderedIds: number[]) =>+ request<Checklist[]>(`/issues/${issueId}/checklists/reorder`, {+ method: 'PUT',+ body: JSON.stringify({ orderedIds }),+ }),++ createChecklistItem: (checklistId: number, content: string) =>+ request<ChecklistItem>(`/checklists/${checklistId}/items`, {+ method: 'POST',+ body: JSON.stringify({ content }),+ }),+ updateChecklistItem: (itemId: number, patch: { content?: string; done?: boolean }) =>+ request<ChecklistItem>(`/checklists/items/${itemId}`, {+ method: 'PATCH',+ body: JSON.stringify(patch),+ }),+ deleteChecklistItem: (itemId: number) =>+ request<void>(`/checklists/items/${itemId}`, { method: 'DELETE' }),+ reorderChecklistItems: (checklistId: number, orderedIds: number[]) =>+ request<ChecklistItem[]>(`/checklists/${checklistId}/items/reorder`, {+ method: 'PUT',+ body: JSON.stringify({ orderedIds }),+ }),+listAttachments: (issueId: number) =>request<Attachment[]>(`/issues/${issueId}/attachments`).then((rows) =>rows.map(absolutizeAttachment),diff --git a/packages/db/drizzle/0062_black_marvel_zombies.sql b/packages/db/drizzle/0062_black_marvel_zombies.sqlnew file mode 100644index 00000000..6497a072--- /dev/null+++ b/packages/db/drizzle/0062_black_marvel_zombies.sql@@ -0,0 +1,21 @@+CREATE TABLE "issue_checklist" (+ "id" serial PRIMARY KEY NOT NULL,+ "issue_id" integer NOT NULL,+ "title" text NOT NULL,+ "position" double precision DEFAULT 0 NOT NULL,+ "created_at" timestamp with time zone DEFAULT now() NOT NULL+);+--> statement-breakpoint+CREATE TABLE "issue_checklist_item" (+ "id" serial PRIMARY KEY NOT NULL,+ "checklist_id" integer NOT NULL,+ "content" text NOT NULL,+ "done" boolean DEFAULT false NOT NULL,+ "position" double precision DEFAULT 0 NOT NULL,+ "created_at" timestamp with time zone DEFAULT now() NOT NULL+);+--> statement-breakpoint+ALTER TABLE "issue_checklist" ADD CONSTRAINT "issue_checklist_issue_id_issue_id_fk" FOREIGN KEY ("issue_id") REFERENCES "public"."issue"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "issue_checklist_item" ADD CONSTRAINT "issue_checklist_item_checklist_id_issue_checklist_id_fk" FOREIGN KEY ("checklist_id") REFERENCES "public"."issue_checklist"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+CREATE INDEX "issue_checklist_issue_idx" ON "issue_checklist" USING btree ("issue_id","position");--> statement-breakpoint+CREATE INDEX "issue_checklist_item_checklist_idx" ON "issue_checklist_item" USING btree ("checklist_id","position");\ No newline at end of filediff --git a/packages/db/drizzle/meta/0062_snapshot.json b/packages/db/drizzle/meta/0062_snapshot.jsonnew file mode 100644index 00000000..32aa5c79--- /dev/null+++ b/packages/db/drizzle/meta/0062_snapshot.json@@ -0,0 +1,5798 @@+{+ "id": "583300f4-b2ca-450b-bde8-6e5797834bc9",+ "prevId": "7630a13f-e49e-494b-8b93-c42dca787793",+ "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": 86400000+ },+ "rate_limit_max": {+ "name": "rate_limit_max",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "default": 10+ },+ "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', '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.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+ },+ "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+ },+ "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": {}+ }+ },+ "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_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+ }+ },+ "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+ },+ "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+ },+ "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')"+ }+ },+ "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+ },+ "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.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'"+ },+ "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 6a077f56..45ae8a90 100644--- a/packages/db/drizzle/meta/_journal.json+++ b/packages/db/drizzle/meta/_journal.json@@ -435,6 +435,13 @@"when": 1785754312249,"tag": "0061_marvelous_slayback","breakpoints": true+ },+ {+ "idx": 62,+ "version": "7",+ "when": 1785869451604,+ "tag": "0062_black_marvel_zombies",+ "breakpoints": true}]}\ No newline at end of filediff --git a/packages/db/src/schema/app.ts b/packages/db/src/schema/app.tsindex f013f282..22cf924d 100644--- a/packages/db/src/schema/app.ts+++ b/packages/db/src/schema/app.ts@@ -986,6 +986,39 @@ export const issueAttachment = pgTable((t) => [index('issue_attachment_issue_idx').on(t.issueId)],);+// Checklists on an issue: a lightweight list of steps that does not warrant a+// subtask of its own. An issue holds several checklists, each ordered by position+// among the issue's checklists.+export const issueChecklist = pgTable(+ 'issue_checklist',+ {+ id: serial('id').primaryKey(),+ issueId: integer('issue_id')+ .notNull()+ .references(() => issue.id, { onDelete: 'cascade' }),+ title: text('title').notNull(),+ position: doublePrecision('position').notNull().default(0),+ createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),+ },+ (t) => [index('issue_checklist_issue_idx').on(t.issueId, t.position)],+);++// One checkbox line of a checklist, ordered by position within its checklist.+export const issueChecklistItem = pgTable(+ 'issue_checklist_item',+ {+ id: serial('id').primaryKey(),+ checklistId: integer('checklist_id')+ .notNull()+ .references(() => issueChecklist.id, { onDelete: 'cascade' }),+ content: text('content').notNull(),+ done: boolean('done').notNull().default(false),+ position: doublePrecision('position').notNull().default(0),+ createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),+ },+ (t) => [index('issue_checklist_item_checklist_idx').on(t.checklistId, t.position)],+);+// Timeline of comments and change-log activity for issues and initiatives, in one// table. Each row belongs to exactly one owner: an issue (issue_id) or an// initiative (initiative_id) — enforced by owner_check. kind selects which payload