⭐️⭐️⭐️ 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: log the time spent on an issue (#216)
Croff71d9cc79f6a0
diff --git a/apps/api/src/modules/agents/core/runtime/tools/catalog.ts b/apps/api/src/modules/agents/core/runtime/tools/catalog.tsindex 5474df3a..29bdd67b 100644--- a/apps/api/src/modules/agents/core/runtime/tools/catalog.ts+++ b/apps/api/src/modules/agents/core/runtime/tools/catalog.ts@@ -90,6 +90,13 @@ export const AGENT_ACTIONS: ToolMeta[] = [description: 'Remove a relation between two issues.',always: false,},+ {+ key: 'create_worklog',+ group: 'issues',+ label: 'Log time',+ description: 'Log the time spent on an issue, for example what a run of this agent took.',+ always: false,+ },{key: 'add_attachment',group: 'issues',diff --git a/apps/api/src/modules/cycles/model.ts b/apps/api/src/modules/cycles/model.tsindex 10e86e69..1accd8fc 100644--- a/apps/api/src/modules/cycles/model.ts+++ b/apps/api/src/modules/cycles/model.ts@@ -1,10 +1,8 @@import { t } from 'elysia';import { pageQueryFields, pageResponse } from '#shared/pagination';+import { isoDate } from '#shared/schemas';-const IsoDate = t.String({- pattern: '^\\d{4}-\\d{2}-\\d{2}$',- description: "Date 'YYYY-MM-DD'.",-});+const IsoDate = isoDate("Date 'YYYY-MM-DD'.");export const cycleParams = t.Object({ cycleId: t.Numeric() });diff --git a/apps/api/src/modules/issues/__tests__/integration/worklogs.test.ts b/apps/api/src/modules/issues/__tests__/integration/worklogs.test.tsnew file mode 100644index 00000000..88fcfd04--- /dev/null+++ b/apps/api/src/modules/issues/__tests__/integration/worklogs.test.ts@@ -0,0 +1,294 @@+import { describe, it, expect, beforeEach } from 'bun:test';+import { authedApi, type Api } from '#tests/helpers/app';+import { signUpTestUser } from '#tests/helpers/auth';+import { addProjectMember } from '#tests/helpers/members';+import { resetDb } from '#tests/helpers/db';++// The time logged on an issue: one entry per stretch of work, each belonging to the+// member who logged it. The entries are read on their own+// (GET /issues/:issueId/worklogs); the issue payload carries their sum as+// `loggedMinutes`. A member owns their entries — changing or deleting someone+// else's is a project owner's call, no matter what the role matrix grants.++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 });+}++const today = () => new Date().toISOString().slice(0, 10);++function dayFromToday(days: number): string {+ const date = new Date();+ date.setUTCDate(date.getUTCDate() + days);+ return date.toISOString().slice(0, 10);+}++function log(+ client: Api,+ issueId: number,+ body: { minutes: number; spentOn?: string; note?: string | null },+) {+ return client.issues({ issueId }).worklogs.post({ spentOn: today(), ...body });+}++async function entriesOf(client: Api, issueId: number) {+ const res = await client.issues({ issueId }).worklogs.get();+ return res.data!;+}++async function read(client: Api, issueId: number) {+ const res = await client.issues({ issueId }).get();+ return res.data!;+}++// spentOn is a date column, which the Treaty client revives into a Date; the day it+// names is what the tests assert.+function day(value: unknown): string {+ return new Date(value as string).toISOString().slice(0, 10);+}++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('worklogs', () => {+ beforeEach(async () => {+ await resetDb();+ });++ describe('logging time', () => {+ it('stores the minutes, the day and the note, and sums them on the issue', async () => {+ const { asOwner, columnId } = await setupProject();+ const issue = (await createIssue(asOwner, columnId)).data!;++ const res = await log(asOwner, issue.id, { minutes: 90, note: 'Pairing on the parser' });+ expect(res.status).toBe(201);+ expect(res.data).toMatchObject({+ issueId: issue.id,+ minutes: 90,+ note: 'Pairing on the parser',+ });+ expect(day(res.data!.spentOn)).toBe(today());+ expect(await read(asOwner, issue.id)).toMatchObject({ loggedMinutes: 90 });+ });++ it('logs on an earlier day and leaves the note unset', async () => {+ const { asOwner, columnId } = await setupProject();+ const issue = (await createIssue(asOwner, columnId)).data!;++ const res = await log(asOwner, issue.id, { minutes: 30, spentOn: dayFromToday(-3) });+ expect(res.status).toBe(201);+ expect(res.data).toMatchObject({ minutes: 30, note: null });+ expect(day(res.data!.spentOn)).toBe(dayFromToday(-3));+ });++ it('rejects a day in the future with 400', async () => {+ const { asOwner, columnId } = await setupProject();+ const issue = (await createIssue(asOwner, columnId)).data!;++ const res = await log(asOwner, issue.id, { minutes: 60, spentOn: dayFromToday(1) });+ expect(res.status).toBe(400);+ expect(await entriesOf(asOwner, issue.id)).toEqual([]);+ });++ it('rejects a day that is not a date with 400', async () => {+ const { asOwner, columnId } = await setupProject();+ const issue = (await createIssue(asOwner, columnId)).data!;++ expect((await log(asOwner, issue.id, { minutes: 60, spentOn: 'yesterday' })).status).toBe(+ 400,+ );+ });++ it('rejects no time and a time of zero with 400', async () => {+ const { asOwner, columnId } = await setupProject();+ const issue = (await createIssue(asOwner, columnId)).data!;++ expect(+ (+ await asOwner+ .issues({ issueId: issue.id })+ .worklogs.post({ spentOn: today() } as unknown as { minutes: number; spentOn: string })+ ).status,+ ).toBe(400);+ expect((await log(asOwner, issue.id, { minutes: 0 })).status).toBe(400);+ });++ it('rejects a note over 500 characters with 400', async () => {+ const { asOwner, columnId } = await setupProject();+ const issue = (await createIssue(asOwner, columnId)).data!;++ expect((await log(asOwner, issue.id, { minutes: 15, note: 'x'.repeat(501) })).status).toBe(+ 400,+ );+ expect((await log(asOwner, issue.id, { minutes: 15, note: 'x'.repeat(500) })).status).toBe(+ 201,+ );+ });++ it('keeps each member on their own entry and sums both onto the issue', async () => {+ const { asOwner, columnId } = await setupProject();+ const asMember = await addProjectMember(asOwner, 'MKT');+ const issue = (await createIssue(asOwner, columnId)).data!;++ await log(asOwner, issue.id, { minutes: 120 });+ await log(asMember, issue.id, { minutes: 45 });++ const entries = await entriesOf(asOwner, issue.id);+ expect(entries).toHaveLength(2);+ expect(new Set(entries.map((entry) => entry.userId)).size).toBe(2);+ expect(await read(asOwner, issue.id)).toMatchObject({ loggedMinutes: 165 });+ });++ it('lists the entries newest day first', async () => {+ const { asOwner, columnId } = await setupProject();+ const issue = (await createIssue(asOwner, columnId)).data!;++ await log(asOwner, issue.id, { minutes: 60, spentOn: dayFromToday(-2) });+ await log(asOwner, issue.id, { minutes: 30, spentOn: today() });++ expect((await entriesOf(asOwner, issue.id)).map((entry) => entry.minutes)).toEqual([30, 60]);+ });++ it('denies a non-member with 403', async () => {+ const { asOwner, columnId } = await setupProject();+ const issue = (await createIssue(asOwner, columnId)).data!;+ const outsider = await signUpTestUser();++ expect((await log(authedApi(outsider.cookie), issue.id, { minutes: 60 })).status).toBe(403);+ });+ });++ describe('changing and deleting an entry', () => {+ it('changes the time, the day and the note of an own entry', async () => {+ const { asOwner, columnId } = await setupProject();+ const issue = (await createIssue(asOwner, columnId)).data!;+ const entry = (await log(asOwner, issue.id, { minutes: 60 })).data!;++ const res = await asOwner+ .worklogs({ worklogId: entry.id })+ .patch({ minutes: 75, spentOn: dayFromToday(-1), note: 'Review too' });+ expect(res.status).toBe(200);+ expect(res.data).toMatchObject({ minutes: 75, note: 'Review too' });+ expect(day(res.data!.spentOn)).toBe(dayFromToday(-1));+ expect(await read(asOwner, issue.id)).toMatchObject({ loggedMinutes: 75 });+ });++ it('rejects moving an entry to a future day with 400', async () => {+ const { asOwner, columnId } = await setupProject();+ const issue = (await createIssue(asOwner, columnId)).data!;+ const entry = (await log(asOwner, issue.id, { minutes: 60 })).data!;++ const res = await asOwner+ .worklogs({ worklogId: entry.id })+ .patch({ spentOn: dayFromToday(1) });+ expect(res.status).toBe(400);+ });++ it('deletes an own entry and lowers the sum by that entry alone', async () => {+ const { asOwner, columnId } = await setupProject();+ const issue = (await createIssue(asOwner, columnId)).data!;+ const kept = (await log(asOwner, issue.id, { minutes: 60 })).data!;+ const entry = (await log(asOwner, issue.id, { minutes: 30 })).data!;++ expect((await asOwner.worklogs({ worklogId: entry.id }).delete()).status).toBe(204);+ expect(await read(asOwner, issue.id)).toMatchObject({ loggedMinutes: 60 });+ expect((await entriesOf(asOwner, issue.id)).map((e) => e.id)).toEqual([kept.id]);+ });++ // The default member role carries work_items delete, so this member may delete+ // the issue itself and still not touch what someone else logged on it.+ it("answers 403 on another member's entry for a member who is not an owner", async () => {+ const { asOwner, columnId } = await setupProject();+ const asMember = await addProjectMember(asOwner, 'MKT');+ const issue = (await createIssue(asOwner, columnId)).data!;+ const entry = (await log(asOwner, issue.id, { minutes: 60 })).data!;++ expect((await asMember.worklogs({ worklogId: entry.id }).patch({ minutes: 5 })).status).toBe(+ 403,+ );+ expect((await asMember.worklogs({ worklogId: entry.id }).delete()).status).toBe(403);+ expect(await read(asOwner, issue.id)).toMatchObject({ loggedMinutes: 60 });+ });++ it("lets a project owner change another member's entry", async () => {+ const { asOwner, columnId } = await setupProject();+ const asMember = await addProjectMember(asOwner, 'MKT');+ const issue = (await createIssue(asOwner, columnId)).data!;+ const entry = (await log(asMember, issue.id, { minutes: 60 })).data!;++ expect((await asOwner.worklogs({ worklogId: entry.id }).patch({ minutes: 30 })).status).toBe(+ 200,+ );+ expect((await asOwner.worklogs({ worklogId: entry.id }).delete()).status).toBe(204);+ });++ it('answers 404 for an entry that does not exist', async () => {+ const { asOwner } = await setupProject();++ expect((await asOwner.worklogs({ worklogId: 999999 }).delete()).status).toBe(404);+ expect((await asOwner.worklogs({ worklogId: 999999 }).patch({ minutes: 5 })).status).toBe(+ 404,+ );+ });+ });++ describe('activity', () => {+ it('writes an entry to the feed for logging, changing and deleting', async () => {+ const { asOwner, columnId } = await setupProject();+ const issue = (await createIssue(asOwner, columnId)).data!;+ const entry = (await log(asOwner, issue.id, { minutes: 60 })).data!;+ await asOwner.worklogs({ worklogId: entry.id }).patch({ minutes: 90 });+ await asOwner.worklogs({ worklogId: entry.id }).delete();++ expect((await feedActions(asOwner, issue.id)).filter((a) => a === 'worklog')).toHaveLength(3);+ });++ it('carries the time and the day, and what a change replaced', async () => {+ const { asOwner, columnId } = await setupProject();+ const issue = (await createIssue(asOwner, columnId)).data!;+ const entry = (await log(asOwner, issue.id, { minutes: 90, spentOn: dayFromToday(-1) }))+ .data!;+ await asOwner.worklogs({ worklogId: entry.id }).patch({ minutes: 120, spentOn: today() });++ const feed = (await asOwner.issues({ issueId: issue.id }).feed.get({ query: {} })).data!;+ const changed = feed.items.find((item) => item.action === 'worklog')!;+ expect(changed.payload.from).toMatchObject({ value: '1h 30m' });+ expect(day(changed.payload.from!.date)).toBe(dayFromToday(-1));+ expect(changed.payload.to).toMatchObject({ value: '2h' });+ expect(day(changed.payload.to!.date)).toBe(today());+ });++ it('leaves the feed alone when a patch changes neither the time nor the day', async () => {+ const { asOwner, columnId } = await setupProject();+ const issue = (await createIssue(asOwner, columnId)).data!;+ const entry = (await log(asOwner, issue.id, { minutes: 60 })).data!;+ await asOwner.worklogs({ worklogId: entry.id }).patch({ note: 'Typo fixed' });++ expect((await feedActions(asOwner, issue.id)).filter((a) => a === 'worklog')).toHaveLength(1);+ });+ });++ it('deletes the entries with the issue', async () => {+ const { asOwner, columnId } = await setupProject();+ const issue = (await createIssue(asOwner, columnId)).data!;+ const entry = (await log(asOwner, issue.id, { minutes: 60 })).data!;++ await asOwner.issues({ issueId: issue.id }).delete();++ expect((await asOwner.worklogs({ worklogId: entry.id }).delete()).status).toBe(404);+ });+});diff --git a/apps/api/src/modules/issues/activity.ts b/apps/api/src/modules/issues/activity.tsindex 87334058..ab286ad2 100644--- a/apps/api/src/modules/issues/activity.ts+++ b/apps/api/src/modules/issues/activity.ts@@ -581,16 +581,19 @@ export interface IssueSnapshot {dueDate: string | null;}-// A time estimate as the feed shows it, the same wording the issue properties use:+// A duration as the feed shows it, the same wording the issue properties use:// 90 -> '1h 30m', 120 -> '2h', 30 -> '30m'.-function estimateTimeText(minutes: number | null): string | null {- if (minutes == null) return null;+export function timeText(minutes: number): string {const hours = Math.floor(minutes / 60);const rest = minutes % 60;if (!hours) return `${rest}m`;return rest ? `${hours}h ${rest}m` : `${hours}h`;}+function estimateTimeText(minutes: number | null): string | null {+ return minutes == null ? null : timeText(minutes);+}+// Diffs an issue's before/after state and records one event per changed field.// Priority and dates are stored as their raw value (the UI maps priority to a// label and formats dates); description stores only the new value (it is long,diff --git a/apps/api/src/modules/issues/index.ts b/apps/api/src/modules/issues/index.tsindex 4a4f5ad5..3e49edd7 100644--- a/apps/api/src/modules/issues/index.ts+++ b/apps/api/src/modules/issues/index.ts@@ -1,11 +1,9 @@import { Elysia, t } from 'elysia';import { mcpTool } from '#mcp/generate';import { noContent } from '#shared/http';-import { guards, entityGuard } from '#shared/guards';+import { guards, entityGuard, assertMcpAllowed } from '#shared/guards';import { authContext } from '#shared/auth-context';-import { assertPermission, assertMcpEnabled, requireUser } from '#shared/access';-import { isMcpRequest } from '#shared/mcp-request';-import { getProjectById } from '#modules/projects/service';+import { assertPermission, assertProjectOwner, requireUser } from '#shared/access';import { HttpError } from '#shared/lib';import { accessErrors, commonErrors, errors } from '#shared/responses';import { deleteObject } from '#shared/s3';@@ -48,6 +46,13 @@ import {type SubtaskMode,} from './subtasks';import { listIssueWatchers, setIssueWatching } from './watchers';+import {+ createWorklog,+ deleteWorklog,+ getWorklogRef,+ listWorklogs,+ updateWorklog,+} from './worklogs';import { listIssueCycles } from './cycle-history';import {createChecklist,@@ -73,6 +78,10 @@ import {OrderedIdsSchema,checklistParams,checklistItemParams,+ worklogParams,+ WorklogResponse,+ createWorklogBody,+ updateWorklogBody,IssueWithFieldsResponse,IssueSearchHitResponse,FeedItemResponse,@@ -149,8 +158,9 @@ export const issueRoutes = new Elysia({ name: 'issues', detail: { tags: ['Issues.use(guards)// 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 belong to the issue that carries them,- // so all three resolve to the same work_items permission.+ // route options, `worklog` to true. A checklist, its items and a time entry+ // belong to the issue that carries them, so they all resolve to the same+ // work_items permission..macro({workItem: entityGuard('work_items', 'Issue not found', (p) =>getIssueProjectId(Number(p.issueId)),@@ -163,6 +173,24 @@ export const issueRoutes = new Elysia({ name: 'issues', detail: { tags: ['Issuesconst issueId = await getChecklistItemIssueId(Number(p.itemId));return issueId == null ? null : getIssueProjectId(issueId);}),+ // A time entry belongs to the member who logged it: they change and delete+ // their own with the work_items edit this asserts. Someone else's is a record+ // of what that member did, so only a project owner may touch it — no+ // permission on the matrix grants it. Hence not an ordinary entityGuard: the+ // rule depends on the row, not on the route.+ worklog(_enabled: boolean) {+ return {+ async resolve({ params, user, request }) {+ const entry = await getWorklogRef(Number((params as { worklogId: string }).worklogId));+ if (!entry) throw new HttpError(404, 'Time entry not found');+ await assertPermission(entry.projectId, user, 'work_items', 'edit');+ if (entry.userId !== requireUser(user).id)+ await assertProjectOwner(entry.projectId, user);+ await assertMcpAllowed(entry.projectId, request.headers);+ return { projectId: entry.projectId };+ },+ };+ },}).post('/projects/:projectKey/issues',@@ -416,10 +444,7 @@ export const issueRoutes = new Elysia({ name: 'issues', detail: { tags: ['Issuesawait assertPermission(issue.projectId, user, 'work_items', 'read');// This route resolves the project itself, so it also enforces the per-project// MCP toggle itself (it does not run through the workItem guard).- if (isMcpRequest(request.headers)) {- const project = await getProjectById(issue.projectId);- if (project) assertMcpEnabled(project, true);- }+ await assertMcpAllowed(issue.projectId, request.headers);const fields = await getIssueFieldValues(issue.id);const links = await listIssueLinks(issue.id);const watchers = await listIssueWatchers(issue.projectId, issue.id);@@ -784,6 +809,78 @@ export const issueRoutes = new Elysia({ name: 'issues', detail: { tags: ['Issues},)+ // The time logged on the issue. The entries are their own read: the issue payload+ // carries their sum, which is what a board and the Time property show, and only+ // the section that lists them needs the entries themselves.+ .get('/issues/:issueId/worklogs', async ({ params }) => listWorklogs(params.issueId), {+ params: issueParams,+ workItem: 'read',+ response: { 200: t.Array(WorklogResponse), ...commonErrors },+ detail: {+ summary: "List an issue's logged time",+ description:+ 'Every time entry on an issue, the newest day first. The time an issue took is the sum of them.',+ ...mcpTool('list_worklogs'),+ },+ })++ .post(+ '/issues/:issueId/worklogs',+ async ({ params, body, user, set }) => {+ set.status = 201;+ return createWorklog(params.issueId, requireUser(user).id, body);+ },+ {+ body: createWorklogBody,+ params: issueParams,+ workItem: 'edit',+ response: { 201: WorklogResponse, ...commonErrors },+ detail: {+ summary: 'Log time on an issue',+ description:+ 'Log the time spent on an issue. The entry belongs to whoever logs it, and the day it was spent on cannot be in the future.',+ ...mcpTool('create_worklog'),+ },+ },+ )++ .patch(+ '/worklogs/:worklogId',+ async ({ params, body, user }) => updateWorklog(params.worklogId, body, requireUser(user).id),+ {+ body: updateWorklogBody,+ params: worklogParams,+ worklog: true,+ response: { 200: WorklogResponse, ...commonErrors },+ detail: {+ summary: 'Change a time entry',+ description:+ "Change the time, the day or the note of an entry. Another member's entry needs work_items delete.",+ ...mcpTool('update_worklog'),+ },+ },+ )++ .delete(+ '/worklogs/:worklogId',+ async ({ params, user }) => {+ const removed = await deleteWorklog(params.worklogId, requireUser(user).id);+ if (!removed) throw new HttpError(404, 'Time entry not found');+ return noContent();+ },+ {+ params: worklogParams,+ worklog: true,+ response: { 204: t.Void(), ...commonErrors },+ detail: {+ summary: 'Delete a time entry',+ description:+ "Remove one entry, lowering the issue's logged time by it. Another member's entry needs work_items delete.",+ ...mcpTool('delete_worklog'),+ },+ },+ )+// 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/api/src/modules/issues/model.ts b/apps/api/src/modules/issues/model.tsindex 131ee02b..c6ed957b 100644--- a/apps/api/src/modules/issues/model.ts+++ b/apps/api/src/modules/issues/model.ts@@ -1,5 +1,6 @@import { t } from 'elysia';import { ActivityPayloadResponse } from '#shared/activity';+import { isoDate } from '#shared/schemas';// t.Numeric validates a numeric path param and coerces the string to a number. A// non-numeric id gets a 400 before it reaches the service.@@ -42,6 +43,8 @@ export const IssueResponse = t.Object({// Time is in minutes; the UI enters and shows it as hours and minutes.estimatePoints: t.Nullable(t.Number()),estimateMinutes: t.Nullable(t.Number()),+ // The sum of the issue's logged time entries, 0 when nothing was logged.+ loggedMinutes: t.Number(),startDate: t.Nullable(t.String()),dueDate: t.Nullable(t.String()),position: t.Number(),@@ -185,6 +188,34 @@ export const OrderedIdsSchema = t.Object({export const checklistParams = t.Object({ checklistId: t.Numeric() });export const checklistItemParams = t.Object({ itemId: t.Numeric() });+export const worklogParams = t.Object({ worklogId: t.Numeric() });++// WorklogRow from worklogs.ts: one entry of the time a member spent on the issue,+// with the author it belongs to.+export const WorklogResponse = t.Object({+ id: t.Number(),+ issueId: t.Number(),+ userId: t.String(),+ userName: t.Nullable(t.String()),+ userImage: t.Nullable(t.String()),+ minutes: t.Number(),+ spentOn: t.String(),+ note: t.Nullable(t.String()),+ createdAt: t.String(),+});++export const createWorklogBody = t.Object({+ // Whole minutes: the hours-and-minutes field is the UI's, and it sends what it+ // parsed.+ minutes: t.Integer({ minimum: 1, description: 'Time spent, in minutes.' }),+ spentOn: isoDate("The day the work was done on, 'YYYY-MM-DD'. Not a day in the future."),+ note: t.Optional(+ t.Nullable(t.String({ maxLength: 500, description: 'What the time went into. One line.' })),+ ),+});++export const updateWorklogBody = t.Partial(createWorklogBody);+// GET /issues/:issueId returns the full issue plus its custom field values, its// relations to other issues, the members watching it, and its checklists.export const IssueWithFieldsResponse = t.Composite([diff --git a/apps/api/src/modules/issues/service.ts b/apps/api/src/modules/issues/service.tsindex fe7079b5..796ef682 100644--- a/apps/api/src/modules/issues/service.ts+++ b/apps/api/src/modules/issues/service.ts@@ -53,6 +53,7 @@ import {type IssueSnapshot,} from './activity';import { autoWatchIssue } from './watchers';+import { attachLoggedMinutes } from './worklogs';import { recordCycleChange } from './cycle-history';import { mapAttachment, type AttachmentRow } from '#modules/attachments/service';import { notifyIssueChange, notifyTextMentions } from '#modules/notifications/service';@@ -112,6 +113,10 @@ export interface IssueRow {// Time is in minutes; the UI enters and shows it as hours and minutes.estimatePoints: number | null;estimateMinutes: number | null;+ // The time logged against the issue: the sum of its worklog entries, 0 when+ // nothing was logged. Carried here so a board reads it without a request per+ // issue. Populated by attachLoggedMinutes; mapIssue alone leaves it at 0.+ loggedMinutes: number;startDate: string | null;dueDate: string | null;position: number;@@ -158,6 +163,7 @@ function mapIssue(row: typeof issue.$inferSelect, projectKey: string): IssueRowpriority: row.priority,estimatePoints: numOrNull(row.estimatePoints),estimateMinutes: row.estimateMinutes,+ loggedMinutes: 0,startDate: row.startDate,dueDate: row.dueDate,position: num(row.position),@@ -234,6 +240,7 @@ export async function listIssues(project: ProjectRow): Promise<IssueRow[]> {await attachFieldValues(issues);await attachStatusSince(issues);await attachGroupings(issues);+ await attachLoggedMinutes(issues);return issues;}@@ -250,6 +257,7 @@ export async function listArchivedIssues(project: ProjectRow): Promise<IssueRow[await attachFieldValues(issues);await attachStatusSince(issues);await attachGroupings(issues);+ await attachLoggedMinutes(issues);return issues;}@@ -654,6 +662,7 @@ export async function getIssues(ids: number[]): Promise<IssueRow[]> {await attachLabels(issues);await attachStatusSince(issues);await attachGroupings(issues);+ await attachLoggedMinutes(issues);return issues;}@@ -674,6 +683,7 @@ export async function getIssueBySequence(await attachLabels([mapped]);await attachStatusSince([mapped]);await attachGroupings([mapped]);+ await attachLoggedMinutes([mapped]);return mapped;}diff --git a/apps/api/src/modules/issues/worklogs.ts b/apps/api/src/modules/issues/worklogs.tsnew file mode 100644index 00000000..b0eefcb7--- /dev/null+++ b/apps/api/src/modules/issues/worklogs.ts@@ -0,0 +1,210 @@+import { db, issue, issueWorklog, user } from '@repo/db';+import { desc, eq, inArray, sql } from 'drizzle-orm';+import { HttpError, iso } from '#shared/lib';+import { recordActivity, timeText } from './activity';++// The time members logged on an issue, one row per entry. The time an issue took is+// the sum of its entries, computed on read.++export interface WorklogRow {+ id: number;+ issueId: number;+ userId: string;+ userName: string | null;+ userImage: string | null;+ minutes: number;+ spentOn: string;+ note: string | null;+ createdAt: string;+}++export interface WorklogInput {+ minutes: number;+ spentOn: string;+ note?: string | null;+}++const worklogColumns = {+ id: issueWorklog.id,+ issueId: issueWorklog.issueId,+ userId: issueWorklog.userId,+ userName: user.name,+ userImage: user.image,+ minutes: issueWorklog.minutes,+ spentOn: issueWorklog.spentOn,+ note: issueWorklog.note,+ createdAt: issueWorklog.createdAt,+};++function mapWorklog(row: Omit<WorklogRow, 'createdAt'> & { createdAt: Date }): WorklogRow {+ return { ...row, createdAt: iso(row.createdAt) };+}++function worklogSide(entry: { id: number; minutes: number; spentOn: string }) {+ return { value: timeText(entry.minutes), id: entry.id, date: entry.spentOn };+}++// Rejects a day the work cannot have happened on yet. Today is the server's, so a+// member ahead of UTC logs their own late evening on the day it starts here.+function assertNotFuture(spentOn: string): void {+ if (spentOn > new Date().toISOString().slice(0, 10))+ throw new HttpError(400, 'Time cannot be logged on a future day');+}++// Every entry of an issue, the newest day first and the newest entry first within a+// day. The author's name and picture come along, so the section names them without+// a lookup of its own.+export async function listWorklogs(issueId: number): Promise<WorklogRow[]> {+ const rows = await db+ .select(worklogColumns)+ .from(issueWorklog)+ .innerJoin(user, eq(user.id, issueWorklog.userId))+ .where(eq(issueWorklog.issueId, issueId))+ .orderBy(desc(issueWorklog.spentOn), desc(issueWorklog.id));+ return rows.map(mapWorklog);+}++// Sums each issue's logged time and merges it onto the issues in place, leaving the+// zero mapIssue set for an issue nothing was logged on. One grouped query for the+// whole set, the same shape as the other per-issue enrichment.+export async function attachLoggedMinutes<T extends { id: number; loggedMinutes: number }>(+ issues: T[],+): Promise<void> {+ if (issues.length === 0) return;+ const rows = await db+ .select({+ issueId: issueWorklog.issueId,+ minutes: sql<number>`sum(${issueWorklog.minutes})::int`,+ })+ .from(issueWorklog)+ .where(+ inArray(+ issueWorklog.issueId,+ issues.map((i) => i.id),+ ),+ )+ .groupBy(issueWorklog.issueId);+ const byIssue = new Map(rows.map((row) => [row.issueId, row.minutes]));+ for (const i of issues) i.loggedMinutes = byIssue.get(i.id) ?? 0;+}++// The entry a route guard resolves: the issue it hangs on, the project behind that+// issue, and the member who logged it, which decides whether the caller may touch+// it. Null when there is no such entry.+export async function getWorklogRef(+ worklogId: number,+): Promise<{ issueId: number; projectId: number; userId: string } | null> {+ const rows = await db+ .select({+ issueId: issueWorklog.issueId,+ projectId: issue.projectId,+ userId: issueWorklog.userId,+ })+ .from(issueWorklog)+ .innerJoin(issue, eq(issue.id, issueWorklog.issueId))+ .where(eq(issueWorklog.id, worklogId));+ return rows[0] ?? null;+}++export async function createWorklog(+ issueId: number,+ userId: string,+ input: WorklogInput,+): Promise<WorklogRow> {+ assertNotFuture(input.spentOn);+ const [row] = await db+ .insert(issueWorklog)+ .values({+ issueId,+ userId,+ minutes: input.minutes,+ spentOn: input.spentOn,+ note: input.note ?? null,+ })+ .returning({ id: issueWorklog.id });++ await recordActivity(+ issueId,+ [{ action: 'worklog', to: worklogSide({ id: row.id, ...input }) }],+ userId,+ );+ return requireWorklog(row.id);+}++// One entry with its author, for the routes that return the row they wrote.+async function requireWorklog(worklogId: number): Promise<WorklogRow> {+ const rows = await db+ .select(worklogColumns)+ .from(issueWorklog)+ .innerJoin(user, eq(user.id, issueWorklog.userId))+ .where(eq(issueWorklog.id, worklogId));+ if (!rows[0]) throw new HttpError(404, 'Time entry not found');+ return mapWorklog(rows[0]);+}++// Changes an entry. The feed keeps what it held before, so a correction can be read+// against the time it replaced. Who may change whose is settled by the route guard.+export async function updateWorklog(+ worklogId: number,+ patch: Partial<WorklogInput>,+ actorUserId?: string | null,+): Promise<WorklogRow> {+ // Every field is optional, so a patch can carry none. Drizzle rejects an empty+ // `set`, and there would be nothing to write anyway.+ if (Object.keys(patch).length === 0) return requireWorklog(worklogId);+ if (patch.spentOn !== undefined) assertNotFuture(patch.spentOn);++ const [previous] = await db+ .select({+ id: issueWorklog.id,+ issueId: issueWorklog.issueId,+ minutes: issueWorklog.minutes,+ spentOn: issueWorklog.spentOn,+ })+ .from(issueWorklog)+ .where(eq(issueWorklog.id, worklogId));+ if (!previous) throw new HttpError(404, 'Time entry not found');++ const [row] = await db+ .update(issueWorklog)+ .set(patch)+ .where(eq(issueWorklog.id, worklogId))+ .returning({ minutes: issueWorklog.minutes, spentOn: issueWorklog.spentOn });++ if (row.minutes !== previous.minutes || row.spentOn !== previous.spentOn) {+ await recordActivity(+ previous.issueId,+ [+ {+ action: 'worklog',+ from: worklogSide(previous),+ to: worklogSide({ id: worklogId, ...row }),+ },+ ],+ actorUserId,+ );+ }+ return requireWorklog(worklogId);+}++// Deletes an entry, lowering the issue's logged time by that entry alone. Returns+// false when there is no such entry.+export async function deleteWorklog(+ worklogId: number,+ actorUserId?: string | null,+): Promise<boolean> {+ const [removed] = await db.delete(issueWorklog).where(eq(issueWorklog.id, worklogId)).returning({+ id: issueWorklog.id,+ issueId: issueWorklog.issueId,+ minutes: issueWorklog.minutes,+ spentOn: issueWorklog.spentOn,+ });+ if (!removed) return false;++ await recordActivity(+ removed.issueId,+ [{ action: 'worklog', from: worklogSide(removed) }],+ actorUserId,+ );+ return true;+}diff --git a/apps/api/src/modules/projects/__tests__/integration/projects.test.ts b/apps/api/src/modules/projects/__tests__/integration/projects.test.tsindex 27d1b0a2..3b353321 100644--- a/apps/api/src/modules/projects/__tests__/integration/projects.test.ts+++ b/apps/api/src/modules/projects/__tests__/integration/projects.test.ts@@ -318,12 +318,13 @@ describe('projects', () => {});});- it('copies the estimate kinds the source project carries', async () => {+ it('copies the estimate kinds and time logging the source project carries', async () => {const { api } = await signUpClient();await api.projects.post({ key: 'SRC', name: 'Source' });await api.projects({ projectKey: 'SRC' }).settings.estimates.patch({points: true,time: true,+ logging: true,});await api.projects({ projectKey: 'SRC' }).copy.post({ key: 'DST', name: 'Destination' });@@ -332,6 +333,7 @@ describe('projects', () => {expect(view.data?.project).toMatchObject({pointsEstimateEnabled: true,timeEstimateEnabled: true,+ timeLoggingEnabled: true,});});@@ -814,13 +816,14 @@ describe('projects', () => {describe('estimate settings', () => {const estimates = (client: Api) => client.projects({ projectKey: 'MKT' }).settings.estimates;- it('defaults a new project to both kinds off', async () => {+ it('defaults a new project to both kinds and time logging off', async () => {const { api } = await signUpClient();const created = await api.projects.post({ key: 'MKT', name: 'Marketing' });expect(created.data).toMatchObject({pointsEstimateEnabled: false,timeEstimateEnabled: false,+ timeLoggingEnabled: false,});});@@ -828,14 +831,15 @@ describe('projects', () => {const { api } = await signUpClient();await api.projects.post({ key: 'MKT', name: 'Marketing' });- const patch = await estimates(api).patch({ points: true, time: false });+ const patch = await estimates(api).patch({ points: true, time: false, logging: true });expect(patch.status).toBe(200);- expect(patch.data).toMatchObject({ points: true, time: false });+ expect(patch.data).toMatchObject({ points: true, time: false, logging: true });const view = await viewOf(api, 'MKT');expect(view.data?.project).toMatchObject({pointsEstimateEnabled: true,timeEstimateEnabled: false,+ timeLoggingEnabled: true,});});@@ -843,12 +847,12 @@ describe('projects', () => {const { api } = await signUpClient();await api.projects.post({ key: 'MKT', name: 'Marketing' });const view = await viewOf(api, 'MKT');- await estimates(api).patch({ points: true, time: true });+ await estimates(api).patch({ points: true, time: true, logging: false });const issue = await api.projects({ projectKey: 'MKT' }).issues.post({ columnId: view.data!.columns[0].id, title: 'Sized', estimatePoints: 5 });- await estimates(api).patch({ points: false, time: false });+ await estimates(api).patch({ points: false, time: false, logging: false });expect((await api.issues({ issueId: issue.data!.id }).get()).data).toMatchObject({estimatePoints: 5,});@@ -859,7 +863,9 @@ describe('projects', () => {await owner.api.projects.post({ key: 'MKT', name: 'Marketing' });const member = await addProjectMember(owner.api, 'MKT');- expect((await estimates(member).patch({ points: true, time: true })).status).toBe(403);+ expect(+ (await estimates(member).patch({ points: true, time: true, logging: true })).status,+ ).toBe(403);});it('lets a role with edit change the kinds', async () => {@@ -871,9 +877,9 @@ describe('projects', () => {});const member = await addProjectMember(owner.api, 'MKT', role.data!.id);- const res = await estimates(member).patch({ points: true, time: true });+ const res = await estimates(member).patch({ points: true, time: true, logging: true });expect(res.status).toBe(200);- expect(res.data).toMatchObject({ points: true, time: true });+ expect(res.data).toMatchObject({ points: true, time: true, logging: true });});});diff --git a/apps/api/src/modules/projects/copy.ts b/apps/api/src/modules/projects/copy.tsindex eafd1d4b..5b6ce79a 100644--- a/apps/api/src/modules/projects/copy.ts+++ b/apps/api/src/modules/projects/copy.ts@@ -233,6 +233,7 @@ function mapProjectRow(row: typeof project.$inferSelect): ProjectRow {issueStatsEnabled: row.issueStatsEnabled,pointsEstimateEnabled: row.pointsEstimateEnabled,timeEstimateEnabled: row.timeEstimateEnabled,+ timeLoggingEnabled: row.timeLoggingEnabled,createdAt: iso(row.createdAt),};}@@ -292,6 +293,7 @@ export async function copyProject(issueStatsEnabled: project.issueStatsEnabled,pointsEstimateEnabled: project.pointsEstimateEnabled,timeEstimateEnabled: project.timeEstimateEnabled,+ timeLoggingEnabled: project.timeLoggingEnabled,}).from(project).where(eq(project.id, sourceProjectId));diff --git a/apps/api/src/modules/projects/index.ts b/apps/api/src/modules/projects/index.tsindex 57b35d42..253b1ebe 100644--- a/apps/api/src/modules/projects/index.ts+++ b/apps/api/src/modules/projects/index.ts@@ -281,8 +281,9 @@ export const projectRoutes = new Elysia({ name: 'projects', detail: { tags: ['Pr},)- // The estimate kinds the issues carry. The current state comes with the project- // payload every member already gets, so only the write lives here.+ // The estimate kinds the issues carry and whether members log the time they+ // spend. The current state comes with the project payload every member already+ // gets, so only the write lives here..patch('/projects/:projectKey/settings/estimates',async ({ project, body }) => {@@ -294,7 +295,7 @@ export const projectRoutes = new Elysia({ name: 'projects', detail: { tags: ['Prbody: updateEstimatesBody,permission: ['workflow_config', 'edit'],response: { 200: EstimatesResponse, ...commonErrors },- detail: { summary: "Update a project's estimate kinds" },+ detail: { summary: "Update a project's estimate kinds and time logging" },},)diff --git a/apps/api/src/modules/projects/model.ts b/apps/api/src/modules/projects/model.tsindex 9521a4c0..875cbb56 100644--- a/apps/api/src/modules/projects/model.ts+++ b/apps/api/src/modules/projects/model.ts@@ -70,6 +70,7 @@ export const ProjectResponse = t.Object({issueStatsEnabled: t.Boolean(),pointsEstimateEnabled: t.Boolean(),timeEstimateEnabled: t.Boolean(),+ timeLoggingEnabled: t.Boolean(),createdAt: t.String(),});@@ -156,11 +157,13 @@ export const updateAutoArchiveBody = t.Object({canceledDays: t.Nullable(t.Integer({ minimum: 1 })),});-// The estimate kinds the project's issues carry (EstimateSettings from the-// service). Sent together, the same as the automations below.+// The estimate kinds the project's issues carry and whether its members log time+// (EstimateSettings from the service). Sent together, the same as the automations+// below.export const EstimatesResponse = t.Object({points: t.Boolean(),time: t.Boolean(),+ logging: t.Boolean(),});export const updateEstimatesBody = EstimatesResponse;diff --git a/apps/api/src/modules/projects/service.ts b/apps/api/src/modules/projects/service.tsindex 49b1b419..a72a9b84 100644--- a/apps/api/src/modules/projects/service.ts+++ b/apps/api/src/modules/projects/service.ts@@ -38,6 +38,7 @@ export interface ProjectRow {issueStatsEnabled: boolean;pointsEstimateEnabled: boolean;timeEstimateEnabled: boolean;+ timeLoggingEnabled: boolean;createdAt: string;}@@ -79,6 +80,7 @@ function mapProject(row: typeof project.$inferSelect): ProjectRow {issueStatsEnabled: row.issueStatsEnabled,pointsEstimateEnabled: row.pointsEstimateEnabled,timeEstimateEnabled: row.timeEstimateEnabled,+ timeLoggingEnabled: row.timeLoggingEnabled,createdAt: iso(row.createdAt),};}@@ -110,6 +112,7 @@ export async function listProjects(issueStatsEnabled: project.issueStatsEnabled,pointsEstimateEnabled: project.pointsEstimateEnabled,timeEstimateEnabled: project.timeEstimateEnabled,+ timeLoggingEnabled: project.timeLoggingEnabled,createdAt: project.createdAt,role: projectMember.role,rolePermissions: projectRole.permissions,@@ -333,26 +336,39 @@ export async function setProjectFeatures(return row ? mapProject(row) : null;}-// Which estimate kinds the project's issues carry. Held on the project row rather-// than in project_setting: every member's project payload already carries it, so a-// board knows whether estimates are on without a request of its own.+// Which estimate kinds the project's issues carry, and whether its members log the+// time they spend. Held on the project row rather than in project_setting: every+// member's project payload already carries it, so a board knows whether estimates+// are on without a request of its own. Logging is independent of the time estimate:+// a team can log time without estimating first.export interface EstimateSettings {points: boolean;time: boolean;+ logging: boolean;}-// Turns the estimate kinds on or off. A kind turned off keeps the estimates already-// set on the issues; they show again when it is turned back on.+// Turns them on or off. One turned off keeps what the issues already carry — the+// estimates, the logged entries — which show again when it is turned back on.export async function setEstimateSettings(projectId: number,input: EstimateSettings,): Promise<EstimateSettings | null> {const [row] = await db.update(project)- .set({ pointsEstimateEnabled: input.points, timeEstimateEnabled: input.time })+ .set({+ pointsEstimateEnabled: input.points,+ timeEstimateEnabled: input.time,+ timeLoggingEnabled: input.logging,+ }).where(eq(project.id, projectId)).returning();- return row ? { points: row.pointsEstimateEnabled, time: row.timeEstimateEnabled } : null;+ return row+ ? {+ points: row.pointsEstimateEnabled,+ time: row.timeEstimateEnabled,+ logging: row.timeLoggingEnabled,+ }+ : null;}// Auto-archive thresholds for a project. Stored in project_setting underdiff --git a/apps/api/src/shared/access.ts b/apps/api/src/shared/access.tsindex fe7cb42e..71203977 100644--- a/apps/api/src/shared/access.ts+++ b/apps/api/src/shared/access.ts@@ -103,6 +103,19 @@ export async function assertPermission(}}+// Asserts the user is an owner of the project, addressed by id — the parallel of+// assertPermission for a rule the role matrix cannot express, such as touching an+// entry another member owns.+export async function assertProjectOwner(+ projectId: number,+ user: AuthUser | undefined | null,+): Promise<void> {+ const current = requireUser(user);+ const role = await getMembership(projectId, current.id);+ if (!role) throw new HttpError(403, 'You do not have access to this project');+ if (role !== 'owner') throw new HttpError(403, 'Only a project owner can do this');+}+// Whether the user may perform the action, without throwing. For field-level// shaping inside a handler that is already access-gated (e.g. redacting a// secret for callers who may read but not edit).diff --git a/apps/api/src/shared/activity.ts b/apps/api/src/shared/activity.tsindex 3f82e695..308ccae0 100644--- a/apps/api/src/shared/activity.ts+++ b/apps/api/src/shared/activity.ts@@ -12,6 +12,8 @@ const ActivitySide = t.Object({// 'git_pr' carries the repository and the number behind "owner/repo#42".repo: t.Optional(t.String()),number: t.Optional(t.Number()),+ // 'worklog' carries the day its time was spent on, per side.+ date: t.Optional(t.Nullable(t.String())),});export const ActivityPayloadResponse = t.Object({diff --git a/apps/api/src/shared/guards.ts b/apps/api/src/shared/guards.tsindex 4681910d..fa9c4410 100644--- a/apps/api/src/shared/guards.ts+++ b/apps/api/src/shared/guards.ts@@ -49,15 +49,21 @@ export function entityGuard(const projectId = await resolveProjectId(params as Record<string, string>);if (projectId == null) throw new HttpError(404, notFound);await assertPermission(projectId, user, resource, action);- if (isMcpRequest(request.headers)) {- const project = await getProjectById(projectId);- if (project) assertMcpEnabled(project, true);- }+ await assertMcpAllowed(projectId, request.headers);return { projectId };},});}+// The per-project MCP toggle, for a route or a guard that resolved the project by+// its id rather than through one of the :projectKey macros. A plain request passes+// untouched.+export async function assertMcpAllowed(projectId: number, headers: Headers): Promise<void> {+ if (!isMcpRequest(headers)) return;+ const project = await getProjectById(projectId);+ if (project) assertMcpEnabled(project, true);+}+// The path param carried by every project-scoped route. The macros read it off// the resolved params; Elysia always parses path segments, so it is present at// runtime even on routes that do not declare a params schema.diff --git a/apps/api/src/shared/schemas.ts b/apps/api/src/shared/schemas.tsnew file mode 100644index 00000000..612175ce--- /dev/null+++ b/apps/api/src/shared/schemas.ts@@ -0,0 +1,8 @@+import { t } from 'elysia';++// Request schemas shared by more than one feature.++// A calendar day, as the `date` columns hold it. The caller passes what the date+// stands for on its route, which is what the OpenAPI docs and the MCP tools show.+export const isoDate = (description: string) =>+ t.String({ pattern: '^\\d{4}-\\d{2}-\\d{2}$', description });diff --git a/apps/web/messages/ar/issue.json b/apps/web/messages/ar/issue.jsonindex 23fb4726..d8e6c949 100644--- a/apps/web/messages/ar/issue.json+++ b/apps/web/messages/ar/issue.json@@ -18,8 +18,12 @@"initiative": "المبادرة","cycle": "الدورة","estimatePoints": "نقاط القصة",- "estimateTime": "الوقت",+ "estimateTime": "تقدير الوقت","estimateTimePlaceholder": "1h 30m",+ "timeTracking": "تتبع الوقت",+ "timeLoggedValue": "{time} مُسجَّل",+ "timeRemainingValue": "{time} متبقٍ",+ "timeOverBy": "{time} زيادة","startDate": "تاريخ البدء","dueDate": "تاريخ الاستحقاق","properties": "الخصائص",@@ -152,6 +156,17 @@"deleteChecklist": "حذف قائمة التحقّق {title}","addItemButton": "إضافة عنصر"},+ "worklog": {+ "title": "الوقت المسجّل",+ "empty": "لا يوجد وقت مسجّل بعد.",+ "emptyHint": "استخدم إضافة لتسجيل الوقت الذي قضيته على هذه المهمة.",+ "time": "الوقت المستغرق",+ "timePlaceholder": "1h 30m",+ "note": "ملاحظة",+ "notePlaceholder": "فيمَ ذهب الوقت",+ "edit": "تعديل هذا السجل",+ "remove": "حذف هذا السجل"+ },"links": {"title": "الروابط","remove": "إزالة الرابط إلى {issue}",@@ -299,7 +314,10 @@"agentFinished": "أنهى العمل على المهمة","agentFailed": "لم يتمكن من إنهاء المهمة","pullRequestMerged": "دمج طلب السحب <v>{pr}</v>",- "pullRequestOpened": "فتح طلب السحب <v>{pr}</v>"+ "pullRequestOpened": "فتح طلب السحب <v>{pr}</v>",+ "worklogAdded": "سجّل <v>{time}</v> ليوم <v>{date}</v>",+ "worklogChanged": "غيّر التسجيل من <v>{from}</v> ليوم <v>{fromDate}</v> إلى <v>{to}</v> ليوم <v>{date}</v>",+ "worklogRemoved": "حذف تسجيل <v>{time}</v> ليوم <v>{date}</v>"},"archived": "مؤرشفة","activityHeading": "النشاط",diff --git a/apps/web/messages/ar/settings.json b/apps/web/messages/ar/settings.jsonindex 7d31d89e..fa460b02 100644--- a/apps/web/messages/ar/settings.json+++ b/apps/web/messages/ar/settings.json@@ -421,6 +421,8 @@"pointsEstimateHint": "رقم عادي على كل مهمة.","timeEstimate": "الوقت","timeEstimateHint": "بيتكتب بالساعات والدقايق، مثلاً 1h 30m.",+ "timeLogging": "تسجيل الوقت",+ "timeLoggingHint": "يسجّل الأعضاء الوقت الذي يقضونه على المهمة.","archive": "الأرشفة","archiveHint": "أرشف المهام المقفولة الواقفة من زمان عشان اللوحة تفضل واضحة.","completedIssues": "المهام المكتملة",diff --git a/apps/web/messages/en/issue.json b/apps/web/messages/en/issue.jsonindex 83c1fd60..0019e365 100644--- a/apps/web/messages/en/issue.json+++ b/apps/web/messages/en/issue.json@@ -18,8 +18,12 @@"initiative": "Initiative","cycle": "Cycle","estimatePoints": "Story points",- "estimateTime": "Time",+ "estimateTime": "Time estimate","estimateTimePlaceholder": "1h 30m",+ "timeTracking": "Time tracking",+ "timeLoggedValue": "{time} logged",+ "timeRemainingValue": "{time} remaining",+ "timeOverBy": "{time} over","startDate": "Start date","dueDate": "Due date","properties": "Properties",@@ -152,6 +156,17 @@"deleteChecklist": "Delete checklist {title}","addItemButton": "Add an item"},+ "worklog": {+ "title": "Time logged",+ "empty": "No time logged yet.",+ "emptyHint": "Use Add to log the time you spent on this issue.",+ "time": "Time spent",+ "timePlaceholder": "1h 30m",+ "note": "Note",+ "notePlaceholder": "What the time went into",+ "edit": "Change this entry",+ "remove": "Delete this entry"+ },"links": {"title": "Links","remove": "Remove the link to {issue}",@@ -299,7 +314,10 @@"agentFinished": "finished working on the issue","agentFailed": "could not finish the issue","pullRequestMerged": "merged pull request <v>{pr}</v>",- "pullRequestOpened": "opened pull request <v>{pr}</v>"+ "pullRequestOpened": "opened pull request <v>{pr}</v>",+ "worklogAdded": "logged <v>{time}</v> on <v>{date}</v>",+ "worklogChanged": "changed the logged <v>{from}</v> on <v>{fromDate}</v> to <v>{to}</v> on <v>{date}</v>",+ "worklogRemoved": "removed the <v>{time}</v> logged on <v>{date}</v>"},"archived": "Archived","activityHeading": "Activity",diff --git a/apps/web/messages/en/settings.json b/apps/web/messages/en/settings.jsonindex bd7530eb..2c6e95c8 100644--- a/apps/web/messages/en/settings.json+++ b/apps/web/messages/en/settings.json@@ -421,6 +421,8 @@"pointsEstimateHint": "A plain number on each issue.","timeEstimate": "Time","timeEstimateHint": "Entered as hours and minutes, for example 1h 30m.",+ "timeLogging": "Time logging",+ "timeLoggingHint": "Members log the time they spend on an issue.","archive": "Archive","archiveHint": "Archive stale closed issues so the board stays clear.","completedIssues": "Completed issues",diff --git a/apps/web/messages/ru/issue.json b/apps/web/messages/ru/issue.jsonindex f61a6d51..141c3ea8 100644--- a/apps/web/messages/ru/issue.json+++ b/apps/web/messages/ru/issue.json@@ -18,8 +18,12 @@"initiative": "Инициатива","cycle": "Цикл","estimatePoints": "Стори-поинты",- "estimateTime": "Время",+ "estimateTime": "Оценка по времени","estimateTimePlaceholder": "1h 30m",+ "timeTracking": "Учёт времени",+ "timeLoggedValue": "записано {time}",+ "timeRemainingValue": "осталось {time}",+ "timeOverBy": "{time} сверх","startDate": "Дата начала","dueDate": "Дедлайн","properties": "Свойства",@@ -152,6 +156,17 @@"deleteChecklist": "Удалить чек-лист {title}","addItemButton": "Добавить пункт"},+ "worklog": {+ "title": "Затраченное время",+ "empty": "Время пока не записано.",+ "emptyHint": "Нажмите «Добавить», чтобы записать время, потраченное на задачу.",+ "time": "Затрачено",+ "timePlaceholder": "1h 30m",+ "note": "Заметка",+ "notePlaceholder": "На что ушло время",+ "edit": "Изменить запись",+ "remove": "Удалить запись"+ },"links": {"title": "Связи","remove": "Убрать связь с {issue}",@@ -299,7 +314,10 @@"agentFinished": "завершил(а) работу над задачей","agentFailed": "не смог(ла) завершить работу над задачей","pullRequestMerged": "смержил(а) пул-реквест <v>{pr}</v>",- "pullRequestOpened": "открыл(а) пул-реквест <v>{pr}</v>"+ "pullRequestOpened": "открыл(а) пул-реквест <v>{pr}</v>",+ "worklogAdded": "записал(а) <v>{time}</v> за <v>{date}</v>",+ "worklogChanged": "изменил(а) запись <v>{from}</v> за <v>{fromDate}</v> на <v>{to}</v> за <v>{date}</v>",+ "worklogRemoved": "удалил(а) запись <v>{time}</v> за <v>{date}</v>"},"archived": "В архиве","activityHeading": "Активность",diff --git a/apps/web/messages/ru/settings.json b/apps/web/messages/ru/settings.jsonindex 867f94c5..19d331d9 100644--- a/apps/web/messages/ru/settings.json+++ b/apps/web/messages/ru/settings.json@@ -421,6 +421,8 @@"pointsEstimateHint": "Обычное число на каждой задаче.","timeEstimate": "Время","timeEstimateHint": "Вводится часами и минутами, например 1h 30m.",+ "timeLogging": "Учёт времени",+ "timeLoggingHint": "Участники записывают время, потраченное на задачу.","archive": "Архив","archiveHint": "Архивировать залежавшиеся закрытые задачи, чтобы доска оставалась чистой.","completedIssues": "Выполненные задачи",diff --git a/apps/web/messages/uk/issue.json b/apps/web/messages/uk/issue.jsonindex 5fad05f3..b0456397 100644--- a/apps/web/messages/uk/issue.json+++ b/apps/web/messages/uk/issue.json@@ -18,8 +18,12 @@"initiative": "Ініціатива","cycle": "Цикл","estimatePoints": "Сторі-поїнти",- "estimateTime": "Час",+ "estimateTime": "Оцінка за часом","estimateTimePlaceholder": "1h 30m",+ "timeTracking": "Облік часу",+ "timeLoggedValue": "записано {time}",+ "timeRemainingValue": "залишилось {time}",+ "timeOverBy": "{time} понад","startDate": "Дата початку","dueDate": "Дедлайн","properties": "Властивості",@@ -152,6 +156,17 @@"deleteChecklist": "Видалити чекліст {title}","addItemButton": "Додати пункт"},+ "worklog": {+ "title": "Витрачений час",+ "empty": "Час ще не записано.",+ "emptyHint": "Натисніть «Додати», щоб записати час, витрачений на задачу.",+ "time": "Витрачено",+ "timePlaceholder": "1h 30m",+ "note": "Нотатка",+ "notePlaceholder": "На що пішов час",+ "edit": "Змінити запис",+ "remove": "Видалити запис"+ },"links": {"title": "Зв'язки","remove": "Прибрати зв'язок з {issue}",@@ -299,7 +314,10 @@"agentFinished": "завершив(-ла) роботу над задачею","agentFailed": "не зміг(-ла) завершити роботу над задачею","pullRequestMerged": "змержив(-ла) пул-реквест <v>{pr}</v>",- "pullRequestOpened": "відкрив(-ла) пул-реквест <v>{pr}</v>"+ "pullRequestOpened": "відкрив(-ла) пул-реквест <v>{pr}</v>",+ "worklogAdded": "записав(-ла) <v>{time}</v> за <v>{date}</v>",+ "worklogChanged": "змінив(-ла) запис <v>{from}</v> за <v>{fromDate}</v> на <v>{to}</v> за <v>{date}</v>",+ "worklogRemoved": "видалив(-ла) запис <v>{time}</v> за <v>{date}</v>"},"archived": "Архівовано","activityHeading": "Активність",diff --git a/apps/web/messages/uk/settings.json b/apps/web/messages/uk/settings.jsonindex 638c5c0b..4509c3b0 100644--- a/apps/web/messages/uk/settings.json+++ b/apps/web/messages/uk/settings.json@@ -421,6 +421,8 @@"pointsEstimateHint": "Звичайне число на кожній задачі.","timeEstimate": "Час","timeEstimateHint": "Вводиться годинами та хвилинами, наприклад 1h 30m.",+ "timeLogging": "Облік часу",+ "timeLoggingHint": "Учасники записують час, витрачений на задачу.","archive": "Архів","archiveHint": "Архівувати застояні закриті задачі, щоб дошка залишалася чистою.","completedIssues": "Виконані задачі",diff --git a/apps/web/messages/zh-CN/issue.json b/apps/web/messages/zh-CN/issue.jsonindex 886c2d54..6dd7cb6f 100644--- a/apps/web/messages/zh-CN/issue.json+++ b/apps/web/messages/zh-CN/issue.json@@ -18,8 +18,12 @@"initiative": "计划","cycle": "周期","estimatePoints": "故事点",- "estimateTime": "工时",+ "estimateTime": "工时估算","estimateTimePlaceholder": "1h 30m",+ "timeTracking": "工时跟踪",+ "timeLoggedValue": "已记录 {time}",+ "timeRemainingValue": "剩余 {time}",+ "timeOverBy": "超出 {time}","startDate": "开始日期","dueDate": "截止日期","properties": "属性",@@ -152,6 +156,17 @@"deleteChecklist": "删除检查清单 {title}","addItemButton": "添加清单项"},+ "worklog": {+ "title": "已记录工时",+ "empty": "尚未记录工时。",+ "emptyHint": "点击“添加”记录你在该事项上花费的时间。",+ "time": "花费时间",+ "timePlaceholder": "1h 30m",+ "note": "备注",+ "notePlaceholder": "时间花在了什么上",+ "edit": "修改这条记录",+ "remove": "删除这条记录"+ },"links": {"title": "关联","remove": "移除与 {issue} 的关联",@@ -299,7 +314,10 @@"agentFinished": "完成了该工作项的处理","agentFailed": "未能完成该工作项","pullRequestMerged": "合并了拉取请求 <v>{pr}</v>",- "pullRequestOpened": "打开了拉取请求 <v>{pr}</v>"+ "pullRequestOpened": "打开了拉取请求 <v>{pr}</v>",+ "worklogAdded": "记录了 <v>{date}</v> 的 <v>{time}</v>",+ "worklogChanged": "将 <v>{fromDate}</v> 的 <v>{from}</v> 改为 <v>{date}</v> 的 <v>{to}</v>",+ "worklogRemoved": "删除了 <v>{date}</v> 的 <v>{time}</v>"},"archived": "已归档","activityHeading": "活动记录",diff --git a/apps/web/messages/zh-CN/settings.json b/apps/web/messages/zh-CN/settings.jsonindex 8436ff88..8814e1a5 100644--- a/apps/web/messages/zh-CN/settings.json+++ b/apps/web/messages/zh-CN/settings.json@@ -421,6 +421,8 @@"pointsEstimateHint": "每个工作项上的一个数字。","timeEstimate": "工时","timeEstimateHint": "按小时和分钟填写,例如 1h 30m。",+ "timeLogging": "工时记录",+ "timeLoggingHint": "成员记录他们在事项上花费的时间。","archive": "归档","archiveHint": "归档已关闭的工作项,使看板保持整洁。","completedIssues": "已完成的工作项",diff --git a/apps/web/src/features/issue/components/detail/IssueDetailContent.tsx b/apps/web/src/features/issue/components/detail/IssueDetailContent.tsxindex b496cd8f..2192e17c 100644--- a/apps/web/src/features/issue/components/detail/IssueDetailContent.tsx+++ b/apps/web/src/features/issue/components/detail/IssueDetailContent.tsx@@ -11,6 +11,7 @@ import { useFilePaste } from '../../hooks/useFilePaste';import IssueAttachmentsPanel from './IssueAttachmentsPanel';import IssueChecklistsPanel from './IssueChecklistsPanel';import IssueLinksPanel from './IssueLinksPanel';+import IssueWorklogPanel from './IssueWorklogPanel';import IssueSubtasksPanel from './IssueSubtasksPanel';import IssueActivityFeed from './IssueActivityFeed';import LastCommentBubble from './LastCommentBubble';@@ -179,6 +180,8 @@ export default function IssueDetailContent({{features.checklists && <IssueChecklistsPanel issue={issue} />}+ {features.timeLogging && <IssueWorklogPanel project={project} issue={issue} />}+<IssueLinksPanel project={project} issue={issue} /></>);diff --git a/apps/web/src/features/issue/components/detail/IssueProperties.tsx b/apps/web/src/features/issue/components/detail/IssueProperties.tsxindex 26d34107..c84549a0 100644--- a/apps/web/src/features/issue/components/detail/IssueProperties.tsx+++ b/apps/web/src/features/issue/components/detail/IssueProperties.tsx@@ -21,6 +21,7 @@ import InitiativeSelect from '../fields/InitiativeSelect';import CycleSelect from '../fields/CycleSelect';import CycleHistoryBadge from '../fields/CycleHistoryBadge';import EstimatePill from '../fields/EstimatePill';+import IssueTimeTracking from '../fields/IssueTimeTracking';import IssueCustomFieldControl from '../fields/IssueCustomFieldControl';import IssueCustomFieldBody from '../fields/IssueCustomFieldBody';import IssueWatchers from './IssueWatchers';@@ -217,6 +218,15 @@ export default function IssueProperties({</IssuePropertyRow>),+ project.project.timeLoggingEnabled && issue.loggedMinutes > 0 && (+ <IssuePropertyRow key="timeTracking" label={t('timeTracking')}>+ <IssueTimeTracking+ logged={issue.loggedMinutes}+ estimate={project.project.timeEstimateEnabled ? issue.estimateMinutes : null}+ />+ </IssuePropertyRow>+ ),+<IssuePropertyRow key="startDate" label={t('startDate')}><DatePillvalue={issue.startDate}diff --git a/apps/web/src/features/issue/components/detail/IssueWorklogForm.tsx b/apps/web/src/features/issue/components/detail/IssueWorklogForm.tsxnew file mode 100644index 00000000..f76e9da3--- /dev/null+++ b/apps/web/src/features/issue/components/detail/IssueWorklogForm.tsx@@ -0,0 +1,90 @@+'use client';++import { useState } from 'react';+import { useTranslations } from 'next-intl';+import { type WorklogInput } from '@/lib/api';+import { toDateStr } from '@/utils/dates';+import { parseMinutes, formatMinutes } from '@/utils/estimate';+import { Button } from '@/components/ui/button';+import { Input } from '@/components/ui/input';+import DatePill from '@/components/common/fields/DatePill';++const NOTE_MAX = 500;++// The form behind a time entry, used both for a new one and for changing one that+// is there. The time is typed the way the estimate is ('1h 30m'), and text it+// cannot read leaves the form open. The day defaults to today and the calendar+// offers no later one, which is also what the API accepts.+export default function IssueWorklogForm({+ entry,+ saving,+ onSubmit,+ onCancel,+}: {+ // The entry being changed, or undefined for a new one.+ entry?: { minutes: number; spentOn: string; note: string | null };+ saving: boolean;+ onSubmit: (input: WorklogInput) => void;+ onCancel: () => void;+}) {+ const t = useTranslations('issue.worklog');+ const tCommon = useTranslations('common');+ const [time, setTime] = useState(entry ? formatMinutes(entry.minutes) : '');+ const [spentOn, setSpentOn] = useState(entry?.spentOn ?? toDateStr(new Date()));+ const [note, setNote] = useState(entry?.note ?? '');++ // Text the parser cannot read and a typed zero both come out as no time, which is+ // not an entry.+ const minutes = parseMinutes(time) ?? 0;++ function submit() {+ if (minutes <= 0) return;+ onSubmit({ minutes, spentOn, note: note.trim() || null });+ }++ return (+ <div className="rounded-md border p-3">+ <div className="flex flex-wrap items-center gap-2">+ <Input+ autoFocus+ value={time}+ placeholder={t('timePlaceholder')}+ aria-label={t('time')}+ className="h-8 w-28"+ onChange={(e) => setTime(e.target.value)}+ onKeyDown={(e) => {+ if (e.key === 'Enter') submit();+ if (e.key === 'Escape') onCancel();+ }}+ />+ <DatePill+ value={spentOn}+ onChange={(value) => value && setSpentOn(value)}+ clearable={false}+ disabled={{ after: new Date() }}+ />+ <Input+ value={note}+ placeholder={t('notePlaceholder')}+ aria-label={t('note')}+ maxLength={NOTE_MAX}+ className="h-8 min-w-40 flex-1"+ onChange={(e) => setNote(e.target.value)}+ onKeyDown={(e) => {+ if (e.key === 'Enter') submit();+ if (e.key === 'Escape') onCancel();+ }}+ />+ </div>++ <div className="mt-3 flex justify-end gap-2">+ <Button variant="ghost" size="sm" onClick={onCancel}>+ {tCommon('cancel')}+ </Button>+ <Button size="sm" disabled={minutes <= 0 || saving} onClick={submit}>+ {tCommon('save')}+ </Button>+ </div>+ </div>+ );+}diff --git a/apps/web/src/features/issue/components/detail/IssueWorklogPanel.tsx b/apps/web/src/features/issue/components/detail/IssueWorklogPanel.tsxnew file mode 100644index 00000000..44656ce2--- /dev/null+++ b/apps/web/src/features/issue/components/detail/IssueWorklogPanel.tsx@@ -0,0 +1,121 @@+'use client';++import { useState } from 'react';+import { Plus } from 'lucide-react';+import { useTranslations } from 'next-intl';+import { type IssueDetail, type ProjectDetail } from '@/lib/api';+import { useSession } from '@/lib/auth-client';+import { usePermissions } from '@/hooks/usePermissions';+import { formatMinutes } from '@/utils/estimate';+import { Button } from '@/components/ui/button';+import { usePersistedOpen } from '../../hooks/usePersistedOpen';+import {+ useCreateWorklog,+ useDeleteWorklog,+ useUpdateWorklog,+ useWorklogsQuery,+} from '../../services/worklogs.service';+import IssueSectionHeading from './IssueSectionHeading';+import IssueWorklogForm from './IssueWorklogForm';+import IssueWorklogRow from './IssueWorklogRow';++// The time logged on the issue: the entries newest day first, and the control that+// adds one. The tally in the heading is the time the issue took, so it reads+// without opening the section. A member logs against any issue they may edit, and+// owns the entries they logged: changing or deleting someone else's is a project+// owner's call.+export default function IssueWorklogPanel({+ project,+ issue,+}: {+ project: ProjectDetail;+ issue: IssueDetail;+}) {+ const t = useTranslations('issue.worklog');+ const tCommon = useTranslations('common');+ const { can, isOwner } = usePermissions();+ const canLog = can('work_items', 'edit');+ const currentUserId = useSession().data?.user.id ?? null;+ const { open, toggle } = usePersistedOpen('issue-worklog-open');+ const [adding, setAdding] = useState(false);+ const [editingId, setEditingId] = useState<number | null>(null);++ const projectKey = project.project.key;+ const entries = useWorklogsQuery(issue.id).data ?? [];+ const createWorklog = useCreateWorklog();+ const updateWorklog = useUpdateWorklog();+ const deleteWorklog = useDeleteWorklog();++ 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={t('title')}+ open={open}+ onToggle={toggle}+ tally={issue.loggedMinutes > 0 ? formatMinutes(issue.loggedMinutes) : undefined}+ />+ {open && canLog && !adding && (+ <Button variant="ghost" size="sm" className="h-7 gap-1.5" onClick={() => setAdding(true)}>+ <Plus className="size-4" /> {tCommon('add')}+ </Button>+ )}+ </div>++ {open && (+ <>+ {adding && (+ <div className="mb-2">+ <IssueWorklogForm+ saving={createWorklog.isPending}+ onCancel={() => setAdding(false)}+ onSubmit={(input) => {+ createWorklog.mutate({ issueId: issue.id, projectKey, input });+ setAdding(false);+ }}+ />+ </div>+ )}++ {entries.length === 0 && !adding ? (+ <p className="rounded-md border border-dashed p-4 text-center text-sm text-muted-foreground">+ {canLog ? t('emptyHint') : t('empty')}+ </p>+ ) : (+ <div className="flex flex-col">+ {entries.map((entry) =>+ entry.id === editingId ? (+ <IssueWorklogForm+ key={entry.id}+ entry={entry}+ saving={updateWorklog.isPending}+ onCancel={() => setEditingId(null)}+ onSubmit={(patch) => {+ updateWorklog.mutate({+ issueId: issue.id,+ projectKey,+ worklogId: entry.id,+ patch,+ });+ setEditingId(null);+ }}+ />+ ) : (+ <IssueWorklogRow+ key={entry.id}+ entry={entry}+ canEdit={canLog && (entry.userId === currentUserId || isOwner)}+ onEdit={() => setEditingId(entry.id)}+ onRemove={() =>+ deleteWorklog.mutate({ issueId: issue.id, projectKey, worklogId: entry.id })+ }+ />+ ),+ )}+ </div>+ )}+ </>+ )}+ </div>+ );+}diff --git a/apps/web/src/features/issue/components/detail/IssueWorklogRow.tsx b/apps/web/src/features/issue/components/detail/IssueWorklogRow.tsxnew file mode 100644index 00000000..2f9f45c2--- /dev/null+++ b/apps/web/src/features/issue/components/detail/IssueWorklogRow.tsx@@ -0,0 +1,68 @@+'use client';++import { Pencil, X } from 'lucide-react';+import { useTranslations } from 'next-intl';+import { type Worklog } from '@/lib/api';+import { formatShortDate } from '@/utils/dates';+import { formatMinutes } from '@/utils/estimate';+import Avatar from '@/components/common/Avatar';+import { Button } from '@/components/ui/button';++// One logged entry: who logged it, how long they worked, the day it was spent on+// and their note. The two controls show only to whoever may touch this entry —+// its author, or a member who may delete work items.+export default function IssueWorklogRow({+ entry,+ canEdit,+ onEdit,+ onRemove,+}: {+ entry: Worklog;+ canEdit: boolean;+ onEdit: () => void;+ onRemove: () => void;+}) {+ const t = useTranslations('issue.worklog');+ const name = entry.userName ?? '';++ return (+ <div className="group flex items-center gap-2 rounded-md px-2 py-1.5 hover:bg-accent/50">+ <Avatar name={name} image={entry.userImage} />+ <span className="shrink-0 text-sm font-medium tabular-nums">+ {formatMinutes(entry.minutes)}+ </span>+ <span className="shrink-0 text-xs text-muted-foreground">+ {formatShortDate(entry.spentOn)}+ </span>+ {entry.note && (+ <span dir="auto" className="min-w-0 truncate text-sm text-muted-foreground">+ {entry.note}+ </span>+ )}+ <span className="ms-auto shrink-0 text-xs text-muted-foreground">{name}</span>++ {canEdit && (+ <>+ <Button+ variant="ghost"+ size="icon"+ className="size-6 shrink-0 opacity-0 group-hover:opacity-100"+ aria-label={t('edit')}+ onClick={onEdit}+ >+ <Pencil className="size-3.5" />+ </Button>+ <Button+ variant="ghost"+ size="icon"+ className="size-6 shrink-0 opacity-0 group-hover:opacity-100 hover:text-destructive"+ aria-label={t('remove')}+ onClick={onRemove}+ >+ <X className="size-3.5" />+ </Button>+ </>+ )}+ </div>+ );+}diff --git a/apps/web/src/features/issue/components/fields/IssueTimeTracking.tsx b/apps/web/src/features/issue/components/fields/IssueTimeTracking.tsxnew file mode 100644index 00000000..76f4ba73--- /dev/null+++ b/apps/web/src/features/issue/components/fields/IssueTimeTracking.tsx@@ -0,0 +1,39 @@+import { useTranslations } from 'next-intl';+import { formatMinutes } from '@/utils/estimate';+import { cn } from '@/lib/utils';++// The time logged on the issue read against its estimate: a bar of how much of the+// estimate went in, the time itself, and what is left of it. An issue with no+// estimate has nothing to fill, so the bar reads full and only names the time.+export default function IssueTimeTracking({+ logged,+ estimate,+}: {+ logged: number;+ estimate: number | null;+}) {+ const t = useTranslations('issue.fields');+ const over = estimate != null && logged > estimate;+ const filled = estimate == null || estimate === 0 ? 1 : Math.min(1, logged / estimate);++ return (+ <div className="flex flex-col gap-1.5 pt-1">+ <div className="h-1.5 w-full overflow-hidden rounded-full bg-muted">+ <div+ className={cn('h-full rounded-full', over ? 'bg-destructive' : 'bg-foreground/70')}+ style={{ width: `${filled * 100}%` }}+ />+ </div>+ <div className="flex justify-between gap-2 text-xs text-muted-foreground">+ <span className="truncate">{t('timeLoggedValue', { time: formatMinutes(logged) })}</span>+ {estimate != null && (+ <span className={cn('truncate', over && 'text-destructive')}>+ {over+ ? t('timeOverBy', { time: formatMinutes(logged - estimate) })+ : t('timeRemainingValue', { time: formatMinutes(estimate - logged) })}+ </span>+ )}+ </div>+ </div>+ );+}diff --git a/apps/web/src/features/issue/hooks/useActivityText.tsx b/apps/web/src/features/issue/hooks/useActivityText.tsxindex 24badf64..105564a7 100644--- a/apps/web/src/features/issue/hooks/useActivityText.tsx+++ b/apps/web/src/features/issue/hooks/useActivityText.tsx@@ -136,6 +136,16 @@ export function useActivityText() {checklist: subject ?? '',}),};+ case 'worklog': {+ // Each side carries the time it held and the day it was spent on.+ const fromDay = fmtDate(a.payload.from?.date ?? null);+ const toDay = fmtDate(a.payload.to?.date ?? null);+ if (!to) return { line: rich('worklogRemoved', { time: from ?? '', date: fromDay }) };+ if (!from) return { line: rich('worklogAdded', { time: to, date: toDay }) };+ return {+ line: rich('worklogChanged', { from, fromDate: fromDay, to, date: toDay }),+ };+ }case 'field':if (isLongValue(to))return { line: rich('fieldUpdated', { field: subject ?? '' }), popover: to };diff --git a/apps/web/src/features/issue/services/worklogs.service.ts b/apps/web/src/features/issue/services/worklogs.service.tsnew file mode 100644index 00000000..62163234--- /dev/null+++ b/apps/web/src/features/issue/services/worklogs.service.ts@@ -0,0 +1,49 @@+// The time logged on an issue. The entries are their own read; their sum comes with+// the issue and every write is in the activity feed, so a mutation refreshes all+// three. The board carries the sum too, which is why the project's issues follow.++import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';+import { api, type WorklogInput } from '@/lib/api';+import { qk } from '@/services/queryKeys';++export function useWorklogsQuery(issueId: number) {+ return useQuery({ queryKey: qk.worklogs(issueId), queryFn: () => api.listWorklogs(issueId) });+}++function useWorklogMutation<TVars extends { issueId: number; projectKey: string }>(+ run: (vars: TVars) => Promise<unknown>,+) {+ const qc = useQueryClient();+ return useMutation({+ mutationFn: run,+ onSuccess: (_data, { issueId, projectKey }) => {+ void qc.invalidateQueries({ queryKey: qk.worklogs(issueId) });+ void qc.invalidateQueries({ queryKey: qk.issue(issueId) });+ void qc.invalidateQueries({ queryKey: qk.feed(issueId) });+ void qc.invalidateQueries({ queryKey: qk.boardIssues(projectKey) });+ },+ });+}++export function useCreateWorklog() {+ return useWorklogMutation((vars: { issueId: number; projectKey: string; input: WorklogInput }) =>+ api.createWorklog(vars.issueId, vars.input),+ );+}++export function useUpdateWorklog() {+ return useWorklogMutation(+ (vars: {+ issueId: number;+ projectKey: string;+ worklogId: number;+ patch: Partial<WorklogInput>;+ }) => api.updateWorklog(vars.worklogId, vars.patch),+ );+}++export function useDeleteWorklog() {+ return useWorklogMutation((vars: { issueId: number; projectKey: string; worklogId: number }) =>+ api.deleteWorklog(vars.worklogId),+ );+}diff --git a/apps/web/src/features/issue/utils/activityIcons.ts b/apps/web/src/features/issue/utils/activityIcons.tsindex 71d82ded..feb797d0 100644--- a/apps/web/src/features/issue/utils/activityIcons.ts+++ b/apps/web/src/features/issue/utils/activityIcons.ts@@ -16,6 +16,7 @@ import {SignalHigh,Bot,Tag,+ Timer,UserRound,type LucideIcon,} from 'lucide-react';@@ -49,6 +50,7 @@ export const ACTION_ICON: Record<ActivityAction, LucideIcon> = {checklist_remove: ListChecks,checklist_item_add: ListChecks,checklist_item_remove: ListChecks,+ worklog: Timer,field: Pencil,archived: Archive,restored: ArchiveRestore,diff --git a/apps/web/src/features/settings/components/configuration/SettingsEstimates.tsx b/apps/web/src/features/settings/components/configuration/SettingsEstimates.tsxindex 6c2a602f..f544e118 100644--- a/apps/web/src/features/settings/components/configuration/SettingsEstimates.tsx+++ b/apps/web/src/features/settings/components/configuration/SettingsEstimates.tsx@@ -6,7 +6,9 @@ import { Switch } from '@/components/ui/switch';import type { EstimatesForm } from '../../hooks/useEstimatesForm';// The Estimates block of the Configuration page: which kinds of estimate the-// issues of this project carry. Both off unless turned on here.+// issues of this project carry, and whether its members log the time they spend.+// All off unless turned on here; a team can log time without estimating first, so+// the third switch stands on its own.export default function SettingsEstimates({ form }: { form: EstimatesForm }) {const t = useTranslations('settings.configuration');@@ -31,6 +33,17 @@ export default function SettingsEstimates({ form }: { form: EstimatesForm }) {<Switch checked={form.time} disabled={!form.editable} onCheckedChange={form.setTime} />}/>+ <SettingsRow+ title={t('timeLogging')}+ description={t('timeLoggingHint')}+ control={+ <Switch+ checked={form.logging}+ disabled={!form.editable}+ onCheckedChange={form.setLogging}+ />+ }+ /></SettingsCard></SettingsSection>);diff --git a/apps/web/src/features/settings/hooks/useEstimatesForm.ts b/apps/web/src/features/settings/hooks/useEstimatesForm.tsindex 022c78cd..1a5f5c0f 100644--- a/apps/web/src/features/settings/hooks/useEstimatesForm.ts+++ b/apps/web/src/features/settings/hooks/useEstimatesForm.ts@@ -3,9 +3,10 @@ import type { Project } from '@/lib/api';import { usePermissions } from '@/hooks/usePermissions';import { useUpdateEstimates } from '../services/settings.service';-// The estimate kinds of the project, saved by the Configuration page header-// together with the rest of the page. The current state comes with the project-// payload the Shell already loaded, so there is nothing to fetch here.+// The estimate kinds of the project and whether its members log time, saved by the+// Configuration page header together with the rest of the page. The current state+// comes with the project payload the Shell already loaded, so there is nothing to+// fetch here.export interface EstimatesForm {editable: boolean;saving: boolean;@@ -14,6 +15,8 @@ export interface EstimatesForm {setPoints: (v: boolean) => void;time: boolean;setTime: (v: boolean) => void;+ logging: boolean;+ setLogging: (v: boolean) => void;}export function useEstimatesForm(project: Project): EstimatesForm {@@ -22,14 +25,16 @@ export function useEstimatesForm(project: Project): EstimatesForm {const [points, setPoints] = useState(project.pointsEstimateEnabled);const [time, setTime] = useState(project.timeEstimateEnabled);+ const [logging, setLogging] = useState(project.timeLoggingEnabled);useEffect(() => {setPoints(project.pointsEstimateEnabled);setTime(project.timeEstimateEnabled);- }, [project.pointsEstimateEnabled, project.timeEstimateEnabled]);+ setLogging(project.timeLoggingEnabled);+ }, [project.pointsEstimateEnabled, project.timeEstimateEnabled, project.timeLoggingEnabled]);async function save() {- await update.mutateAsync({ points, time });+ await update.mutateAsync({ points, time, logging });}return {@@ -40,5 +45,7 @@ export function useEstimatesForm(project: Project): EstimatesForm {setPoints,time,setTime,+ logging,+ setLogging,};}diff --git a/apps/web/src/lib/api.ts b/apps/web/src/lib/api.tsindex e8523a1d..3d697a27 100644--- a/apps/web/src/lib/api.ts+++ b/apps/web/src/lib/api.ts@@ -125,6 +125,9 @@ export interface Project {// properties while a kind is off.pointsEstimateEnabled: boolean;timeEstimateEnabled: boolean;+ // Whether members log the time they spend on the issues, set in the same place.+ // Independent of the time estimate.+ timeLoggingEnabled: boolean;createdAt: string;// The caller's role in this project. Only present on the /projects list// response (used to gate owner-only actions like deletion); absent on the@@ -807,6 +810,9 @@ export interface Issue {// Time is in minutes; the UI enters and shows it as hours and minutes.estimatePoints: number | null;estimateMinutes: number | null;+ // The sum of the issue's logged time entries, 0 when nothing was logged. The+ // entries themselves are read separately (listWorklogs).+ loggedMinutes: number;startDate: string | null;dueDate: string | null;position: number;@@ -856,11 +862,13 @@ export interface AutoArchiveSettings {canceledDays: number | null;}-// Which estimate kinds a project's issues carry, both off by default. A kind-// turned off hides its UI and keeps the estimates already set.+// Which estimate kinds a project's issues carry and whether its members log the+// time they spend, all off by default. One turned off hides its UI and keeps what+// the issues already carry.export interface EstimateSettings {points: boolean;time: boolean;+ logging: boolean;}// Per-project subtask automations, both off by default. completeParent closes a@@ -1636,6 +1644,7 @@ export type ActivityAction =| 'checklist_remove'| 'checklist_item_add'| 'checklist_item_remove'+ | 'worklog'| 'field'| 'archived'| 'restored'@@ -1655,6 +1664,8 @@ export interface ActivitySide {stateType?: string | null;repo?: string;number?: number;+ // A 'worklog' side carries the day its time was spent on.+ date?: string | null;}// What an activity row says changed. `subject` names the sub-item where the action@@ -1908,6 +1919,28 @@ export interface Checklist {items: ChecklistItem[];}+// One entry of the time a member logged on an issue: how long they worked, the day+// the work happened on, an optional note, and the member it belongs to. The time an+// issue took is the sum of its entries (Issue.loggedMinutes).+export interface Worklog {+ id: number;+ issueId: number;+ userId: string;+ userName: string | null;+ userImage: string | null;+ minutes: number;+ spentOn: string;+ note: string | null;+ createdAt: string;+}++// What a new entry carries. A change sends the same fields, any subset of them.+export interface WorklogInput {+ minutes: number;+ spentOn: string;+ note?: string | null;+}+// The issue with its relations and its place in the subtask hierarchy. Shared// pages carry this much; the detail routes add the watchers and the checklists,// neither of which a public page exposes.@@ -2670,6 +2703,23 @@ export const api = {body: JSON.stringify({ orderedIds }),}),+ // The time logged on an issue. Unlike the checklists these are not part of the+ // issue read — it carries their sum, and only the section listing them needs the+ // entries.+ listWorklogs: (issueId: number) => request<Worklog[]>(`/issues/${issueId}/worklogs`),+ createWorklog: (issueId: number, input: WorklogInput) =>+ request<Worklog>(`/issues/${issueId}/worklogs`, {+ method: 'POST',+ body: JSON.stringify(input),+ }),+ updateWorklog: (worklogId: number, patch: Partial<WorklogInput>) =>+ request<Worklog>(`/worklogs/${worklogId}`, {+ method: 'PATCH',+ body: JSON.stringify(patch),+ }),+ deleteWorklog: (worklogId: number) =>+ request<void>(`/worklogs/${worklogId}`, { method: 'DELETE' }),+listAttachments: (issueId: number) =>request<Attachment[]>(`/issues/${issueId}/attachments`).then((rows) =>rows.map(absolutizeAttachment),diff --git a/apps/web/src/services/queryKeys.ts b/apps/web/src/services/queryKeys.tsindex 48f77f61..12c92db8 100644--- a/apps/web/src/services/queryKeys.ts+++ b/apps/web/src/services/queryKeys.ts@@ -128,6 +128,9 @@ export const qk = {anyCycles: ['cycles'] as const,anyCycle: ['cycle'] as const,attachments: (id: number) => ['attachments', id] as const,+ // The time entries of one issue. Their sum comes with the issue, so a write+ // refreshes that read too.+ worklogs: (id: number) => ['worklogs', id] as const,// A project's inbox notifications (the list, scoped by the active filters) and the// project's unread count (the sidebar badge + live-refresh target).notifications: (projectKey: string, filters?: unknown) =>diff --git a/apps/web/src/utils/projectFeatures.ts b/apps/web/src/utils/projectFeatures.tsindex afcbfee2..955403ed 100644--- a/apps/web/src/utils/projectFeatures.ts+++ b/apps/web/src/utils/projectFeatures.ts@@ -1,11 +1,12 @@import type { Project, ProjectFeatures } from '@/lib/api';-// The optional sections plus the estimate kinds: everything the rest of the app-// checks before showing a field. The sections are the Features page; the estimate-// kinds are set in Settings -> Configuration and only hide their own UI.+// The optional sections plus the estimate kinds and time logging: everything the+// rest of the app checks before showing a field. The sections are the Features page;+// the rest is set in Settings -> Configuration and only hides its own UI.export interface ProjectFeatureSet extends ProjectFeatures {pointsEstimate: boolean;timeEstimate: boolean;+ timeLogging: boolean;}// The project's flags read as the feature set the rest of the app checks. Without@@ -21,5 +22,6 @@ export function projectFeatures(project: Project | null): ProjectFeatureSet {issueStats: project?.issueStatsEnabled ?? false,pointsEstimate: project?.pointsEstimateEnabled ?? false,timeEstimate: project?.timeEstimateEnabled ?? false,+ timeLogging: project?.timeLoggingEnabled ?? false,};}diff --git a/packages/db/drizzle/0104_chunky_loki.sql b/packages/db/drizzle/0104_chunky_loki.sqlnew file mode 100644index 00000000..8e2d1d7e--- /dev/null+++ b/packages/db/drizzle/0104_chunky_loki.sql@@ -0,0 +1,15 @@+CREATE TABLE "issue_worklog" (+ "id" serial PRIMARY KEY NOT NULL,+ "issue_id" integer NOT NULL,+ "user_id" text NOT NULL,+ "minutes" integer NOT NULL,+ "spent_on" date NOT NULL,+ "note" text,+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,+ CONSTRAINT "issue_worklog_minutes_check" CHECK ("issue_worklog"."minutes" > 0)+);+--> statement-breakpoint+ALTER TABLE "project" ADD COLUMN "time_logging_enabled" boolean DEFAULT false NOT NULL;--> statement-breakpoint+ALTER TABLE "issue_worklog" ADD CONSTRAINT "issue_worklog_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_worklog" ADD CONSTRAINT "issue_worklog_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+CREATE INDEX "issue_worklog_issue_idx" ON "issue_worklog" USING btree ("issue_id","spent_on" DESC NULLS LAST);\ No newline at end of filediff --git a/packages/db/drizzle/meta/0104_snapshot.json b/packages/db/drizzle/meta/0104_snapshot.jsonnew file mode 100644index 00000000..3a47c1c6--- /dev/null+++ b/packages/db/drizzle/meta/0104_snapshot.json@@ -0,0 +1,7010 @@+{+ "id": "2975538f-664b-4525-8e41-fee5a4e82352",+ "prevId": "35e37400-48ca-411c-8db2-b0c35eab7f5a",+ "version": "7",+ "dialect": "postgresql",+ "tables": {+ "public.account": {+ "name": "account",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "account_id": {+ "name": "account_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "provider_id": {+ "name": "provider_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "access_token": {+ "name": "access_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "refresh_token": {+ "name": "refresh_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "id_token": {+ "name": "id_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "access_token_expires_at": {+ "name": "access_token_expires_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "refresh_token_expires_at": {+ "name": "refresh_token_expires_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "scope": {+ "name": "scope",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "password": {+ "name": "password",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "account_userId_idx": {+ "name": "account_userId_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "account_user_id_user_id_fk": {+ "name": "account_user_id_user_id_fk",+ "tableFrom": "account",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.apikey": {+ "name": "apikey",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "config_id": {+ "name": "config_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'default'"+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "start": {+ "name": "start",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "reference_id": {+ "name": "reference_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "prefix": {+ "name": "prefix",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "refill_interval": {+ "name": "refill_interval",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "refill_amount": {+ "name": "refill_amount",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "last_refill_at": {+ "name": "last_refill_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ },+ "rate_limit_enabled": {+ "name": "rate_limit_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ },+ "rate_limit_time_window": {+ "name": "rate_limit_time_window",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "default": 1000+ },+ "rate_limit_max": {+ "name": "rate_limit_max",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "default": 100+ },+ "request_count": {+ "name": "request_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "default": 0+ },+ "remaining": {+ "name": "remaining",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "last_request": {+ "name": "last_request",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "permissions": {+ "name": "permissions",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "apikey_configId_idx": {+ "name": "apikey_configId_idx",+ "columns": [+ {+ "expression": "config_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "apikey_referenceId_idx": {+ "name": "apikey_referenceId_idx",+ "columns": [+ {+ "expression": "reference_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "apikey_key_idx": {+ "name": "apikey_key_idx",+ "columns": [+ {+ "expression": "key",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.passkey": {+ "name": "passkey",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "public_key": {+ "name": "public_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "credential_id": {+ "name": "credential_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "counter": {+ "name": "counter",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "device_type": {+ "name": "device_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "backed_up": {+ "name": "backed_up",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true+ },+ "transports": {+ "name": "transports",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "aaguid": {+ "name": "aaguid",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "passkey_userId_idx": {+ "name": "passkey_userId_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "passkey_credentialID_idx": {+ "name": "passkey_credentialID_idx",+ "columns": [+ {+ "expression": "credential_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "passkey_user_id_user_id_fk": {+ "name": "passkey_user_id_user_id_fk",+ "tableFrom": "passkey",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.session": {+ "name": "session",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "token": {+ "name": "token",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "ip_address": {+ "name": "ip_address",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_agent": {+ "name": "user_agent",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "session_userId_idx": {+ "name": "session_userId_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "session_user_id_user_id_fk": {+ "name": "session_user_id_user_id_fk",+ "tableFrom": "session",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "session_token_unique": {+ "name": "session_token_unique",+ "nullsNotDistinct": false,+ "columns": [+ "token"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user": {+ "name": "user",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "email": {+ "name": "email",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "email_verified": {+ "name": "email_verified",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "image": {+ "name": "image",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "username": {+ "name": "username",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "display_username": {+ "name": "display_username",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "default": "'user'"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "user_email_unique": {+ "name": "user_email_unique",+ "nullsNotDistinct": false,+ "columns": [+ "email"+ ]+ },+ "user_username_unique": {+ "name": "user_username_unique",+ "nullsNotDistinct": false,+ "columns": [+ "username"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.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_chat_event": {+ "name": "agent_chat_event",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "bigserial",+ "primaryKey": true,+ "notNull": true+ },+ "message_id": {+ "name": "message_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "payload": {+ "name": "payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_chat_event_message_idx": {+ "name": "agent_chat_event_message_idx",+ "columns": [+ {+ "expression": "message_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_chat_event_message_id_agent_chat_message_id_fk": {+ "name": "agent_chat_event_message_id_agent_chat_message_id_fk",+ "tableFrom": "agent_chat_event",+ "tableTo": "agent_chat_message",+ "columnsFrom": [+ "message_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_chat_message": {+ "name": "agent_chat_message",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "thread_id": {+ "name": "thread_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "attempts": {+ "name": "attempts",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "next_attempt_at": {+ "name": "next_attempt_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "last_error": {+ "name": "last_error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "finished_at": {+ "name": "finished_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_chat_message_thread_idx": {+ "name": "agent_chat_message_thread_idx",+ "columns": [+ {+ "expression": "thread_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "agent_chat_message_due_idx": {+ "name": "agent_chat_message_due_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "next_attempt_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"agent_chat_message\".\"status\" IN ('pending', 'streaming')",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_chat_message_thread_id_agent_chat_thread_id_fk": {+ "name": "agent_chat_message_thread_id_agent_chat_thread_id_fk",+ "tableFrom": "agent_chat_message",+ "tableTo": "agent_chat_thread",+ "columnsFrom": [+ "thread_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_chat_message_agent_id_ai_agent_id_fk": {+ "name": "agent_chat_message_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_chat_message",+ "tableTo": "ai_agent",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "agent_chat_message_role_check": {+ "name": "agent_chat_message_role_check",+ "value": "\"agent_chat_message\".\"role\" IN ('user', 'assistant')"+ },+ "agent_chat_message_status_check": {+ "name": "agent_chat_message_status_check",+ "value": "\"agent_chat_message\".\"status\" IN ('pending', 'streaming', 'success', 'failed', 'canceled')"+ }+ },+ "isRLSEnabled": false+ },+ "public.agent_chat_thread": {+ "name": "agent_chat_thread",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "cli_session_id": {+ "name": "cli_session_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "agent_chat_thread_agent_user_idx": {+ "name": "agent_chat_thread_agent_user_idx",+ "columns": [+ {+ "expression": "agent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_chat_thread_agent_id_ai_agent_id_fk": {+ "name": "agent_chat_thread_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_chat_thread",+ "tableTo": "ai_agent",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_chat_thread_user_id_user_id_fk": {+ "name": "agent_chat_thread_user_id_user_id_fk",+ "tableFrom": "agent_chat_thread",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_field_trigger": {+ "name": "agent_field_trigger",+ "schema": "",+ "columns": {+ "agent_id": {+ "name": "agent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "field_id": {+ "name": "field_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "delay_sec": {+ "name": "delay_sec",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 120+ }+ },+ "indexes": {+ "agent_field_trigger_field_idx": {+ "name": "agent_field_trigger_field_idx",+ "columns": [+ {+ "expression": "field_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "agent_field_trigger_agent_id_ai_agent_id_fk": {+ "name": "agent_field_trigger_agent_id_ai_agent_id_fk",+ "tableFrom": "agent_field_trigger",+ "tableTo": "ai_agent",+ "columnsFrom": [+ "agent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "agent_field_trigger_field_id_custom_field_id_fk": {+ "name": "agent_field_trigger_field_id_custom_field_id_fk",+ "tableFrom": "agent_field_trigger",+ "tableTo": "custom_field",+ "columnsFrom": [+ "field_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "agent_field_trigger_agent_id_field_id_pk": {+ "name": "agent_field_trigger_agent_id_field_id_pk",+ "columns": [+ "agent_id",+ "field_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "agent_field_trigger_delay_check": {+ "name": "agent_field_trigger_delay_check",+ "value": "\"agent_field_trigger\".\"delay_sec\" >= 0 AND \"agent_field_trigger\".\"delay_sec\" <= 86400"+ }+ },+ "isRLSEnabled": false+ },+ "public.agent_run": {+ "name": "agent_run",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "agent_id": {+ "name": "agent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "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', 'canceled')"+ },+ "agent_run_trigger_check": {+ "name": "agent_run_trigger_check",+ "value": "\"agent_run\".\"trigger\" IN ('mention', 'delegation', 'field', '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+ },+ "delegation_delay_sec": {+ "name": "delegation_delay_sec",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 120+ },+ "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+ },+ "owner_user_id": {+ "name": "owner_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "runner_scope": {+ "name": "runner_scope",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'project'"+ },+ "last_seen_at": {+ "name": "last_seen_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": {+ "ai_agent_project_username_uq": {+ "name": "ai_agent_project_username_uq",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "lower(\"username\")",+ "asc": true,+ "isExpression": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "ai_agent_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"+ },+ "ai_agent_owner_user_id_user_id_fk": {+ "name": "ai_agent_owner_user_id_user_id_fk",+ "tableFrom": "ai_agent",+ "tableTo": "user",+ "columnsFrom": [+ "owner_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "ai_agent_user_id_unique": {+ "name": "ai_agent_user_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "user_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {+ "ai_agent_kind_check": {+ "name": "ai_agent_kind_check",+ "value": "\"ai_agent\".\"kind\" IN ('external', 'internal')"+ },+ "ai_agent_runner_scope_check": {+ "name": "ai_agent_runner_scope_check",+ "value": "\"ai_agent\".\"runner_scope\" IN ('owner', 'project')"+ },+ "ai_agent_delegation_delay_check": {+ "name": "ai_agent_delegation_delay_check",+ "value": "\"ai_agent\".\"delegation_delay_sec\" >= 0 AND \"ai_agent\".\"delegation_delay_sec\" <= 86400"+ }+ },+ "isRLSEnabled": false+ },+ "public.app_secret": {+ "name": "app_secret",+ "schema": "",+ "columns": {+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "ciphertext": {+ "name": "ciphertext",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "iv": {+ "name": "iv",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "auth_tag": {+ "name": "auth_tag",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "redacted": {+ "name": "redacted",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.app_setting": {+ "name": "app_setting",+ "schema": "",+ "columns": {+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "value": {+ "name": "value",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.custom_field": {+ "name": "custom_field",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "issue_type_id": {+ "name": "issue_type_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "field_type": {+ "name": "field_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "member_scope": {+ "name": "member_scope",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "show_in_body": {+ "name": "show_in_body",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "position": {+ "name": "position",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "custom_field_project_id_project_id_fk": {+ "name": "custom_field_project_id_project_id_fk",+ "tableFrom": "custom_field",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "custom_field_issue_type_id_issue_type_id_fk": {+ "name": "custom_field_issue_type_id_issue_type_id_fk",+ "tableFrom": "custom_field",+ "tableTo": "issue_type",+ "columnsFrom": [+ "issue_type_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "custom_field_field_type_check": {+ "name": "custom_field_field_type_check",+ "value": "\"custom_field\".\"field_type\" IN ('text', 'markdown', 'url', 'number', 'boolean', 'date', 'datetime', 'datetime_range', 'select', 'multi_select', 'member')"+ },+ "custom_field_member_scope_check": {+ "name": "custom_field_member_scope_check",+ "value": "(\"custom_field\".\"field_type\" = 'member') = (\"custom_field\".\"member_scope\" IS NOT NULL) AND (\"custom_field\".\"member_scope\" IS NULL OR \"custom_field\".\"member_scope\" IN ('all', 'humans', 'agents'))"+ }+ },+ "isRLSEnabled": false+ },+ "public.custom_field_option": {+ "name": "custom_field_option",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "field_id": {+ "name": "field_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "value": {+ "name": "value",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'#6b7280'"+ },+ "position": {+ "name": "position",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ }+ },+ "indexes": {},+ "foreignKeys": {+ "custom_field_option_field_id_custom_field_id_fk": {+ "name": "custom_field_option_field_id_custom_field_id_fk",+ "tableFrom": "custom_field_option",+ "tableTo": "custom_field",+ "columnsFrom": [+ "field_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "custom_field_option_field_id_value_unique": {+ "name": "custom_field_option_field_id_value_unique",+ "nullsNotDistinct": false,+ "columns": [+ "field_id",+ "value"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.cycle": {+ "name": "cycle",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "goal": {+ "name": "goal",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "start_date": {+ "name": "start_date",+ "type": "date",+ "primaryKey": false,+ "notNull": true+ },+ "end_date": {+ "name": "end_date",+ "type": "date",+ "primaryKey": false,+ "notNull": true+ },+ "completed_at": {+ "name": "completed_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "cycle_project_idx": {+ "name": "cycle_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "start_date",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "cycle_project_id_project_id_fk": {+ "name": "cycle_project_id_project_id_fk",+ "tableFrom": "cycle",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "cycle_dates_check": {+ "name": "cycle_dates_check",+ "value": "\"cycle\".\"end_date\" >= \"cycle\".\"start_date\""+ }+ },+ "isRLSEnabled": false+ },+ "public.initiative": {+ "name": "initiative",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'planned'"+ },+ "owner_user_id": {+ "name": "owner_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "priority": {+ "name": "priority",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "start_date": {+ "name": "start_date",+ "type": "date",+ "primaryKey": false,+ "notNull": false+ },+ "target_date": {+ "name": "target_date",+ "type": "date",+ "primaryKey": false,+ "notNull": false+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "initiative_project_idx": {+ "name": "initiative_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "initiative_project_id_project_id_fk": {+ "name": "initiative_project_id_project_id_fk",+ "tableFrom": "initiative",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "initiative_owner_user_id_user_id_fk": {+ "name": "initiative_owner_user_id_user_id_fk",+ "tableFrom": "initiative",+ "tableTo": "user",+ "columnsFrom": [+ "owner_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "initiative_status_check": {+ "name": "initiative_status_check",+ "value": "\"initiative\".\"status\" IN ('proposed', 'planned', 'active', 'completed', 'canceled')"+ }+ },+ "isRLSEnabled": false+ },+ "public.initiative_label": {+ "name": "initiative_label",+ "schema": "",+ "columns": {+ "initiative_id": {+ "name": "initiative_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "label_id": {+ "name": "label_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "initiative_label_initiative_id_initiative_id_fk": {+ "name": "initiative_label_initiative_id_initiative_id_fk",+ "tableFrom": "initiative_label",+ "tableTo": "initiative",+ "columnsFrom": [+ "initiative_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "initiative_label_label_id_label_id_fk": {+ "name": "initiative_label_label_id_label_id_fk",+ "tableFrom": "initiative_label",+ "tableTo": "label",+ "columnsFrom": [+ "label_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "initiative_label_initiative_id_label_id_pk": {+ "name": "initiative_label_initiative_id_label_id_pk",+ "columns": [+ "initiative_id",+ "label_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.integration_credential": {+ "name": "integration_credential",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "integration_key": {+ "name": "integration_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "label": {+ "name": "label",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "ciphertext": {+ "name": "ciphertext",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "iv": {+ "name": "iv",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "auth_tag": {+ "name": "auth_tag",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "redacted": {+ "name": "redacted",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "integration_credential_project_idx": {+ "name": "integration_credential_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "integration_credential_project_id_project_id_fk": {+ "name": "integration_credential_project_id_project_id_fk",+ "tableFrom": "integration_credential",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue": {+ "name": "issue",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "sequence_number": {+ "name": "sequence_number",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "type_id": {+ "name": "type_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "initiative_id": {+ "name": "initiative_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "cycle_id": {+ "name": "cycle_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "column_id": {+ "name": "column_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "parent_id": {+ "name": "parent_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "assignee_user_id": {+ "name": "assignee_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "delegate_user_id": {+ "name": "delegate_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "priority": {+ "name": "priority",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "estimate_points": {+ "name": "estimate_points",+ "type": "numeric",+ "primaryKey": false,+ "notNull": false+ },+ "estimate_minutes": {+ "name": "estimate_minutes",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "start_date": {+ "name": "start_date",+ "type": "date",+ "primaryKey": false,+ "notNull": false+ },+ "due_date": {+ "name": "due_date",+ "type": "date",+ "primaryKey": false,+ "notNull": false+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "archived_at": {+ "name": "archived_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "share_token": {+ "name": "share_token",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "share_extended": {+ "name": "share_extended",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_project_active_idx": {+ "name": "issue_project_active_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "column_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"issue\".\"archived_at\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_parent_idx": {+ "name": "issue_parent_idx",+ "columns": [+ {+ "expression": "parent_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"issue\".\"parent_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_cycle_idx": {+ "name": "issue_cycle_idx",+ "columns": [+ {+ "expression": "cycle_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"issue\".\"cycle_id\" IS NOT NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_project_id_project_id_fk": {+ "name": "issue_project_id_project_id_fk",+ "tableFrom": "issue",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_type_id_issue_type_id_fk": {+ "name": "issue_type_id_issue_type_id_fk",+ "tableFrom": "issue",+ "tableTo": "issue_type",+ "columnsFrom": [+ "type_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "issue_initiative_id_initiative_id_fk": {+ "name": "issue_initiative_id_initiative_id_fk",+ "tableFrom": "issue",+ "tableTo": "initiative",+ "columnsFrom": [+ "initiative_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "issue_cycle_id_cycle_id_fk": {+ "name": "issue_cycle_id_cycle_id_fk",+ "tableFrom": "issue",+ "tableTo": "cycle",+ "columnsFrom": [+ "cycle_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "issue_column_id_project_column_id_fk": {+ "name": "issue_column_id_project_column_id_fk",+ "tableFrom": "issue",+ "tableTo": "project_column",+ "columnsFrom": [+ "column_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "issue_parent_id_issue_id_fk": {+ "name": "issue_parent_id_issue_id_fk",+ "tableFrom": "issue",+ "tableTo": "issue",+ "columnsFrom": [+ "parent_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "issue_assignee_user_id_user_id_fk": {+ "name": "issue_assignee_user_id_user_id_fk",+ "tableFrom": "issue",+ "tableTo": "user",+ "columnsFrom": [+ "assignee_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "issue_delegate_user_id_user_id_fk": {+ "name": "issue_delegate_user_id_user_id_fk",+ "tableFrom": "issue",+ "tableTo": "user",+ "columnsFrom": [+ "delegate_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_share_token_unique": {+ "name": "issue_share_token_unique",+ "nullsNotDistinct": false,+ "columns": [+ "share_token"+ ]+ },+ "issue_project_id_sequence_number_unique": {+ "name": "issue_project_id_sequence_number_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "sequence_number"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {+ "issue_estimate_points_check": {+ "name": "issue_estimate_points_check",+ "value": "\"issue\".\"estimate_points\" >= 0"+ },+ "issue_estimate_minutes_check": {+ "name": "issue_estimate_minutes_check",+ "value": "\"issue\".\"estimate_minutes\" >= 0"+ }+ },+ "isRLSEnabled": false+ },+ "public.issue_activity": {+ "name": "issue_activity",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "initiative_id": {+ "name": "initiative_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "kind": {+ "name": "kind",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "reply_to_id": {+ "name": "reply_to_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "actor_user_id": {+ "name": "actor_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "actor_name": {+ "name": "actor_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "body": {+ "name": "body",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "action": {+ "name": "action",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "payload": {+ "name": "payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_activity_issue_idx": {+ "name": "issue_activity_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_activity_reply_idx": {+ "name": "issue_activity_reply_idx",+ "columns": [+ {+ "expression": "reply_to_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_activity_initiative_idx": {+ "name": "issue_activity_initiative_idx",+ "columns": [+ {+ "expression": "initiative_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_activity_issue_id_issue_id_fk": {+ "name": "issue_activity_issue_id_issue_id_fk",+ "tableFrom": "issue_activity",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_activity_initiative_id_initiative_id_fk": {+ "name": "issue_activity_initiative_id_initiative_id_fk",+ "tableFrom": "issue_activity",+ "tableTo": "initiative",+ "columnsFrom": [+ "initiative_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_activity_reply_to_id_issue_activity_id_fk": {+ "name": "issue_activity_reply_to_id_issue_activity_id_fk",+ "tableFrom": "issue_activity",+ "tableTo": "issue_activity",+ "columnsFrom": [+ "reply_to_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_activity_actor_user_id_user_id_fk": {+ "name": "issue_activity_actor_user_id_user_id_fk",+ "tableFrom": "issue_activity",+ "tableTo": "user",+ "columnsFrom": [+ "actor_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "issue_activity_kind_check": {+ "name": "issue_activity_kind_check",+ "value": "\"issue_activity\".\"kind\" IN ('comment', 'activity')"+ },+ "issue_activity_owner_check": {+ "name": "issue_activity_owner_check",+ "value": "(\"issue_activity\".\"issue_id\" IS NOT NULL) <> (\"issue_activity\".\"initiative_id\" IS NOT NULL)"+ }+ },+ "isRLSEnabled": false+ },+ "public.issue_attachment": {+ "name": "issue_attachment",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "public_id": {+ "name": "public_id",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "s3_key": {+ "name": "s3_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "filename": {+ "name": "filename",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "content_type": {+ "name": "content_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "size_bytes": {+ "name": "size_bytes",+ "type": "bigint",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_attachment_issue_idx": {+ "name": "issue_attachment_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_attachment_issue_id_issue_id_fk": {+ "name": "issue_attachment_issue_id_issue_id_fk",+ "tableFrom": "issue_attachment",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_attachment_public_id_unique": {+ "name": "issue_attachment_public_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "public_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_checklist": {+ "name": "issue_checklist",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_checklist_issue_idx": {+ "name": "issue_checklist_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_checklist_issue_id_issue_id_fk": {+ "name": "issue_checklist_issue_id_issue_id_fk",+ "tableFrom": "issue_checklist",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_checklist_item": {+ "name": "issue_checklist_item",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "checklist_id": {+ "name": "checklist_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "done": {+ "name": "done",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_checklist_item_checklist_idx": {+ "name": "issue_checklist_item_checklist_idx",+ "columns": [+ {+ "expression": "checklist_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_checklist_item_checklist_id_issue_checklist_id_fk": {+ "name": "issue_checklist_item_checklist_id_issue_checklist_id_fk",+ "tableFrom": "issue_checklist_item",+ "tableTo": "issue_checklist",+ "columnsFrom": [+ "checklist_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_cycle": {+ "name": "issue_cycle",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "cycle_id": {+ "name": "cycle_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "entered_at": {+ "name": "entered_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "left_at": {+ "name": "left_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "issue_cycle_issue_idx": {+ "name": "issue_cycle_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "entered_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_cycle_cycle_idx": {+ "name": "issue_cycle_cycle_idx",+ "columns": [+ {+ "expression": "cycle_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "issue_cycle_open_idx": {+ "name": "issue_cycle_open_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "cycle_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"issue_cycle\".\"left_at\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_cycle_issue_id_issue_id_fk": {+ "name": "issue_cycle_issue_id_issue_id_fk",+ "tableFrom": "issue_cycle",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_cycle_cycle_id_cycle_id_fk": {+ "name": "issue_cycle_cycle_id_cycle_id_fk",+ "tableFrom": "issue_cycle",+ "tableTo": "cycle",+ "columnsFrom": [+ "cycle_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_field_option": {+ "name": "issue_field_option",+ "schema": "",+ "columns": {+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "field_id": {+ "name": "field_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "option_id": {+ "name": "option_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "issue_field_option_issue_id_issue_id_fk": {+ "name": "issue_field_option_issue_id_issue_id_fk",+ "tableFrom": "issue_field_option",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_field_option_field_id_custom_field_id_fk": {+ "name": "issue_field_option_field_id_custom_field_id_fk",+ "tableFrom": "issue_field_option",+ "tableTo": "custom_field",+ "columnsFrom": [+ "field_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_field_option_option_id_custom_field_option_id_fk": {+ "name": "issue_field_option_option_id_custom_field_option_id_fk",+ "tableFrom": "issue_field_option",+ "tableTo": "custom_field_option",+ "columnsFrom": [+ "option_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "issue_field_option_issue_id_field_id_option_id_pk": {+ "name": "issue_field_option_issue_id_field_id_option_id_pk",+ "columns": [+ "issue_id",+ "field_id",+ "option_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_field_value": {+ "name": "issue_field_value",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "field_id": {+ "name": "field_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "value_text": {+ "name": "value_text",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "value_number": {+ "name": "value_number",+ "type": "numeric",+ "primaryKey": false,+ "notNull": false+ },+ "value_bool": {+ "name": "value_bool",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false+ },+ "value_date": {+ "name": "value_date",+ "type": "date",+ "primaryKey": false,+ "notNull": false+ },+ "value_datetime": {+ "name": "value_datetime",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "value_datetime_end": {+ "name": "value_datetime_end",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "value_user_id": {+ "name": "value_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "issue_field_value_issue_id_issue_id_fk": {+ "name": "issue_field_value_issue_id_issue_id_fk",+ "tableFrom": "issue_field_value",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_field_value_field_id_custom_field_id_fk": {+ "name": "issue_field_value_field_id_custom_field_id_fk",+ "tableFrom": "issue_field_value",+ "tableTo": "custom_field",+ "columnsFrom": [+ "field_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_field_value_value_user_id_user_id_fk": {+ "name": "issue_field_value_value_user_id_user_id_fk",+ "tableFrom": "issue_field_value",+ "tableTo": "user",+ "columnsFrom": [+ "value_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "issue_field_value_issue_id_field_id_unique": {+ "name": "issue_field_value_issue_id_field_id_unique",+ "nullsNotDistinct": false,+ "columns": [+ "issue_id",+ "field_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.issue_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.issue_worklog": {+ "name": "issue_worklog",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "minutes": {+ "name": "minutes",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "spent_on": {+ "name": "spent_on",+ "type": "date",+ "primaryKey": false,+ "notNull": true+ },+ "note": {+ "name": "note",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "issue_worklog_issue_idx": {+ "name": "issue_worklog_issue_idx",+ "columns": [+ {+ "expression": "issue_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "spent_on",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "issue_worklog_issue_id_issue_id_fk": {+ "name": "issue_worklog_issue_id_issue_id_fk",+ "tableFrom": "issue_worklog",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "issue_worklog_user_id_user_id_fk": {+ "name": "issue_worklog_user_id_user_id_fk",+ "tableFrom": "issue_worklog",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "issue_worklog_minutes_check": {+ "name": "issue_worklog_minutes_check",+ "value": "\"issue_worklog\".\"minutes\" > 0"+ }+ },+ "isRLSEnabled": false+ },+ "public.label": {+ "name": "label",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "group_id": {+ "name": "group_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'#6b7280'"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "label_project_id_project_id_fk": {+ "name": "label_project_id_project_id_fk",+ "tableFrom": "label",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "label_group_id_label_group_id_fk": {+ "name": "label_group_id_label_group_id_fk",+ "tableFrom": "label",+ "tableTo": "label_group",+ "columnsFrom": [+ "group_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "label_project_id_name_unique": {+ "name": "label_project_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "name"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.label_group": {+ "name": "label_group",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'#6b7280'"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "label_group_project_id_project_id_fk": {+ "name": "label_group_project_id_project_id_fk",+ "tableFrom": "label_group",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "label_group_project_id_name_unique": {+ "name": "label_group_project_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "name"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.note_board": {+ "name": "note_board",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "owner_user_id": {+ "name": "owner_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_by_user_id": {+ "name": "created_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "canvas": {+ "name": "canvas",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "note_board_project_idx": {+ "name": "note_board_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "note_board_project_id_project_id_fk": {+ "name": "note_board_project_id_project_id_fk",+ "tableFrom": "note_board",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "note_board_owner_user_id_user_id_fk": {+ "name": "note_board_owner_user_id_user_id_fk",+ "tableFrom": "note_board",+ "tableTo": "user",+ "columnsFrom": [+ "owner_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "note_board_created_by_user_id_user_id_fk": {+ "name": "note_board_created_by_user_id_user_id_fk",+ "tableFrom": "note_board",+ "tableTo": "user",+ "columnsFrom": [+ "created_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.note_board_member": {+ "name": "note_board_member",+ "schema": "",+ "columns": {+ "board_id": {+ "name": "board_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {+ "note_board_member_user_idx": {+ "name": "note_board_member_user_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "note_board_member_board_id_note_board_id_fk": {+ "name": "note_board_member_board_id_note_board_id_fk",+ "tableFrom": "note_board_member",+ "tableTo": "note_board",+ "columnsFrom": [+ "board_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "note_board_member_user_id_user_id_fk": {+ "name": "note_board_member_user_id_user_id_fk",+ "tableFrom": "note_board_member",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "note_board_member_board_id_user_id_pk": {+ "name": "note_board_member_board_id_user_id_pk",+ "columns": [+ "board_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.notification": {+ "name": "notification",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "issue_id": {+ "name": "issue_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "source_activity_id": {+ "name": "source_activity_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "actor_user_id": {+ "name": "actor_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "actor_name": {+ "name": "actor_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "read_at": {+ "name": "read_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "snoozed_until": {+ "name": "snoozed_until",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "notification_user_idx": {+ "name": "notification_user_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "created_at",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "notification_user_unread_idx": {+ "name": "notification_user_unread_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "id",+ "isExpression": false,+ "asc": false,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"notification\".\"read_at\" IS NULL",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "notification_user_id_user_id_fk": {+ "name": "notification_user_id_user_id_fk",+ "tableFrom": "notification",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "notification_project_id_project_id_fk": {+ "name": "notification_project_id_project_id_fk",+ "tableFrom": "notification",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "notification_issue_id_issue_id_fk": {+ "name": "notification_issue_id_issue_id_fk",+ "tableFrom": "notification",+ "tableTo": "issue",+ "columnsFrom": [+ "issue_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "notification_source_activity_id_issue_activity_id_fk": {+ "name": "notification_source_activity_id_issue_activity_id_fk",+ "tableFrom": "notification",+ "tableTo": "issue_activity",+ "columnsFrom": [+ "source_activity_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "notification_actor_user_id_user_id_fk": {+ "name": "notification_actor_user_id_user_id_fk",+ "tableFrom": "notification",+ "tableTo": "user",+ "columnsFrom": [+ "actor_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "notification_type_check": {+ "name": "notification_type_check",+ "value": "\"notification\".\"type\" IN ('assigned', 'mentioned', 'commented', 'state_changed')"+ }+ },+ "isRLSEnabled": false+ },+ "public.notification_delivery": {+ "name": "notification_delivery",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "channel": {+ "name": "channel",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "recipient": {+ "name": "recipient",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "payload": {+ "name": "payload",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "attempts": {+ "name": "attempts",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "next_attempt_at": {+ "name": "next_attempt_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "last_error": {+ "name": "last_error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "notification_delivery_due_idx": {+ "name": "notification_delivery_due_idx",+ "columns": [+ {+ "expression": "next_attempt_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "where": "\"notification_delivery\".\"status\" = 'pending'",+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "notification_delivery_project_id_project_id_fk": {+ "name": "notification_delivery_project_id_project_id_fk",+ "tableFrom": "notification_delivery",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "notification_delivery_channel_check": {+ "name": "notification_delivery_channel_check",+ "value": "\"notification_delivery\".\"channel\" IN ('email', 'telegram')"+ }+ },+ "isRLSEnabled": false+ },+ "public.project": {+ "name": "project",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "next_sequence": {+ "name": "next_sequence",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 1+ },+ "mcp_enabled": {+ "name": "mcp_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "initiatives_enabled": {+ "name": "initiatives_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "dashboards_enabled": {+ "name": "dashboards_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "notes_enabled": {+ "name": "notes_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "cycles_enabled": {+ "name": "cycles_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "subtasks_enabled": {+ "name": "subtasks_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "checklists_enabled": {+ "name": "checklists_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "issue_stats_enabled": {+ "name": "issue_stats_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "points_estimate_enabled": {+ "name": "points_estimate_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "time_estimate_enabled": {+ "name": "time_estimate_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "time_logging_enabled": {+ "name": "time_logging_enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "project_key_unique": {+ "name": "project_key_unique",+ "nullsNotDistinct": false,+ "columns": [+ "key"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_action": {+ "name": "project_action",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "icon": {+ "name": "icon",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "condition": {+ "name": "condition",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "effect": {+ "name": "effect",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_action_project_idx": {+ "name": "project_action_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_action_project_id_project_id_fk": {+ "name": "project_action_project_id_project_id_fk",+ "tableFrom": "project_action",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_column": {+ "name": "project_column",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "state_type": {+ "name": "state_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'unstarted'"+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'#6b7280'"+ },+ "position": {+ "name": "position",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "wip_limit": {+ "name": "wip_limit",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "wip_mode": {+ "name": "wip_mode",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'soft'"+ },+ "auto_assign_user_id": {+ "name": "auto_assign_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "project_column_project_id_project_id_fk": {+ "name": "project_column_project_id_project_id_fk",+ "tableFrom": "project_column",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_column_auto_assign_user_id_user_id_fk": {+ "name": "project_column_auto_assign_user_id_user_id_fk",+ "tableFrom": "project_column",+ "tableTo": "user",+ "columnsFrom": [+ "auto_assign_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "project_column_project_id_position_unique": {+ "name": "project_column_project_id_position_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "position"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {+ "project_column_state_type_check": {+ "name": "project_column_state_type_check",+ "value": "\"project_column\".\"state_type\" IN ('backlog', 'unstarted', 'started', 'completed', 'canceled')"+ },+ "project_column_wip_mode_check": {+ "name": "project_column_wip_mode_check",+ "value": "\"project_column\".\"wip_mode\" IN ('soft', 'hard')"+ },+ "project_column_wip_limit_check": {+ "name": "project_column_wip_limit_check",+ "value": "\"project_column\".\"wip_limit\" IS NULL OR \"project_column\".\"wip_limit\" > 0"+ }+ },+ "isRLSEnabled": false+ },+ "public.project_dashboard": {+ "name": "project_dashboard",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "icon": {+ "name": "icon",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "layout": {+ "name": "layout",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_dashboard_project_idx": {+ "name": "project_dashboard_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_dashboard_project_id_project_id_fk": {+ "name": "project_dashboard_project_id_project_id_fk",+ "tableFrom": "project_dashboard",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_invite": {+ "name": "project_invite",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "token": {+ "name": "token",+ "type": "uuid",+ "primaryKey": false,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "email": {+ "name": "email",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'member'"+ },+ "role_id": {+ "name": "role_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'pending'"+ },+ "invited_by_user_id": {+ "name": "invited_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "accepted_by_user_id": {+ "name": "accepted_by_user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "responded_at": {+ "name": "responded_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "project_invite_pending_uq": {+ "name": "project_invite_pending_uq",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "email",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"project_invite\".\"status\" = 'pending'",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "project_invite_project_idx": {+ "name": "project_invite_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_invite_project_id_project_id_fk": {+ "name": "project_invite_project_id_project_id_fk",+ "tableFrom": "project_invite",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_invite_role_id_project_role_id_fk": {+ "name": "project_invite_role_id_project_role_id_fk",+ "tableFrom": "project_invite",+ "tableTo": "project_role",+ "columnsFrom": [+ "role_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "project_invite_invited_by_user_id_user_id_fk": {+ "name": "project_invite_invited_by_user_id_user_id_fk",+ "tableFrom": "project_invite",+ "tableTo": "user",+ "columnsFrom": [+ "invited_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "project_invite_accepted_by_user_id_user_id_fk": {+ "name": "project_invite_accepted_by_user_id_user_id_fk",+ "tableFrom": "project_invite",+ "tableTo": "user",+ "columnsFrom": [+ "accepted_by_user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "project_invite_token_unique": {+ "name": "project_invite_token_unique",+ "nullsNotDistinct": false,+ "columns": [+ "token"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {+ "project_invite_role_check": {+ "name": "project_invite_role_check",+ "value": "\"project_invite\".\"role\" IN ('owner', 'member')"+ },+ "project_invite_status_check": {+ "name": "project_invite_status_check",+ "value": "\"project_invite\".\"status\" IN ('pending', 'accepted', 'rejected')"+ }+ },+ "isRLSEnabled": false+ },+ "public.project_member": {+ "name": "project_member",+ "schema": "",+ "columns": {+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'member'"+ },+ "role_id": {+ "name": "role_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "''"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_member_user_idx": {+ "name": "project_member_user_idx",+ "columns": [+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_member_project_id_project_id_fk": {+ "name": "project_member_project_id_project_id_fk",+ "tableFrom": "project_member",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_member_user_id_user_id_fk": {+ "name": "project_member_user_id_user_id_fk",+ "tableFrom": "project_member",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_member_role_id_project_role_id_fk": {+ "name": "project_member_role_id_project_role_id_fk",+ "tableFrom": "project_member",+ "tableTo": "project_role",+ "columnsFrom": [+ "role_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "project_member_project_id_user_id_pk": {+ "name": "project_member_project_id_user_id_pk",+ "columns": [+ "project_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "project_member_role_check": {+ "name": "project_member_role_check",+ "value": "\"project_member\".\"role\" IN ('owner', 'member')"+ }+ },+ "isRLSEnabled": false+ },+ "public.project_notification_setting": {+ "name": "project_notification_setting",+ "schema": "",+ "columns": {+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true+ },+ "ciphertext": {+ "name": "ciphertext",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "iv": {+ "name": "iv",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "auth_tag": {+ "name": "auth_tag",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "redacted": {+ "name": "redacted",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "project_notification_setting_project_id_project_id_fk": {+ "name": "project_notification_setting_project_id_project_id_fk",+ "tableFrom": "project_notification_setting",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_role": {+ "name": "project_role",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "is_default": {+ "name": "is_default",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "permissions": {+ "name": "permissions",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_role_default_uq": {+ "name": "project_role_default_uq",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "where": "\"project_role\".\"is_default\"",+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "project_role_project_idx": {+ "name": "project_role_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_role_project_id_project_id_fk": {+ "name": "project_role_project_id_project_id_fk",+ "tableFrom": "project_role",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "project_role_project_id_name_unique": {+ "name": "project_role_project_id_name_unique",+ "nullsNotDistinct": false,+ "columns": [+ "project_id",+ "name"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_setting": {+ "name": "project_setting",+ "schema": "",+ "columns": {+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "value": {+ "name": "value",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "project_setting_project_id_project_id_fk": {+ "name": "project_setting_project_id_project_id_fk",+ "tableFrom": "project_setting",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "project_setting_project_id_key_pk": {+ "name": "project_setting_project_id_key_pk",+ "columns": [+ "project_id",+ "key"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_view": {+ "name": "project_view",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "icon": {+ "name": "icon",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "filters": {+ "name": "filters",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "display": {+ "name": "display",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "position": {+ "name": "position",+ "type": "double precision",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "share_token": {+ "name": "share_token",+ "type": "uuid",+ "primaryKey": false,+ "notNull": false+ },+ "share_extended": {+ "name": "share_extended",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "project_view_project_idx": {+ "name": "project_view_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "position",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "project_view_project_id_project_id_fk": {+ "name": "project_view_project_id_project_id_fk",+ "tableFrom": "project_view",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "project_view_share_token_unique": {+ "name": "project_view_share_token_unique",+ "nullsNotDistinct": false,+ "columns": [+ "share_token"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.project_view_favorite": {+ "name": "project_view_favorite",+ "schema": "",+ "columns": {+ "view_id": {+ "name": "view_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "project_view_favorite_view_id_project_view_id_fk": {+ "name": "project_view_favorite_view_id_project_view_id_fk",+ "tableFrom": "project_view_favorite",+ "tableTo": "project_view",+ "columnsFrom": [+ "view_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "project_view_favorite_user_id_user_id_fk": {+ "name": "project_view_favorite_user_id_user_id_fk",+ "tableFrom": "project_view_favorite",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "project_view_favorite_view_id_user_id_pk": {+ "name": "project_view_favorite_view_id_user_id_pk",+ "columns": [+ "view_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.revision": {+ "name": "revision",+ "schema": "",+ "columns": {+ "scope": {+ "name": "scope",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "rev": {+ "name": "rev",+ "type": "bigint",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ }+ },+ "indexes": {+ "revision_project_idx": {+ "name": "revision_project_idx",+ "columns": [+ {+ "expression": "project_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_notification_preference": {+ "name": "user_notification_preference",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "project_id": {+ "name": "project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "email_events": {+ "name": "email_events",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "telegram_events": {+ "name": "telegram_events",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "user_notification_preference_user_id_user_id_fk": {+ "name": "user_notification_preference_user_id_user_id_fk",+ "tableFrom": "user_notification_preference",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_notification_preference_project_id_project_id_fk": {+ "name": "user_notification_preference_project_id_project_id_fk",+ "tableFrom": "user_notification_preference",+ "tableTo": "project",+ "columnsFrom": [+ "project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "user_notification_pref_user_project_unique": {+ "name": "user_notification_pref_user_project_unique",+ "nullsNotDistinct": false,+ "columns": [+ "user_id",+ "project_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_preference": {+ "name": "user_preference",+ "schema": "",+ "columns": {+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "timezone": {+ "name": "timezone",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'UTC'"+ },+ "locale": {+ "name": "locale",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'en'"+ },+ "theme": {+ "name": "theme",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'system'"+ },+ "issue_open_mode": {+ "name": "issue_open_mode",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'panel'"+ },+ "start_page": {+ "name": "start_page",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'work-items'"+ },+ "show_chat_by_default": {+ "name": "show_chat_by_default",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "issue_stats_open": {+ "name": "issue_stats_open",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "issue_stats_view": {+ "name": "issue_stats_view",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'compact'"+ },+ "issue_activity_view": {+ "name": "issue_activity_view",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'flat'"+ },+ "auto_watch": {+ "name": "auto_watch",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "hotkeys": {+ "name": "hotkeys",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "last_project_id": {+ "name": "last_project_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "user_preference_user_id_user_id_fk": {+ "name": "user_preference_user_id_user_id_fk",+ "tableFrom": "user_preference",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "user_preference_last_project_id_project_id_fk": {+ "name": "user_preference_last_project_id_project_id_fk",+ "tableFrom": "user_preference",+ "tableTo": "project",+ "columnsFrom": [+ "last_project_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "user_preference_theme_check": {+ "name": "user_preference_theme_check",+ "value": "\"user_preference\".\"theme\" IN ('light', 'dark', 'system')"+ },+ "user_preference_issue_open_mode_check": {+ "name": "user_preference_issue_open_mode_check",+ "value": "\"user_preference\".\"issue_open_mode\" IN ('panel', 'page')"+ },+ "user_preference_start_page_check": {+ "name": "user_preference_start_page_check",+ "value": "\"user_preference\".\"start_page\" IN ('inbox', 'dashboard', 'work-items', 'initiatives')"+ },+ "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 acedb2b0..3621ec71 100644--- a/packages/db/drizzle/meta/_journal.json+++ b/packages/db/drizzle/meta/_journal.json@@ -729,6 +729,13 @@"when": 1787578503113,"tag": "0103_strange_maginty","breakpoints": true+ },+ {+ "idx": 104,+ "version": "7",+ "when": 1787584764123,+ "tag": "0104_chunky_loki",+ "breakpoints": true}]}\ No newline at end of filediff --git a/packages/db/src/schema/app.ts b/packages/db/src/schema/app.tsindex 2f7bf064..3a24ee33 100644--- a/packages/db/src/schema/app.ts+++ b/packages/db/src/schema/app.ts@@ -77,6 +77,10 @@ export const project = pgTable('project', {// values, which show again when it is turned back on.pointsEstimateEnabled: boolean('points_estimate_enabled').notNull().default(false),timeEstimateEnabled: boolean('time_estimate_enabled').notNull().default(false),+ // Whether members log the time they spend on the issues of this project, set in+ // the same place. Independent of the time estimate: a team can log time without+ // estimating first. Turning it off hides the entries and keeps them.+ timeLoggingEnabled: boolean('time_logging_enabled').notNull().default(false),createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),});@@ -1270,6 +1274,37 @@ export const issueChecklistItem = pgTable((t) => [index('issue_checklist_item_checklist_idx').on(t.checklistId, t.position)],);+// The time a member spent on an issue, one row per entry. The time an issue took is+// the sum of its entries and the time left is the estimate minus that sum; neither+// is stored, since two numbers kept next to the entries drift apart. Each entry+// belongs to the member who logged it, so several people log their own days on the+// same issue and one member's correction never overwrites another's.+export const issueWorklog = pgTable(+ 'issue_worklog',+ {+ id: serial('id').primaryKey(),+ issueId: integer('issue_id')+ .notNull()+ .references(() => issue.id, { onDelete: 'cascade' }),+ // Who logged the entry. Their entries go with the account when it is deleted.+ userId: text('user_id')+ .notNull()+ .references(() => user.id, { onDelete: 'cascade' }),+ minutes: integer('minutes').notNull(),+ // The day the work happened on, which is not the day it was logged: a member+ // enters yesterday's work today.+ spentOn: date('spent_on').notNull(),+ note: text('note'),+ createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),+ },+ (t) => [+ check('issue_worklog_minutes_check', sql`${t.minutes} > 0`),+ // Backs the entries of an issue, read newest day first, and the sums the issue+ // payload carries.+ index('issue_worklog_issue_idx').on(t.issueId, t.spentOn.desc()),+ ],+);+// One side of a change: the text the feed shows, and the id of the row behind it// when the side names one. The text is a snapshot, so an entry still reads// correctly after that row is renamed or deleted; the id is what makes the entry@@ -1281,6 +1316,9 @@ export interface ActivitySide {stateType?: string | null;repo?: string;number?: number;+ // A 'worklog' side carries the day its time was spent on: a change of an entry+ // can move it to another day.+ date?: string | null;}// What an activity entry says changed. `subject` names the sub-item the action