Skip to content

⭐️⭐️⭐️ 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.

feat: add datetime custom fields and calendar placement by date fields (#139)

Croff0f0eb7206c91
diff --git a/apps/api/src/issues/__tests__/integration/issues.test.ts b/apps/api/src/issues/__tests__/integration/issues.test.ts
index c28f2570..2ef5e568 100644
--- a/apps/api/src/issues/__tests__/integration/issues.test.ts
+++ b/apps/api/src/issues/__tests__/integration/issues.test.ts
@@ -561,6 +561,145 @@ describe('issues', () => {
expect((await fieldValue(asOwner, issue.id, field.id))?.value).toBe(true);
});
+ // Treaty revives an ISO datetime into a Date, so the moment is compared, not
+ // the shape it arrives in.
+ function asIso(value: unknown): string {
+ return new Date(value as string).toISOString();
+ }
+
+ it('stores and reads back a datetime field value', async () => {
+ const { asOwner, columnId } = await setupProject();
+ const field = (
+ await asOwner
+ .projects({ projectKey: 'MKT' })
+ ['custom-fields'].post({ name: 'Kickoff', fieldType: 'datetime' })
+ ).data!;
+ const issue = (await createIssue(asOwner, columnId)).data!;
+
+ const put = await asOwner
+ .issues({ issueId: issue.id })
+ .fields({ fieldId: field.id })
+ .put({ value: '2026-09-16T07:30:00.000Z' });
+ expect(put.status).toBe(200);
+
+ const stored = await fieldValue(asOwner, issue.id, field.id);
+ expect(asIso(stored?.value)).toBe('2026-09-16T07:30:00.000Z');
+ expect(stored?.valueEnd).toBeNull();
+ });
+
+ it('stores and reads back both ends of a datetime range', async () => {
+ const { asOwner, columnId } = await setupProject();
+ const field = (
+ await asOwner
+ .projects({ projectKey: 'MKT' })
+ ['custom-fields'].post({ name: 'Slot', fieldType: 'datetime_range' })
+ ).data!;
+ const issue = (await createIssue(asOwner, columnId)).data!;
+
+ const put = await asOwner
+ .issues({ issueId: issue.id })
+ .fields({ fieldId: field.id })
+ .put({ value: '2026-09-16T07:30:00.000Z', valueEnd: '2026-09-16T09:30:00.000Z' });
+ expect(put.status).toBe(200);
+
+ const stored = await fieldValue(asOwner, issue.id, field.id);
+ expect(asIso(stored?.value)).toBe('2026-09-16T07:30:00.000Z');
+ expect(asIso(stored?.valueEnd)).toBe('2026-09-16T09:30:00.000Z');
+ });
+
+ it('rejects an unparseable datetime', async () => {
+ const { asOwner, columnId } = await setupProject();
+ const field = (
+ await asOwner
+ .projects({ projectKey: 'MKT' })
+ ['custom-fields'].post({ name: 'Kickoff', fieldType: 'datetime' })
+ ).data!;
+ const issue = (await createIssue(asOwner, columnId)).data!;
+
+ const put = await asOwner
+ .issues({ issueId: issue.id })
+ .fields({ fieldId: field.id })
+ .put({ value: 'not-a-datetime' });
+ expect(put.status).toBe(400);
+ });
+
+ it('rejects a datetime without a time of day', async () => {
+ const { asOwner, columnId } = await setupProject();
+ const field = (
+ await asOwner
+ .projects({ projectKey: 'MKT' })
+ ['custom-fields'].post({ name: 'Kickoff', fieldType: 'datetime' })
+ ).data!;
+ const issue = (await createIssue(asOwner, columnId)).data!;
+
+ const put = await asOwner
+ .issues({ issueId: issue.id })
+ .fields({ fieldId: field.id })
+ .put({ value: '2026-09-16' });
+ expect(put.status).toBe(400);
+ });
+
+ it('rejects a range whose end is not after its start', async () => {
+ const { asOwner, columnId } = await setupProject();
+ const field = (
+ await asOwner
+ .projects({ projectKey: 'MKT' })
+ ['custom-fields'].post({ name: 'Slot', fieldType: 'datetime_range' })
+ ).data!;
+ const issue = (await createIssue(asOwner, columnId)).data!;
+ const fields = asOwner.issues({ issueId: issue.id }).fields({ fieldId: field.id });
+
+ const equal = await fields.put({
+ value: '2026-09-16T07:30:00.000Z',
+ valueEnd: '2026-09-16T07:30:00.000Z',
+ });
+ expect(equal.status).toBe(400);
+
+ const before = await fields.put({
+ value: '2026-09-16T07:30:00.000Z',
+ valueEnd: '2026-09-16T06:30:00.000Z',
+ });
+ expect(before.status).toBe(400);
+ });
+
+ it('rejects a range end without a start', async () => {
+ const { asOwner, columnId } = await setupProject();
+ const field = (
+ await asOwner
+ .projects({ projectKey: 'MKT' })
+ ['custom-fields'].post({ name: 'Slot', fieldType: 'datetime_range' })
+ ).data!;
+ const issue = (await createIssue(asOwner, columnId)).data!;
+
+ const put = await asOwner
+ .issues({ issueId: issue.id })
+ .fields({ fieldId: field.id })
+ .put({ value: null, valueEnd: '2026-09-16T09:30:00.000Z' });
+ expect(put.status).toBe(400);
+ });
+
+ it('clears both ends of a datetime range when set to null', async () => {
+ const { asOwner, columnId } = await setupProject();
+ const field = (
+ await asOwner
+ .projects({ projectKey: 'MKT' })
+ ['custom-fields'].post({ name: 'Slot', fieldType: 'datetime_range' })
+ ).data!;
+ const issue = (await createIssue(asOwner, columnId)).data!;
+ const fields = asOwner.issues({ issueId: issue.id }).fields({ fieldId: field.id });
+ await fields.put({
+ value: '2026-09-16T07:30:00.000Z',
+ valueEnd: '2026-09-16T09:30:00.000Z',
+ });
+
+ const cleared = await fields.put({ value: null });
+ expect(cleared.status).toBe(200);
+
+ const stored = await fieldValue(asOwner, issue.id, field.id);
+ expect(stored?.value).toBeNull();
+ expect(stored?.valueEnd).toBeNull();
+ });
+
it('clears a field value when set to null', async () => {
const { asOwner, columnId } = await setupProject();
const field = (
diff --git a/apps/api/src/issues/routes.ts b/apps/api/src/issues/routes.ts
index 7c1afb4c..a3e6f068 100644
--- a/apps/api/src/issues/routes.ts
+++ b/apps/api/src/issues/routes.ts
@@ -93,10 +93,11 @@ async function purgeObjects(attachments: { s3Key: string }[]): Promise<void> {
// --- Response DTO schemas (mirror the store interfaces the handlers return) -------
// IssueFieldValueEntry from the store: a compact custom field value carried on an
-// issue (scalar value plus selected option ids).
+// issue (scalar value, the end of a datetime_range, and selected option ids).
const IssueFieldValueEntry = t.Object({
fieldId: t.Number(),
value: t.Nullable(t.Union([t.String(), t.Number(), t.Boolean()])),
+ valueEnd: t.Nullable(t.String()),
optionIds: t.Array(t.Number()),
});
@@ -142,6 +143,7 @@ const IssueFieldValueRow = t.Object({
name: t.String(),
fieldType: t.String(),
value: t.Nullable(t.Union([t.String(), t.Number(), t.Boolean()])),
+ valueEnd: t.Nullable(t.String()),
optionIds: t.Array(t.Number()),
});
@@ -947,7 +949,8 @@ export const issueRoutes = new Elysia({ name: 'issues', detail: { tags: ['Issues
// Sets one custom field's value on one issue. For select/multi_select fields,
// body.optionIds replaces the full selection; for every other field type,
- // body.value must match the field's type (text/number/boolean/date).
+ // body.value must match the field's type (text/number/boolean/date/datetime).
+ // A datetime_range takes its end in body.valueEnd.
.put(
'/issues/:issueId/fields/:fieldId',
async ({ params, body, user, projectId }) => {
@@ -963,6 +966,7 @@ export const issueRoutes = new Elysia({ name: 'issues', detail: { tags: ['Issues
{
body: t.Object({
value: t.Optional(t.Nullable(t.Union([t.String(), t.Number(), t.Boolean()]))),
+ valueEnd: t.Optional(t.Nullable(t.String())),
optionIds: t.Optional(t.Array(t.Integer())),
}),
params: t.Object({ issueId: t.Numeric(), fieldId: t.Numeric() }),
diff --git a/apps/api/src/issues/store.ts b/apps/api/src/issues/store.ts
index 5fed446f..73a8da8e 100644
--- a/apps/api/src/issues/store.ts
+++ b/apps/api/src/issues/store.ts
@@ -61,10 +61,12 @@ import { applySubtaskAutomation } from './automation';
// plus the issue's project-scoped sequence number.
// Compact custom field value for the work items payload: the scalar value (null for
-// select/multi_select and unset fields) and the selected option ids.
+// select/multi_select and unset fields), the end of a datetime_range, and the
+// selected option ids.
export interface IssueFieldValueEntry {
fieldId: number;
value: string | number | boolean | null;
+ valueEnd: string | null;
optionIds: number[];
}
@@ -529,6 +531,8 @@ async function attachFieldValues(issues: IssueRow[]): Promise<void> {
valueNumber: issueFieldValue.valueNumber,
valueBool: issueFieldValue.valueBool,
valueDate: issueFieldValue.valueDate,
+ valueDatetime: issueFieldValue.valueDatetime,
+ valueDatetimeEnd: issueFieldValue.valueDatetimeEnd,
})
.from(issueFieldValue)
.where(inArray(issueFieldValue.issueId, issueIds)),
@@ -549,11 +553,16 @@ async function attachFieldValues(issues: IssueRow[]): Promise<void> {
let fields = byIssue.get(issueId);
if (!fields) byIssue.set(issueId, (fields = new Map()));
let entry = fields.get(fieldId);
- if (!entry) fields.set(fieldId, (entry = { fieldId, value: null, optionIds: [] }));
+ if (!entry)
+ fields.set(fieldId, (entry = { fieldId, value: null, valueEnd: null, optionIds: [] }));
return entry;
};
- for (const row of scalarRows) entryFor(row.issueId, row.fieldId).value = pickScalarValue(row);
+ for (const row of scalarRows) {
+ const entry = entryFor(row.issueId, row.fieldId);
+ entry.value = pickScalarValue(row);
+ entry.valueEnd = row.valueDatetimeEnd ? iso(row.valueDatetimeEnd) : null;
+ }
for (const row of optionRows) entryFor(row.issueId, row.fieldId).optionIds.push(row.optionId);
for (const i of issues) {
@@ -1204,6 +1213,8 @@ export interface IssueFieldValueRow {
name: string;
fieldType: CustomFieldType;
value: string | number | boolean | null;
+ // The end of a datetime_range as an ISO datetime; null for every other type.
+ valueEnd: string | null;
optionIds: number[];
}
@@ -1212,11 +1223,13 @@ function pickScalarValue(row: {
valueNumber: string | null;
valueBool: boolean | null;
valueDate: string | null;
+ valueDatetime: Date | null;
}): string | number | boolean | null {
if (row.valueText != null) return row.valueText;
if (row.valueNumber != null) return Number(row.valueNumber);
if (row.valueBool != null) return row.valueBool;
if (row.valueDate != null) return row.valueDate;
+ if (row.valueDatetime != null) return iso(row.valueDatetime);
return null;
}
@@ -1233,6 +1246,8 @@ export async function getIssueFieldValues(issueId: number): Promise<IssueFieldVa
valueNumber: issueFieldValue.valueNumber,
valueBool: issueFieldValue.valueBool,
valueDate: issueFieldValue.valueDate,
+ valueDatetime: issueFieldValue.valueDatetime,
+ valueDatetimeEnd: issueFieldValue.valueDatetimeEnd,
})
.from(issue)
.innerJoin(
@@ -1265,6 +1280,7 @@ export async function getIssueFieldValues(issueId: number): Promise<IssueFieldVa
name: row.name,
fieldType: row.fieldType as CustomFieldType,
value: pickScalarValue(row),
+ valueEnd: row.valueDatetimeEnd ? iso(row.valueDatetimeEnd) : null,
optionIds: optionsByField.get(row.fieldId) ?? [],
}));
}
@@ -1281,15 +1297,33 @@ function isHttpUrl(value: string): boolean {
return url.protocol === 'http:' || url.protocol === 'https:';
}
+// A datetime value on the way in: an ISO datetime string, or null when unset.
+// Anything else (a number, a date-only string, unparseable text) is rejected: a
+// value without a time of day would land on midnight UTC, which is another day
+// for most readers.
+function parseDatetime(value: unknown): Date | null {
+ if (value == null || value === '') return null;
+ if (typeof value !== 'string') throw new HttpError(400, 'Invalid datetime');
+ if (!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(value)) throw new HttpError(400, 'Invalid datetime');
+ const date = new Date(value);
+ if (Number.isNaN(date.getTime())) throw new HttpError(400, 'Invalid datetime');
+ return date;
+}
+
// Sets one field's value on one issue. projectId is the issue's project: the field
// is resolved inside it, so a field id belonging to another project does not match.
// For select/multi_select fields, pass optionIds (replaces the full selection); for
-// every other field type, pass value matching the field's type.
+// every other field type, pass value matching the field's type. A datetime_range
+// takes its end in valueEnd.
export async function setIssueFieldValue(
projectId: number,
issueId: number,
fieldId: number,
- input: { value?: string | number | boolean | null; optionIds?: number[] },
+ input: {
+ value?: string | number | boolean | null;
+ valueEnd?: string | null;
+ optionIds?: number[];
+ },
actorUserId?: string | null,
): Promise<void> {
const field = await getCustomFieldById(projectId, fieldId);
@@ -1342,6 +1376,19 @@ export async function setIssueFieldValue(
case 'date':
column = { valueDate: (input.value as string) ?? null };
break;
+ case 'datetime':
+ column = { valueDatetime: parseDatetime(input.value), valueDatetimeEnd: null };
+ break;
+ case 'datetime_range': {
+ const start = parseDatetime(input.value);
+ const end = parseDatetime(input.valueEnd);
+ if (end && !start) throw new HttpError(400, 'Range end needs a start');
+ if (start && end && end <= start) {
+ throw new HttpError(400, 'Range end must be after its start');
+ }
+ column = { valueDatetime: start, valueDatetimeEnd: end };
+ break;
+ }
default:
column = { valueText: (input.value as string) ?? null };
}
@@ -1357,6 +1404,8 @@ export async function setIssueFieldValue(
toText = null;
} else if (field.fieldType === 'boolean') {
toText = value ? 'true' : 'false';
+ } else if (field.fieldType === 'datetime_range' && input.valueEnd) {
+ toText = `${String(value)} — ${input.valueEnd}`;
} else {
toText = String(value);
}
diff --git a/apps/api/src/modules/custom-fields/__tests__/integration/custom-fields.test.ts b/apps/api/src/modules/custom-fields/__tests__/integration/custom-fields.test.ts
index 3486086b..66169c54 100644
--- a/apps/api/src/modules/custom-fields/__tests__/integration/custom-fields.test.ts
+++ b/apps/api/src/modules/custom-fields/__tests__/integration/custom-fields.test.ts
@@ -129,6 +129,18 @@ describe('custom-fields', () => {
expect(res.status).toBe(400);
});
+ it('creates the datetime field types', async () => {
+ const { asOwner } = await setupProject();
+
+ const moment = await fields(asOwner).post({ name: 'Kickoff', fieldType: 'datetime' });
+ expect(moment.status).toBe(201);
+ expect(moment.data).toMatchObject({ fieldType: 'datetime' });
+
+ const slot = await fields(asOwner).post({ name: 'Slot', fieldType: 'datetime_range' });
+ expect(slot.status).toBe(201);
+ expect(slot.data).toMatchObject({ fieldType: 'datetime_range' });
+ });
+
it('rejects an unknown field type', async () => {
const { asOwner } = await setupProject();
const res = await fields(asOwner).post({
diff --git a/apps/api/src/modules/custom-fields/model.ts b/apps/api/src/modules/custom-fields/model.ts
index 50c3d0e5..9981efb6 100644
--- a/apps/api/src/modules/custom-fields/model.ts
+++ b/apps/api/src/modules/custom-fields/model.ts
@@ -7,6 +7,8 @@ const fieldType = t.Union([
t.Literal('number'),
t.Literal('boolean'),
t.Literal('date'),
+ t.Literal('datetime'),
+ t.Literal('datetime_range'),
t.Literal('select'),
t.Literal('multi_select'),
]);
diff --git a/apps/api/src/modules/custom-fields/service.ts b/apps/api/src/modules/custom-fields/service.ts
index 410a4803..5d79a7e4 100644
--- a/apps/api/src/modules/custom-fields/service.ts
+++ b/apps/api/src/modules/custom-fields/service.ts
@@ -10,7 +10,16 @@ import { getIssueTypeById } from '../../issue-types/store';
// set on issues (ON DELETE CASCADE on the field_id foreign keys).
export type CustomFieldType =
- 'text' | 'markdown' | 'url' | 'number' | 'boolean' | 'date' | 'select' | 'multi_select';
+ | 'text'
+ | 'markdown'
+ | 'url'
+ | 'number'
+ | 'boolean'
+ | 'date'
+ | 'datetime'
+ | 'datetime_range'
+ | 'select'
+ | 'multi_select';
export interface CustomFieldOptionRow {
id: number;
diff --git a/apps/web/messages/en/issue.json b/apps/web/messages/en/issue.json
index 261710c1..d66faf9a 100644
--- a/apps/web/messages/en/issue.json
+++ b/apps/web/messages/en/issue.json
@@ -198,7 +198,10 @@
"customFields": {
"noOptions": "No options.",
"yes": "Yes",
- "no": "No"
+ "no": "No",
+ "time": "Time",
+ "startTime": "Start time",
+ "endTime": "End time"
},
"editor": {
"linkUrl": "Link URL",
diff --git a/apps/web/messages/en/settings.json b/apps/web/messages/en/settings.json
index 1d302aba..d3bbfb56 100644
--- a/apps/web/messages/en/settings.json
+++ b/apps/web/messages/en/settings.json
@@ -447,6 +447,8 @@
"number": "number",
"boolean": "checkbox",
"date": "date",
+ "datetime": "date & time",
+ "datetime_range": "date & time range",
"select": "select",
"multi_select": "multi-select"
},
diff --git a/apps/web/messages/en/workItems.json b/apps/web/messages/en/workItems.json
index ec84201f..4d5de60d 100644
--- a/apps/web/messages/en/workItems.json
+++ b/apps/web/messages/en/workItems.json
@@ -47,11 +47,13 @@
},
"noDate": {
"dueDate": "No due date",
- "startDate": "No start date"
+ "startDate": "No start date",
+ "custom": "No date"
},
"allDated": {
"dueDate": "Everything has a due date.",
- "startDate": "Everything has a start date."
+ "startDate": "Everything has a start date.",
+ "custom": "Everything has a date."
}
},
"timeline": {
diff --git a/apps/web/messages/ru/issue.json b/apps/web/messages/ru/issue.json
index 981ac339..564ae094 100644
--- a/apps/web/messages/ru/issue.json
+++ b/apps/web/messages/ru/issue.json
@@ -198,7 +198,10 @@
"customFields": {
"noOptions": "Вариантов нет.",
"yes": "Да",
- "no": "Нет"
+ "no": "Нет",
+ "time": "Время",
+ "startTime": "Начало",
+ "endTime": "Окончание"
},
"editor": {
"linkUrl": "URL ссылки",
diff --git a/apps/web/messages/ru/settings.json b/apps/web/messages/ru/settings.json
index d96532ec..c3f7f513 100644
--- a/apps/web/messages/ru/settings.json
+++ b/apps/web/messages/ru/settings.json
@@ -447,6 +447,8 @@
"number": "число",
"boolean": "флажок",
"date": "дата",
+ "datetime": "дата и время",
+ "datetime_range": "дата и диапазон времени",
"select": "выбор",
"multi_select": "мультивыбор"
},
diff --git a/apps/web/messages/ru/workItems.json b/apps/web/messages/ru/workItems.json
index 63c19b0d..549f13e4 100644
--- a/apps/web/messages/ru/workItems.json
+++ b/apps/web/messages/ru/workItems.json
@@ -47,11 +47,13 @@
},
"noDate": {
"dueDate": "Без дедлайна",
- "startDate": "Без даты начала"
+ "startDate": "Без даты начала",
+ "custom": "Без даты"
},
"allDated": {
"dueDate": "У всего есть дедлайн.",
- "startDate": "У всего есть дата начала."
+ "startDate": "У всего есть дата начала.",
+ "custom": "У всего есть дата."
}
},
"timeline": {
diff --git a/apps/web/messages/uk/issue.json b/apps/web/messages/uk/issue.json
index 6f318c44..a522a4a5 100644
--- a/apps/web/messages/uk/issue.json
+++ b/apps/web/messages/uk/issue.json
@@ -198,7 +198,10 @@
"customFields": {
"noOptions": "Варіантів немає.",
"yes": "Так",
- "no": "Ні"
+ "no": "Ні",
+ "time": "Час",
+ "startTime": "Початок",
+ "endTime": "Завершення"
},
"editor": {
"linkUrl": "URL посилання",
diff --git a/apps/web/messages/uk/settings.json b/apps/web/messages/uk/settings.json
index 5a9dafce..c653b9ab 100644
--- a/apps/web/messages/uk/settings.json
+++ b/apps/web/messages/uk/settings.json
@@ -447,6 +447,8 @@
"number": "число",
"boolean": "прапорець",
"date": "дата",
+ "datetime": "дата й час",
+ "datetime_range": "дата й діапазон часу",
"select": "вибір",
"multi_select": "мультивибір"
},
diff --git a/apps/web/messages/uk/workItems.json b/apps/web/messages/uk/workItems.json
index e6dd2458..77528315 100644
--- a/apps/web/messages/uk/workItems.json
+++ b/apps/web/messages/uk/workItems.json
@@ -47,11 +47,13 @@
},
"noDate": {
"dueDate": "Без дедлайну",
- "startDate": "Без дати початку"
+ "startDate": "Без дати початку",
+ "custom": "Без дати"
},
"allDated": {
"dueDate": "Усе має дедлайн.",
- "startDate": "Усе має дату початку."
+ "startDate": "Усе має дату початку.",
+ "custom": "Усе має дату."
}
},
"timeline": {
diff --git a/apps/web/messages/zh-CN/issue.json b/apps/web/messages/zh-CN/issue.json
index 624c6b8f..8974d865 100644
--- a/apps/web/messages/zh-CN/issue.json
+++ b/apps/web/messages/zh-CN/issue.json
@@ -198,7 +198,10 @@
"customFields": {
"noOptions": "暂无选项。",
"yes": "是",
- "no": "否"
+ "no": "否",
+ "time": "时间",
+ "startTime": "开始时间",
+ "endTime": "结束时间"
},
"editor": {
"linkUrl": "链接 URL",
diff --git a/apps/web/messages/zh-CN/settings.json b/apps/web/messages/zh-CN/settings.json
index 57fe067f..b2db3d34 100644
--- a/apps/web/messages/zh-CN/settings.json
+++ b/apps/web/messages/zh-CN/settings.json
@@ -447,6 +447,8 @@
"number": "数字",
"boolean": "复选框",
"date": "日期",
+ "datetime": "日期和时间",
+ "datetime_range": "日期和时间范围",
"select": "单选",
"multi_select": "多选"
},
diff --git a/apps/web/messages/zh-CN/workItems.json b/apps/web/messages/zh-CN/workItems.json
index c51adff8..ba70f60e 100644
--- a/apps/web/messages/zh-CN/workItems.json
+++ b/apps/web/messages/zh-CN/workItems.json
@@ -47,11 +47,13 @@
},
"noDate": {
"dueDate": "无截止日期",
- "startDate": "无开始日期"
+ "startDate": "无开始日期",
+ "custom": "无日期"
},
"allDated": {
"dueDate": "所有工作项都已设置截止日期。",
- "startDate": "所有工作项都已设置开始日期。"
+ "startDate": "所有工作项都已设置开始日期。",
+ "custom": "所有工作项都已设置日期。"
}
},
"timeline": {
diff --git a/apps/web/src/components/common/fields/DateTimePill.tsx b/apps/web/src/components/common/fields/DateTimePill.tsx
new file mode 100644
index 00000000..8bc58ec6
--- /dev/null
+++ b/apps/web/src/components/common/fields/DateTimePill.tsx
@@ -0,0 +1,131 @@
+import { useId, useState } from 'react';
+import { CalendarClock } from 'lucide-react';
+import {
+ formatDateTimeRange,
+ fromZonedParts,
+ parseDate,
+ toDateStr,
+ toZonedParts,
+} from '@/utils/dates';
+import { Button } from '@/components/ui/button';
+import { Calendar } from '@/components/ui/calendar';
+import { Field, FieldGroup, FieldLabel } from '@/components/ui/field';
+import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
+import { Pill } from './Pill';
+import ReadOnlyPill from './ReadOnlyPill';
+import TimeInput from './TimeInput';
+import { useTranslations } from 'next-intl';
+
+// The times a first pick lands on while the field is still empty.
+const DEFAULT_START = '09:00';
+const DEFAULT_END = '10:00';
+// The last minute a range can end on: the pill edits a range inside one day.
+const LAST_MINUTE = 23 * 60 + 59;
+
+function toMinutes(time: string): number {
+ return Number(time.slice(0, 2)) * 60 + Number(time.slice(3, 5));
+}
+
+function toTime(minutes: number): string {
+ const m = Math.max(0, Math.min(minutes, LAST_MINUTE));
+ return `${String(Math.floor(m / 60)).padStart(2, '0')}:${String(m % 60).padStart(2, '0')}`;
+}
+
+// A moment (or a range within one day) as a pill opening a calendar with the
+// time under it. Values are ISO datetimes or null; onChange(null, null) clears
+// them. The day and both times are read and written in the user's display zone,
+// so the picker shows the same wall clock the value renders as.
+export default function DateTimePill({
+ value,
+ valueEnd,
+ range,
+ placeholder,
+ onChange,
+ readOnly,
+}: {
+ value: string | null;
+ valueEnd: string | null;
+ // True for a datetime_range field: the popover also asks for an end time.
+ range: boolean;
+ placeholder?: string;
+ onChange: (value: string | null, valueEnd: string | null) => void;
+ readOnly?: boolean;
+}) {
+ const t = useTranslations('common');
+ const tField = useTranslations('issue.customFields');
+ const [open, setOpen] = useState(false);
+ const id = useId();
+ const start = value ? toZonedParts(value) : null;
+ const end = valueEnd ? toZonedParts(valueEnd) : null;
+ // The times the popover shows, defaulted while the field is still unset. A
+ // range always carries an end, so picking a day fills both.
+ const startTime = start?.time ?? DEFAULT_START;
+ const endTime = end?.time ?? DEFAULT_END;
+
+ const pill = (
+ <Pill active={!!value}>
+ <CalendarClock />
+ {value ? formatDateTimeRange(value, range ? valueEnd : null) : placeholder}
+ </Pill>
+ );
+ if (readOnly) return <ReadOnlyPill>{pill}</ReadOnlyPill>;
+
+ // Writes the value back from the parts the popover edits. An end that is not
+ // after the start is dropped, which is what the API accepts. The times are
+ // editable before a day is picked, so a time alone lands on today.
+ function emit(day: string | undefined, startTime: string, endTime: string) {
+ const on = day ?? start?.day ?? toDateStr(new Date());
+ const nextEnd = range && endTime > startTime ? fromZonedParts(on, endTime) : null;
+ onChange(fromZonedParts(on, startTime), nextEnd);
+ }
+
+ // Moving the start carries the end with it, so the range keeps its length
+ // instead of losing an end that would land before the new start.
+ function changeStart(time: string) {
+ emit(undefined, time, toTime(toMinutes(endTime) + toMinutes(time) - toMinutes(startTime)));
+ }
+
+ return (
+ <Popover open={open} onOpenChange={setOpen}>
+ <PopoverTrigger asChild>{pill}</PopoverTrigger>
+ <PopoverContent className="w-auto p-0" align="start">
+ <Calendar
+ mode="single"
+ selected={parseDate(start?.day ?? null) ?? undefined}
+ onSelect={(d) => d && emit(toDateStr(d), startTime, endTime)}
+ autoFocus
+ />
+ <FieldGroup className="gap-3 border-t p-3">
+ <Field>
+ <FieldLabel htmlFor={`${id}-start`}>
+ {range ? tField('startTime') : tField('time')}
+ </FieldLabel>
+ <TimeInput id={`${id}-start`} value={startTime} onChange={changeStart} />
+ </Field>
+ {range && (
+ <Field>
+ <FieldLabel htmlFor={`${id}-end`}>{tField('endTime')}</FieldLabel>
+ <TimeInput
+ id={`${id}-end`}
+ value={endTime}
+ onChange={(time) => emit(undefined, startTime, time)}
+ />
+ </Field>
+ )}
+ </FieldGroup>
+ {value && (
+ <div className="border-t p-2">
+ <Button
+ variant="ghost"
+ size="sm"
+ className="w-full"
+ onClick={() => onChange(null, null)}
+ >
+ {t('clear')}
+ </Button>
+ </div>
+ )}
+ </PopoverContent>
+ </Popover>
+ );
+}
diff --git a/apps/web/src/components/common/fields/TimeInput.tsx b/apps/web/src/components/common/fields/TimeInput.tsx
new file mode 100644
index 00000000..b28430be
--- /dev/null
+++ b/apps/web/src/components/common/fields/TimeInput.tsx
@@ -0,0 +1,29 @@
+import { Clock2Icon } from 'lucide-react';
+import { InputGroup, InputGroupAddon, InputGroupInput } from '@/components/ui/input-group';
+
+// An "HH:mm" time input with a clock addon. The browser's own picker indicator is
+// hidden: the addon stands in for it and the field is typed into.
+export default function TimeInput({
+ id,
+ value,
+ onChange,
+}: {
+ id: string;
+ value: string;
+ onChange: (value: string) => void;
+}) {
+ return (
+ <InputGroup>
+ <InputGroupInput
+ id={id}
+ type="time"
+ value={value}
+ className="appearance-none [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none"
+ onChange={(e) => e.target.value && onChange(e.target.value)}
+ />
+ <InputGroupAddon align="inline-end">
+ <Clock2Icon className="text-muted-foreground" />
+ </InputGroupAddon>
+ </InputGroup>
+ );
+}
diff --git a/apps/web/src/components/layout/DisplayCalendarRows.tsx b/apps/web/src/components/layout/DisplayCalendarRows.tsx
index 3850c4e8..3b1d4249 100644
--- a/apps/web/src/components/layout/DisplayCalendarRows.tsx
+++ b/apps/web/src/components/layout/DisplayCalendarRows.tsx
@@ -1,30 +1,46 @@
import { useTranslations } from 'next-intl';
-import type { DateField, ViewSettings, WeekStart } from '@/utils/viewSettings';
+import type { CustomField } from '@/lib/api';
+import {
+ customFieldKey,
+ type BuiltinDateField,
+ type DateField,
+ type ViewSettings,
+ type WeekStart,
+} from '@/utils/viewSettings';
+import { isCalendarField } from '@/utils/calendarFields';
import { byKey } from '@/utils/messageKey';
import DisplaySettingsRow from '@/components/layout/DisplaySettingsRow';
import DisplaySettingsSelect from '@/components/layout/DisplaySettingsSelect';
-const DATE_FIELDS: DateField[] = ['dueDate', 'startDate'];
+const DATE_FIELDS: BuiltinDateField[] = ['dueDate', 'startDate'];
const WEEK_STARTS = ['0', '1'] as const;
// The Display settings rows that only apply to the Calendar layout.
export default function DisplayCalendarRows({
settings,
+ customFields,
onChange,
}: {
settings: ViewSettings;
+ customFields: CustomField[];
onChange: (patch: Partial<ViewSettings>) => void;
}) {
const t = useTranslations('display.rows');
const dateField = byKey(useTranslations('display.dateFields'));
const weekStart = byKey(useTranslations('display.weekStart'));
+ const options = [
+ ...DATE_FIELDS.map((value) => ({ value, label: dateField(value) })),
+ ...customFields
+ .filter(isCalendarField)
+ .map((f) => ({ value: customFieldKey(f.id), label: f.name })),
+ ];
return (
<>
<DisplaySettingsRow label={t('placeBy')}>
<DisplaySettingsSelect
value={settings.calendarDateField}
onChange={(v) => onChange({ calendarDateField: v as DateField })}
- options={DATE_FIELDS.map((value) => ({ value, label: dateField(value) }))}
+ options={options}
/>
</DisplaySettingsRow>
<DisplaySettingsRow label={t('startWeekOn')}>
diff --git a/apps/web/src/components/layout/DisplaySettingsBody.tsx b/apps/web/src/components/layout/DisplaySettingsBody.tsx
index 97fa0d03..149236d8 100644
--- a/apps/web/src/components/layout/DisplaySettingsBody.tsx
+++ b/apps/web/src/components/layout/DisplaySettingsBody.tsx
@@ -36,7 +36,9 @@ export default function DisplaySettingsBody({
{view === 'timeline' && <DisplayTimelineRows settings={settings} onChange={set} />}
- {view === 'calendar' && <DisplayCalendarRows settings={settings} onChange={set} />}
+ {view === 'calendar' && (
+ <DisplayCalendarRows settings={settings} customFields={customFields} onChange={set} />
+ )}
{(view === 'kanban' || view === 'table') && (
<DisplayPropertiesSection
diff --git a/apps/web/src/features/issue/components/detail/IssueProperties.tsx b/apps/web/src/features/issue/components/detail/IssueProperties.tsx
index 17dc3488..fcc30c11 100644
--- a/apps/web/src/features/issue/components/detail/IssueProperties.tsx
+++ b/apps/web/src/features/issue/components/detail/IssueProperties.tsx
@@ -260,7 +260,7 @@ export default function IssueProperties({
className={cn('h-7', open && 'mb-3')}
/>
{open && (
- <div className="grid grid-cols-[104px_1fr] items-start gap-x-2 gap-y-2.5">{rows}</div>
+ <div className="grid grid-cols-[180px_1fr] items-start gap-x-2 gap-y-2.5">{rows}</div>
)}
</div>
);
diff --git a/apps/web/src/features/issue/components/fields/InlineTextField.tsx b/apps/web/src/features/issue/components/fields/InlineTextField.tsx
index 0ca5d80e..db1a43e4 100644
--- a/apps/web/src/features/issue/components/fields/InlineTextField.tsx
+++ b/apps/web/src/features/issue/components/fields/InlineTextField.tsx
@@ -5,7 +5,7 @@ import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { useTranslations } from 'next-intl';
-// Text/number/date custom field: shows the value as a ghost pill and switches to
+// Text/number custom field: shows the value as a ghost pill and switches to
// an input on click, so an unset field reads as a compact "Empty" rather than a
// full-width empty box.
export default function InlineTextField({
@@ -15,7 +15,7 @@ export default function InlineTextField({
onSave,
}: {
value: string | number | null;
- fieldType: 'text' | 'number' | 'date';
+ fieldType: 'text' | 'number';
saveKey: string;
onSave: (v: string | number | null) => void;
}) {
diff --git a/apps/web/src/features/issue/components/fields/IssueCustomFieldControl.tsx b/apps/web/src/features/issue/components/fields/IssueCustomFieldControl.tsx
index 86a34c89..42f6ed0a 100644
--- a/apps/web/src/features/issue/components/fields/IssueCustomFieldControl.tsx
+++ b/apps/web/src/features/issue/components/fields/IssueCustomFieldControl.tsx
@@ -1,6 +1,9 @@
import { type CustomField, type IssueFieldValue, type IssueFieldValueInput } from '@/lib/api';
+import { formatDate, formatDateTimeRange } from '@/utils/dates';
import { Button } from '@/components/ui/button';
import { Checkbox } from '@/components/ui/checkbox';
+import DatePill from '@/components/common/fields/DatePill';
+import DateTimePill from '@/components/common/fields/DateTimePill';
import {
Select,
SelectContent,
@@ -34,6 +37,7 @@ export default function IssueCustomFieldControl({
readOnly?: boolean;
}) {
const t = useTranslations('issue.customFields');
+ const tFields = useTranslations('issue.fields');
// Read-only: show the current value statically, no editor.
if (readOnly) {
if (def.fieldType === 'select' || def.fieldType === 'multi_select') {
@@ -59,11 +63,14 @@ export default function IssueCustomFieldControl({
return <span className="text-sm">{current?.value ? t('yes') : t('no')}</span>;
}
const v = current?.value;
- return (
- <span className="text-sm">
- {v == null || v === '' ? <span className="text-muted-foreground">—</span> : String(v)}
- </span>
- );
+ if (v == null || v === '') return <span className="text-sm text-muted-foreground">—</span>;
+ if (def.fieldType === 'date') return <span className="text-sm">{formatDate(String(v))}</span>;
+ if (def.fieldType === 'datetime' || def.fieldType === 'datetime_range') {
+ return (
+ <span className="text-sm">{formatDateTimeRange(String(v), current?.valueEnd ?? null)}</span>
+ );
+ }
+ return <span className="text-sm">{String(v)}</span>;
}
if (def.fieldType === 'url') {
@@ -76,7 +83,29 @@ export default function IssueCustomFieldControl({
);
}
- if (def.fieldType === 'text' || def.fieldType === 'number' || def.fieldType === 'date') {
+ if (def.fieldType === 'date') {
+ return (
+ <DatePill
+ value={(current?.value as string | null) ?? null}
+ placeholder={tFields('empty')}
+ onChange={(v) => onChange({ value: v })}
+ />
+ );
+ }
+
+ if (def.fieldType === 'datetime' || def.fieldType === 'datetime_range') {
+ return (
+ <DateTimePill
+ value={(current?.value as string | null) ?? null}
+ valueEnd={current?.valueEnd ?? null}
+ range={def.fieldType === 'datetime_range'}
+ placeholder={tFields('empty')}
+ onChange={(value, valueEnd) => onChange({ value, valueEnd })}
+ />
+ );
+ }
+
+ if (def.fieldType === 'text' || def.fieldType === 'number') {
return (
<InlineTextField
value={(current?.value as string | number | null) ?? null}
diff --git a/apps/web/src/features/issue/components/fields/IssueCustomFieldPill.tsx b/apps/web/src/features/issue/components/fields/IssueCustomFieldPill.tsx
index 942afc06..1537f777 100644
--- a/apps/web/src/features/issue/components/fields/IssueCustomFieldPill.tsx
+++ b/apps/web/src/features/issue/components/fields/IssueCustomFieldPill.tsx
@@ -12,6 +12,8 @@ import {
import { Input } from '@/components/ui/input';
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
import { colorDot } from '@/components/common/fields/colorDot';
+import DatePill from '@/components/common/fields/DatePill';
+import DateTimePill from '@/components/common/fields/DateTimePill';
import { Pill } from '@/components/common/fields/Pill';
import { useTranslations } from 'next-intl';
@@ -107,7 +109,29 @@ export default function IssueCustomFieldPill({
);
}
- // text / number / date
+ if (def.fieldType === 'date') {
+ return (
+ <DatePill
+ value={(value?.value as string | null) ?? null}
+ placeholder={def.name}
+ onChange={(v) => onChange({ value: v })}
+ />
+ );
+ }
+
+ if (def.fieldType === 'datetime' || def.fieldType === 'datetime_range') {
+ return (
+ <DateTimePill
+ value={(value?.value as string | null) ?? null}
+ valueEnd={value?.valueEnd ?? null}
+ range={def.fieldType === 'datetime_range'}
+ placeholder={def.name}
+ onChange={(v, valueEnd) => onChange({ value: v, valueEnd })}
+ />
+ );
+ }
+
+ // text / number / url
const raw = value?.value;
const hasValue = raw != null && raw !== '';
return (
diff --git a/apps/web/src/features/settings/components/custom-fields/SettingsCustomFieldForm.tsx b/apps/web/src/features/settings/components/custom-fields/SettingsCustomFieldForm.tsx
index c6b147a8..c50815d0 100644
--- a/apps/web/src/features/settings/components/custom-fields/SettingsCustomFieldForm.tsx
+++ b/apps/web/src/features/settings/components/custom-fields/SettingsCustomFieldForm.tsx
@@ -23,6 +23,8 @@ const FIELD_TYPES: CustomFieldType[] = [
'number',
'boolean',
'date',
+ 'datetime',
+ 'datetime_range',
'select',
'multi_select',
];
diff --git a/apps/web/src/features/settings/utils/customFieldsTransfer.ts b/apps/web/src/features/settings/utils/customFieldsTransfer.ts
index 6473bf0b..c3ea5167 100644
--- a/apps/web/src/features/settings/utils/customFieldsTransfer.ts
+++ b/apps/web/src/features/settings/utils/customFieldsTransfer.ts
@@ -42,6 +42,8 @@ const FIELD_TYPES: CustomFieldType[] = [
'number',
'boolean',
'date',
+ 'datetime',
+ 'datetime_range',
'select',
'multi_select',
];
diff --git a/apps/web/src/features/work-items/components/calendar/CalendarUnscheduledPanel.tsx b/apps/web/src/features/work-items/components/calendar/CalendarUnscheduledPanel.tsx
index 883b2696..02610f56 100644
--- a/apps/web/src/features/work-items/components/calendar/CalendarUnscheduledPanel.tsx
+++ b/apps/web/src/features/work-items/components/calendar/CalendarUnscheduledPanel.tsx
@@ -2,7 +2,7 @@ import { useDroppable } from '@dnd-kit/core';
import { useTranslations } from 'next-intl';
import { type ProjectDetail, type Issue } from '@/lib/api';
import { cn } from '@/lib/utils';
-import { type DateField } from '@/utils/viewSettings';
+import { isCustomFieldKey, type DateField } from '@/utils/viewSettings';
import { CalendarUnscheduledCard } from './CalendarUnscheduledCard';
// Droppable id for the unscheduled panel; day cells use `day:<YYYY-MM-DD>`.
@@ -24,6 +24,8 @@ export function CalendarUnscheduledPanel({
}) {
const t = useTranslations('workItems.calendar');
const { setNodeRef, isOver } = useDroppable({ id: UNSCHEDULED_ID });
+ // A custom field placement has no wording of its own; it reads as a plain date.
+ const key = isCustomFieldKey(dateField) ? 'custom' : dateField;
return (
<div
ref={setNodeRef}
@@ -33,7 +35,7 @@ export function CalendarUnscheduledPanel({
)}
>
<div className="mb-2 flex items-center gap-2 text-sm font-medium text-muted-foreground">
- {t(`noDate.${dateField}`)}
+ {t(`noDate.${key}`)}
<span className="text-muted-foreground">{issues.length}</span>
</div>
<div className="flex flex-col gap-1 overflow-y-auto">
@@ -47,7 +49,7 @@ export function CalendarUnscheduledPanel({
/>
))}
{issues.length === 0 && (
- <span className="text-xs text-muted-foreground/50">{t(`allDated.${dateField}`)}</span>
+ <span className="text-xs text-muted-foreground/50">{t(`allDated.${key}`)}</span>
)}
</div>
</div>
diff --git a/apps/web/src/features/work-items/components/calendar/CalendarView.tsx b/apps/web/src/features/work-items/components/calendar/CalendarView.tsx
index fa44c18f..a2d44052 100644
--- a/apps/web/src/features/work-items/components/calendar/CalendarView.tsx
+++ b/apps/web/src/features/work-items/components/calendar/CalendarView.tsx
@@ -12,7 +12,12 @@ import { type Issue } from '@/lib/api';
import { buildMaps, issueColor, type WorkItemsViewProps } from '@/utils/project';
import { toDateStr } from '@/utils/dates';
import { useDndSensors } from '@/lib/dnd';
-import { useUpdateIssue } from '@/services/issues.service';
+import { useSetFieldValue, useUpdateIssue } from '@/services/issues.service';
+import {
+ calendarBuiltinField,
+ calendarCustomField,
+ rescheduleFieldValue,
+} from '@/utils/calendarFields';
import { buildCalendarModel } from '../../utils/calendar';
import { CalendarMonthNav } from './CalendarMonthNav';
import { CalendarDayCell } from './CalendarDayCell';
@@ -29,25 +34,41 @@ export default function CalendarView({
}: WorkItemsViewProps) {
const t = useTranslations('workItems.calendar');
const updateIssue = useUpdateIssue(project.project.key);
+ const setFieldValue = useSetFieldValue(project.project.key);
const [cursor, setCursor] = useState<Date>(() => startOfMonth(new Date()));
const [activeId, setActiveId] = useState<number | null>(null);
const sensors = useDndSensors(readOnly);
- const dateField = settings.calendarDateField;
+ const builtinField = calendarBuiltinField(settings.calendarDateField);
+ const customFieldDef = calendarCustomField(settings.calendarDateField, project.customFields);
const today = new Date();
const maps = buildMaps(project);
const dot = (issue: Issue) => issueColor(issue, maps);
const { byDay, unscheduled, weekdays, days } = buildCalendarModel(
project.issues,
- dateField,
+ builtinField,
+ customFieldDef,
settings.weekStart,
cursor,
WEEKDAY_KEYS.map((key) => t(`weekdays.${key}`)),
);
- function reschedule(issueId: number, value: string | null) {
- updateIssue.mutate({ id: issueId, patch: { [dateField]: value } });
+ // A drop moves the field the calendar is placed by: the built-in column, or the
+ // custom field's value (which keeps its time of day and, for a range, its
+ // length).
+ function reschedule(issueId: number, day: string | null) {
+ if (!customFieldDef) {
+ updateIssue.mutate({ id: issueId, patch: { [builtinField]: day } });
+ return;
+ }
+ const issue = project.issues.find((i) => i.id === issueId);
+ if (!issue) return;
+ setFieldValue.mutate({
+ issueId,
+ fieldId: customFieldDef.id,
+ value: rescheduleFieldValue(issue, customFieldDef, day),
+ });
}
function handleDragEnd(e: DragEndEvent) {
@@ -105,7 +126,7 @@ export default function CalendarView({
<CalendarUnscheduledPanel
project={project}
- dateField={dateField}
+ dateField={settings.calendarDateField}
issues={unscheduled}
dot={dot}
onOpen={onOpenIssue}
diff --git a/apps/web/src/features/work-items/components/table/TableCustomCell.tsx b/apps/web/src/features/work-items/components/table/TableCustomCell.tsx
index 84c63ae7..fef178c5 100644
--- a/apps/web/src/features/work-items/components/table/TableCustomCell.tsx
+++ b/apps/web/src/features/work-items/components/table/TableCustomCell.tsx
@@ -1,6 +1,6 @@
import { Check, ExternalLink } from 'lucide-react';
import { type CustomField, type Issue } from '@/lib/api';
-import { formatShortDate } from '@/utils/dates';
+import { formatDateTimeRange, formatShortDate } from '@/utils/dates';
import { colorDot } from '@/components/common/fields/colorDot';
import { MarkdownCell } from './MarkdownCell';
@@ -46,6 +46,13 @@ export function TableCustomCell({ field, issue }: { field: CustomField; issue: I
if (raw == null || raw === '') return <div>{DASH}</div>;
if (field.fieldType === 'date')
return <div className="text-xs text-muted-foreground">{formatShortDate(String(raw))}</div>;
+ if (field.fieldType === 'datetime' || field.fieldType === 'datetime_range') {
+ return (
+ <div className="truncate text-xs text-muted-foreground">
+ {formatDateTimeRange(String(raw), entry?.valueEnd ?? null)}
+ </div>
+ );
+ }
// Url fields render as a link that opens in a new tab; stopPropagation so the
// click follows the link instead of opening the issue row behind it.
if (field.fieldType === 'url') {
diff --git a/apps/web/src/features/work-items/utils/calendar.ts b/apps/web/src/features/work-items/utils/calendar.ts
index 78d84205..ec3a823a 100644
--- a/apps/web/src/features/work-items/utils/calendar.ts
+++ b/apps/web/src/features/work-items/utils/calendar.ts
@@ -1,11 +1,12 @@
import { addDays, startOfMonth, startOfWeek } from 'date-fns';
-import { type Issue } from '@/lib/api';
-import type { ViewSettings } from '@/utils/viewSettings';
+import { type CustomField, type Issue } from '@/lib/api';
+import { issueDay } from '@/utils/calendarFields';
+import type { BuiltinDateField, ViewSettings } from '@/utils/viewSettings';
// The calendar layout for the visible month: issues bucketed by their chosen date
-// (due or start), the rest collected as unscheduled, the weekday headers rotated
-// to the chosen first day, and the six-week day grid (a constant height regardless
-// of month length).
+// (a built-in column or a date custom field), the rest collected as unscheduled,
+// the weekday headers rotated to the chosen first day, and the six-week day grid
+// (a constant height regardless of month length).
export interface CalendarModel {
byDay: Map<string, Issue[]>;
unscheduled: Issue[];
@@ -15,7 +16,9 @@ export interface CalendarModel {
export function buildCalendarModel(
issues: Issue[],
- dateField: ViewSettings['calendarDateField'],
+ builtin: BuiltinDateField,
+ // The custom field the issues are placed by, or null for the built-in column.
+ custom: CustomField | null,
weekStart: ViewSettings['weekStart'],
cursor: Date,
// The seven weekday names, Sunday first, in the reader's language.
@@ -24,11 +27,11 @@ export function buildCalendarModel(
const byDay = new Map<string, Issue[]>();
const unscheduled: Issue[] = [];
for (const issue of issues) {
- const value = issue[dateField];
- if (value) {
- const list = byDay.get(value) ?? [];
+ const day = issueDay(issue, builtin, custom);
+ if (day) {
+ const list = byDay.get(day) ?? [];
list.push(issue);
- byDay.set(value, list);
+ byDay.set(day, list);
} else {
unscheduled.push(issue);
}
diff --git a/apps/web/src/hooks/useFilterFields.ts b/apps/web/src/hooks/useFilterFields.ts
index a5bf116f..b4e7fab7 100644
--- a/apps/web/src/hooks/useFilterFields.ts
+++ b/apps/web/src/hooks/useFilterFields.ts
@@ -27,6 +27,8 @@ function customFieldKind(field: CustomField): FieldKind {
case 'boolean':
return 'boolean';
case 'date':
+ case 'datetime':
+ case 'datetime_range':
return 'date';
default:
return 'text'; // text, markdown
diff --git a/apps/web/src/lib/api.ts b/apps/web/src/lib/api.ts
index ea1a78e7..2416ce1c 100644
--- a/apps/web/src/lib/api.ts
+++ b/apps/web/src/lib/api.ts
@@ -487,7 +487,16 @@ export async function* streamAiAgentRun(
}
export type CustomFieldType =
- 'text' | 'markdown' | 'url' | 'number' | 'boolean' | 'date' | 'select' | 'multi_select';
+ | 'text'
+ | 'markdown'
+ | 'url'
+ | 'number'
+ | 'boolean'
+ | 'date'
+ | 'datetime'
+ | 'datetime_range'
+ | 'select'
+ | 'multi_select';
export interface CustomFieldOption {
id: number;
@@ -509,11 +518,13 @@ export interface CustomField {
}
// One custom field value on a project issue: the scalar value (null for
-// select/multi_select and unset fields) and the selected option ids. Only
-// fields with a value set appear; unset fields are omitted (see listIssues).
+// select/multi_select and unset fields), the end of a datetime_range, and the
+// selected option ids. Only fields with a value set appear; unset fields are
+// omitted (see listIssues).
export interface IssueFieldValueEntry {
fieldId: number;
value: string | number | boolean | null;
+ valueEnd: string | null;
optionIds: number[];
}
@@ -1440,14 +1451,16 @@ export interface IssueFieldValue {
name: string;
fieldType: CustomFieldType;
value: string | number | boolean | null;
+ valueEnd: string | null;
optionIds: number[];
}
// A custom field value on the way in (setFieldValue). `value` carries the
-// scalar types, `optionIds` the select/multi_select ones; a field uses one or
-// the other.
+// scalar types, `valueEnd` the end of a datetime_range, `optionIds` the
+// select/multi_select ones; a field uses one or the other.
export interface IssueFieldValueInput {
value?: string | number | boolean | null;
+ valueEnd?: string | null;
optionIds?: number[];
}
diff --git a/apps/web/src/services/issues.service.ts b/apps/web/src/services/issues.service.ts
index 34c8b47a..e05dd013 100644
--- a/apps/web/src/services/issues.service.ts
+++ b/apps/web/src/services/issues.service.ts
@@ -2,6 +2,7 @@ import { keepPreviousData, useMutation, useQuery, useQueryClient } from '@tansta
import {
api,
type BulkIssuePatch,
+ type IssueFieldValueEntry,
type IssueFieldValueInput,
type IssuePatch,
type NewIssueInput,
@@ -179,9 +180,26 @@ export function useRestoreIssue(projectKey: string | null) {
});
}
-// Setting a custom field value. Invalidates the issue (the value lives on it),
-// its activity feed, and — since the project's issues carry field values for
-// filtering — the project detail.
+// The issue's field values with one field's entry replaced by what is being sent.
+function patchFieldValues(
+ entries: IssueFieldValueEntry[],
+ fieldId: number,
+ input: IssueFieldValueInput,
+): IssueFieldValueEntry[] {
+ const entry: IssueFieldValueEntry = {
+ fieldId,
+ value: input.value ?? null,
+ valueEnd: input.valueEnd ?? null,
+ optionIds: input.optionIds ?? [],
+ };
+ const rest = entries.filter((e) => e.fieldId !== fieldId);
+ return [...rest, entry];
+}
+
+// Setting a custom field value. The project detail is patched optimistically (a
+// Calendar placed by a date custom field moves the card on drop, before the
+// request resolves), then invalidated on settle together with the issue and its
+// activity feed.
export function useSetFieldValue(projectKey: string | null) {
const qc = useQueryClient();
return useMutation({
@@ -194,6 +212,26 @@ export function useSetFieldValue(projectKey: string | null) {
fieldId: number;
value: IssueFieldValueInput;
}) => api.setFieldValue(issueId, fieldId, value),
+ onMutate: async ({ issueId, fieldId, value }) => {
+ if (!projectKey) return {};
+ const key = qk.boardIssues(projectKey);
+ await qc.cancelQueries({ queryKey: key });
+ const prev = qc.getQueryData<BoardIssues>(key);
+ if (prev) {
+ qc.setQueryData<BoardIssues>(key, {
+ ...prev,
+ issues: prev.issues.map((i) =>
+ i.id === issueId
+ ? { ...i, fieldValues: patchFieldValues(i.fieldValues, fieldId, value) }
+ : i,
+ ),
+ });
+ }
+ return { prev, key };
+ },
+ onError: (_err, _vars, ctx) => {
+ if (ctx?.prev && ctx.key) qc.setQueryData(ctx.key, ctx.prev);
+ },
onSettled: (_data, _err, { issueId }) => {
void qc.invalidateQueries({ queryKey: qk.issue(issueId) });
void qc.invalidateQueries({ queryKey: qk.feed(issueId) });
diff --git a/apps/web/src/utils/calendarFields.ts b/apps/web/src/utils/calendarFields.ts
new file mode 100644
index 00000000..b553dca7
--- /dev/null
+++ b/apps/web/src/utils/calendarFields.ts
@@ -0,0 +1,75 @@
+import type { CustomField, Issue, IssueFieldValueInput } from '@/lib/api';
+import { dayKey, fromZonedParts, toZonedParts } from '@/utils/dates';
+import {
+ customFieldId,
+ isCustomFieldKey,
+ type BuiltinDateField,
+ type DateField,
+} from '@/utils/viewSettings';
+
+// The date fields the Calendar can place issues by: the two built-in columns and
+// any date / datetime / datetime range custom field.
+
+// The time of day a datetime field takes when the issue had no value yet.
+const DEFAULT_TIME = '09:00';
+
+export function isCalendarField(field: CustomField): boolean {
+ return (
+ field.fieldType === 'date' ||
+ field.fieldType === 'datetime' ||
+ field.fieldType === 'datetime_range'
+ );
+}
+
+// The custom field a `cf:<id>` placement points at, or null when the calendar is
+// placed by a built-in column (or by a field that has since been deleted).
+export function calendarCustomField(
+ dateField: DateField,
+ customFields: CustomField[],
+): CustomField | null {
+ if (!isCustomFieldKey(dateField)) return null;
+ const id = customFieldId(dateField);
+ return customFields.find((f) => f.id === id && isCalendarField(f)) ?? null;
+}
+
+// The built-in column a placement writes to. A custom field placement keeps the
+// due date here as the fallback for a deleted field.
+export function calendarBuiltinField(dateField: DateField): BuiltinDateField {
+ return dateField === 'startDate' ? 'startDate' : 'dueDate';
+}
+
+// The day an issue sits on, as "YYYY-MM-DD". A datetime is bucketed by the day it
+// falls on in the user's zone; a range by the day it starts on.
+export function issueDay(
+ issue: Issue,
+ builtin: BuiltinDateField,
+ custom: CustomField | null,
+): string | null {
+ if (!custom) return issue[builtin];
+ const entry = issue.fieldValues.find((v) => v.fieldId === custom.id);
+ const raw = typeof entry?.value === 'string' ? entry.value : null;
+ if (!raw) return null;
+ return custom.fieldType === 'date' ? raw : dayKey(raw);
+}
+
+// The value a drag onto `day` writes to a custom field, or the cleared value when
+// the issue is dropped on the unscheduled panel. A datetime keeps its time of day
+// and a range its length, so only the day moves.
+export function rescheduleFieldValue(
+ issue: Issue,
+ custom: CustomField,
+ day: string | null,
+): IssueFieldValueInput {
+ if (!day) return { value: null, valueEnd: null };
+ if (custom.fieldType === 'date') return { value: day, valueEnd: null };
+
+ const entry = issue.fieldValues.find((v) => v.fieldId === custom.id);
+ const current = typeof entry?.value === 'string' ? entry.value : null;
+ const time = (current ? toZonedParts(current)?.time : null) ?? DEFAULT_TIME;
+ const value = fromZonedParts(day, time);
+ if (custom.fieldType !== 'datetime_range' || !current || !entry?.valueEnd) {
+ return { value, valueEnd: null };
+ }
+ const length = new Date(entry.valueEnd).getTime() - new Date(current).getTime();
+ return { value, valueEnd: new Date(new Date(value).getTime() + length).toISOString() };
+}
diff --git a/apps/web/src/utils/dates.ts b/apps/web/src/utils/dates.ts
index 079f9708..dc385feb 100644
--- a/apps/web/src/utils/dates.ts
+++ b/apps/web/src/utils/dates.ts
@@ -99,6 +99,57 @@ export function formatDateTime(value: string): string {
});
}
+// The display zone's offset at a given moment, in ms (zone time minus UTC).
+function zoneOffsetMs(date: Date): number {
+ const parts = new Intl.DateTimeFormat('en-US', {
+ hourCycle: 'h23',
+ year: 'numeric',
+ month: '2-digit',
+ day: '2-digit',
+ hour: '2-digit',
+ minute: '2-digit',
+ second: '2-digit',
+ ...zoneOption(),
+ }).formatToParts(date);
+ const part = (type: string) => Number(parts.find((p) => p.type === type)?.value);
+ const asUtc = Date.UTC(
+ part('year'),
+ part('month') - 1,
+ part('day'),
+ part('hour'),
+ part('minute'),
+ part('second'),
+ );
+ return asUtc - date.getTime();
+}
+
+// The "YYYY-MM-DD" day and "HH:mm" time a moment falls on in the user's zone —
+// the parts a date-time picker edits. Null for an unparseable value.
+export function toZonedParts(value: string): { day: string; time: string } | null {
+ const date = new Date(value);
+ if (Number.isNaN(date.getTime())) return null;
+ const shifted = new Date(date.getTime() + zoneOffsetMs(date)).toISOString();
+ return { day: shifted.slice(0, 10), time: shifted.slice(11, 16) };
+}
+
+// The moment a day + time in the user's zone stands for, as an ISO string. The
+// offset is resolved against the result as well, so a time on a DST switch lands
+// on the offset in force at the moment itself.
+export function fromZonedParts(day: string, time: string): string {
+ const asUtc = new Date(`${day}T${time}:00Z`);
+ const first = new Date(asUtc.getTime() - zoneOffsetMs(asUtc));
+ return new Date(asUtc.getTime() - zoneOffsetMs(first)).toISOString();
+}
+
+// "Jul 2, 14:05 – 16:30" for a range, rendered in the user's zone; the day is
+// repeated on the end when it falls on another one. Without an end it is a
+// single moment.
+export function formatDateTimeRange(start: string, end: string | null): string {
+ if (!end) return formatDateTime(start);
+ if (dayKey(start) !== dayKey(end)) return `${formatDateTime(start)} – ${formatDateTime(end)}`;
+ return `${formatDateTime(start)} – ${toZonedParts(end)?.time ?? end}`;
+}
+
// "July 2, 2026" for a moment in time, rendered in the user's zone.
export function formatLongDate(value: string): string {
const date = new Date(value);
diff --git a/apps/web/src/utils/filters.ts b/apps/web/src/utils/filters.ts
index 1486e98d..39c7fa19 100644
--- a/apps/web/src/utils/filters.ts
+++ b/apps/web/src/utils/filters.ts
@@ -4,6 +4,7 @@
// issues are handed to the view. The server never inspects this shape.
import type { ProjectDetail, StateType, Issue } from '@/lib/api';
+import { dayKey } from '@/utils/dates';
// The built-in fields a condition can target. Custom fields are targeted with
// the string `cf:<fieldId>` (see customFieldKey / parseCustomFieldKey).
@@ -65,10 +66,12 @@ function isEffectiveCondition(cond: FilterCondition): boolean {
}
// Normalizes any date the store returns to a "YYYY-MM-DD" day for comparison:
-// due/start dates are already that; created/updated are ISO datetimes, so the
-// date part is sliced off. String comparison on this format orders correctly.
+// due/start dates are already that; a moment (created/updated, a datetime custom
+// field) is taken by the day it falls on in the user's zone, which is the day the
+// views render it as. String comparison on this format orders correctly.
function toDay(value: string | null): string | null {
- return value ? value.slice(0, 10) : null;
+ if (!value) return null;
+ return value.length <= 10 ? value : dayKey(value);
}
// The issue's value(s) for a built-in set-membership field, as an array so
diff --git a/apps/web/src/utils/viewSettings.ts b/apps/web/src/utils/viewSettings.ts
index 5fdbfe5c..9865238a 100644
--- a/apps/web/src/utils/viewSettings.ts
+++ b/apps/web/src/utils/viewSettings.ts
@@ -92,7 +92,10 @@ export function offeredDisplayProperties(features: ProjectFeatures): DisplayProp
export type TimelineScale = 'week' | 'month' | 'quarter';
// Which date drives Calendar placement (and the Timeline is start->due always).
-export type DateField = 'dueDate' | 'startDate';
+// A `cf:<id>` key places the issues by a date, datetime or datetime range custom
+// field; a stale key (a since-deleted field) falls back to the due date.
+export type BuiltinDateField = 'dueDate' | 'startDate';
+export type DateField = BuiltinDateField | CustomFieldKey;
// date-fns weekStartsOn: 0 Sunday, 1 Monday.
export type WeekStart = 0 | 1;
@@ -279,7 +282,9 @@ export function normalizeViewSettings(
timelineCollapseAll:
typeof s.timelineCollapseAll === 'boolean' ? s.timelineCollapseAll : d.timelineCollapseAll,
calendarDateField:
- s.calendarDateField === 'startDate' || s.calendarDateField === 'dueDate'
+ s.calendarDateField === 'startDate' ||
+ s.calendarDateField === 'dueDate' ||
+ (typeof s.calendarDateField === 'string' && isCustomFieldKey(s.calendarDateField))
? s.calendarDateField
: d.calendarDateField,
weekStart: s.weekStart === 0 || s.weekStart === 1 ? s.weekStart : d.weekStart,
diff --git a/packages/db/drizzle/0075_left_rafael_vega.sql b/packages/db/drizzle/0075_left_rafael_vega.sql
new file mode 100644
index 00000000..02a1fa93
--- /dev/null
+++ b/packages/db/drizzle/0075_left_rafael_vega.sql
@@ -0,0 +1,4 @@
+ALTER TABLE "custom_field" DROP CONSTRAINT "custom_field_field_type_check";--> statement-breakpoint
+ALTER TABLE "issue_field_value" ADD COLUMN "value_datetime" timestamp with time zone;--> statement-breakpoint
+ALTER TABLE "issue_field_value" ADD COLUMN "value_datetime_end" timestamp with time zone;--> statement-breakpoint
+ALTER TABLE "custom_field" ADD CONSTRAINT "custom_field_field_type_check" CHECK ("custom_field"."field_type" IN ('text', 'markdown', 'url', 'number', 'boolean', 'date', 'datetime', 'datetime_range', 'select', 'multi_select'));
\ No newline at end of file
diff --git a/packages/db/drizzle/meta/0075_snapshot.json b/packages/db/drizzle/meta/0075_snapshot.json
new file mode 100644
index 00000000..80a5ac08
--- /dev/null
+++ b/packages/db/drizzle/meta/0075_snapshot.json
@@ -0,0 +1,6107 @@
+{
+ "id": "9a1fe2c2-7cc9-4bd1-8410-e7ad66b7d0cf",
+ "prevId": "c65c4dd6-fb7f-41a8-8ea1-29c5db423562",
+ "version": "7",
+ "dialect": "postgresql",
+ "tables": {
+ "public.account": {
+ "name": "account",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "account_id": {
+ "name": "account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "access_token": {
+ "name": "access_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token": {
+ "name": "refresh_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "id_token": {
+ "name": "id_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "access_token_expires_at": {
+ "name": "access_token_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token_expires_at": {
+ "name": "refresh_token_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "password": {
+ "name": "password",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "account_userId_idx": {
+ "name": "account_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "account_user_id_user_id_fk": {
+ "name": "account_user_id_user_id_fk",
+ "tableFrom": "account",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.apikey": {
+ "name": "apikey",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "config_id": {
+ "name": "config_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'default'"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "start": {
+ "name": "start",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reference_id": {
+ "name": "reference_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "prefix": {
+ "name": "prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "refill_interval": {
+ "name": "refill_interval",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refill_amount": {
+ "name": "refill_amount",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_refill_at": {
+ "name": "last_refill_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "rate_limit_enabled": {
+ "name": "rate_limit_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "rate_limit_time_window": {
+ "name": "rate_limit_time_window",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 1000
+ },
+ "rate_limit_max": {
+ "name": "rate_limit_max",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 100
+ },
+ "request_count": {
+ "name": "request_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "remaining": {
+ "name": "remaining",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_request": {
+ "name": "last_request",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "permissions": {
+ "name": "permissions",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "apikey_configId_idx": {
+ "name": "apikey_configId_idx",
+ "columns": [
+ {
+ "expression": "config_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "apikey_referenceId_idx": {
+ "name": "apikey_referenceId_idx",
+ "columns": [
+ {
+ "expression": "reference_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "apikey_key_idx": {
+ "name": "apikey_key_idx",
+ "columns": [
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.passkey": {
+ "name": "passkey",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "public_key": {
+ "name": "public_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "credential_id": {
+ "name": "credential_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "counter": {
+ "name": "counter",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "device_type": {
+ "name": "device_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "backed_up": {
+ "name": "backed_up",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "transports": {
+ "name": "transports",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "aaguid": {
+ "name": "aaguid",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "passkey_userId_idx": {
+ "name": "passkey_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "passkey_credentialID_idx": {
+ "name": "passkey_credentialID_idx",
+ "columns": [
+ {
+ "expression": "credential_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "passkey_user_id_user_id_fk": {
+ "name": "passkey_user_id_user_id_fk",
+ "tableFrom": "passkey",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.session": {
+ "name": "session",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ip_address": {
+ "name": "ip_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_agent": {
+ "name": "user_agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "session_userId_idx": {
+ "name": "session_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "session_user_id_user_id_fk": {
+ "name": "session_user_id_user_id_fk",
+ "tableFrom": "session",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "session_token_unique": {
+ "name": "session_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "token"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user": {
+ "name": "user",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email_verified": {
+ "name": "email_verified",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'user'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_email_unique": {
+ "name": "user_email_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "email"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.verification": {
+ "name": "verification",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "verification_identifier_idx": {
+ "name": "verification_identifier_idx",
+ "columns": [
+ {
+ "expression": "identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_run": {
+ "name": "agent_run",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "schedule_id": {
+ "name": "schedule_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "trigger": {
+ "name": "trigger",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'delegation'"
+ },
+ "scheduled_for": {
+ "name": "scheduled_for",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_activity_id": {
+ "name": "source_activity_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "prompt": {
+ "name": "prompt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "next_attempt_at": {
+ "name": "next_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "output": {
+ "name": "output",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "finished_at": {
+ "name": "finished_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agent_run_schedule_fire_uq": {
+ "name": "agent_run_schedule_fire_uq",
+ "columns": [
+ {
+ "expression": "schedule_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "scheduled_for",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_run_due_idx": {
+ "name": "agent_run_due_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "next_attempt_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_run_schedule_idx": {
+ "name": "agent_run_schedule_idx",
+ "columns": [
+ {
+ "expression": "schedule_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_run_agent_id_ai_agent_id_fk": {
+ "name": "agent_run_agent_id_ai_agent_id_fk",
+ "tableFrom": "agent_run",
+ "tableTo": "ai_agent",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_run_issue_id_issue_id_fk": {
+ "name": "agent_run_issue_id_issue_id_fk",
+ "tableFrom": "agent_run",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_run_schedule_id_agent_schedule_id_fk": {
+ "name": "agent_run_schedule_id_agent_schedule_id_fk",
+ "tableFrom": "agent_run",
+ "tableTo": "agent_schedule",
+ "columnsFrom": [
+ "schedule_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_run_source_activity_id_issue_activity_id_fk": {
+ "name": "agent_run_source_activity_id_issue_activity_id_fk",
+ "tableFrom": "agent_run",
+ "tableTo": "issue_activity",
+ "columnsFrom": [
+ "source_activity_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "agent_run_status_check": {
+ "name": "agent_run_status_check",
+ "value": "\"agent_run\".\"status\" IN ('pending', 'success', 'failed')"
+ },
+ "agent_run_trigger_check": {
+ "name": "agent_run_trigger_check",
+ "value": "\"agent_run\".\"trigger\" IN ('mention', 'delegation', 'schedule', 'manual')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.agent_schedule": {
+ "name": "agent_schedule",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "prompt": {
+ "name": "prompt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cron": {
+ "name": "cron",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "timezone": {
+ "name": "timezone",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "next_run_at": {
+ "name": "next_run_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "last_run_at": {
+ "name": "last_run_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agent_schedule_due_idx": {
+ "name": "agent_schedule_due_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "next_run_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_schedule_agent_idx": {
+ "name": "agent_schedule_agent_idx",
+ "columns": [
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_schedule_agent_id_ai_agent_id_fk": {
+ "name": "agent_schedule_agent_id_ai_agent_id_fk",
+ "tableFrom": "agent_schedule",
+ "tableTo": "ai_agent",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "agent_schedule_agent_id_name_unique": {
+ "name": "agent_schedule_agent_id_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "agent_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "agent_schedule_status_check": {
+ "name": "agent_schedule_status_check",
+ "value": "\"agent_schedule\".\"status\" IN ('active', 'paused')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.agent_skill": {
+ "name": "agent_skill",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_url": {
+ "name": "source_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "s3_prefix": {
+ "name": "s3_prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "files": {
+ "name": "files",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agent_skill_project_idx": {
+ "name": "agent_skill_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_skill_project_id_project_id_fk": {
+ "name": "agent_skill_project_id_project_id_fk",
+ "tableFrom": "agent_skill",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "agent_skill_project_id_name_unique": {
+ "name": "agent_skill_project_id_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "agent_skill_source_check": {
+ "name": "agent_skill_source_check",
+ "value": "\"agent_skill\".\"source\" IN ('upload', 'inline', 'github')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.agent_skill_link": {
+ "name": "agent_skill_link",
+ "schema": "",
+ "columns": {
+ "agent_id": {
+ "name": "agent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "skill_id": {
+ "name": "skill_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "agent_skill_link_skill_idx": {
+ "name": "agent_skill_link_skill_idx",
+ "columns": [
+ {
+ "expression": "skill_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_skill_link_agent_id_ai_agent_id_fk": {
+ "name": "agent_skill_link_agent_id_ai_agent_id_fk",
+ "tableFrom": "agent_skill_link",
+ "tableTo": "ai_agent",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_skill_link_skill_id_agent_skill_id_fk": {
+ "name": "agent_skill_link_skill_id_agent_skill_id_fk",
+ "tableFrom": "agent_skill_link",
+ "tableTo": "agent_skill",
+ "columnsFrom": [
+ "skill_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "agent_skill_link_agent_id_skill_id_pk": {
+ "name": "agent_skill_link_agent_id_skill_id_pk",
+ "columns": [
+ "agent_id",
+ "skill_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_tool": {
+ "name": "agent_tool",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tool_key": {
+ "name": "tool_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "credential_id": {
+ "name": "credential_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agent_tool_project_idx": {
+ "name": "agent_tool_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_tool_credential_idx": {
+ "name": "agent_tool_credential_idx",
+ "columns": [
+ {
+ "expression": "credential_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_tool_project_id_project_id_fk": {
+ "name": "agent_tool_project_id_project_id_fk",
+ "tableFrom": "agent_tool",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_tool_credential_id_integration_credential_id_fk": {
+ "name": "agent_tool_credential_id_integration_credential_id_fk",
+ "tableFrom": "agent_tool",
+ "tableTo": "integration_credential",
+ "columnsFrom": [
+ "credential_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "agent_tool_project_id_tool_key_credential_id_unique": {
+ "name": "agent_tool_project_id_tool_key_credential_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "tool_key",
+ "credential_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_tool_link": {
+ "name": "agent_tool_link",
+ "schema": "",
+ "columns": {
+ "agent_id": {
+ "name": "agent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_tool_id": {
+ "name": "agent_tool_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "agent_tool_link_tool_idx": {
+ "name": "agent_tool_link_tool_idx",
+ "columns": [
+ {
+ "expression": "agent_tool_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_tool_link_agent_id_ai_agent_id_fk": {
+ "name": "agent_tool_link_agent_id_ai_agent_id_fk",
+ "tableFrom": "agent_tool_link",
+ "tableTo": "ai_agent",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_tool_link_agent_tool_id_agent_tool_id_fk": {
+ "name": "agent_tool_link_agent_tool_id_agent_tool_id_fk",
+ "tableFrom": "agent_tool_link",
+ "tableTo": "agent_tool",
+ "columnsFrom": [
+ "agent_tool_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "agent_tool_link_agent_id_agent_tool_id_pk": {
+ "name": "agent_tool_link_agent_id_agent_tool_id_pk",
+ "columns": [
+ "agent_id",
+ "agent_tool_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.ai_agent": {
+ "name": "ai_agent",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "username": {
+ "name": "username",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "model_credential_id": {
+ "name": "model_credential_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "instructions": {
+ "name": "instructions",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tools": {
+ "name": "tools",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "temperature": {
+ "name": "temperature",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "max_steps": {
+ "name": "max_steps",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "trigger_on_mention": {
+ "name": "trigger_on_mention",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "trigger_on_assign": {
+ "name": "trigger_on_assign",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "role_id": {
+ "name": "role_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "api_key_ciphertext": {
+ "name": "api_key_ciphertext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "api_key_iv": {
+ "name": "api_key_iv",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "api_key_auth_tag": {
+ "name": "api_key_auth_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "memory_enabled": {
+ "name": "memory_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "memory_last_messages": {
+ "name": "memory_last_messages",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "ai_agent_project_idx": {
+ "name": "ai_agent_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "ai_agent_project_id_project_id_fk": {
+ "name": "ai_agent_project_id_project_id_fk",
+ "tableFrom": "ai_agent",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "ai_agent_user_id_user_id_fk": {
+ "name": "ai_agent_user_id_user_id_fk",
+ "tableFrom": "ai_agent",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "ai_agent_model_credential_id_integration_credential_id_fk": {
+ "name": "ai_agent_model_credential_id_integration_credential_id_fk",
+ "tableFrom": "ai_agent",
+ "tableTo": "integration_credential",
+ "columnsFrom": [
+ "model_credential_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "ai_agent_role_id_project_role_id_fk": {
+ "name": "ai_agent_role_id_project_role_id_fk",
+ "tableFrom": "ai_agent",
+ "tableTo": "project_role",
+ "columnsFrom": [
+ "role_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "ai_agent_project_id_username_unique": {
+ "name": "ai_agent_project_id_username_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "username"
+ ]
+ },
+ "ai_agent_user_id_unique": {
+ "name": "ai_agent_user_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "user_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "ai_agent_kind_check": {
+ "name": "ai_agent_kind_check",
+ "value": "\"ai_agent\".\"kind\" IN ('external', 'internal')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.app_secret": {
+ "name": "app_secret",
+ "schema": "",
+ "columns": {
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "ciphertext": {
+ "name": "ciphertext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "iv": {
+ "name": "iv",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "auth_tag": {
+ "name": "auth_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "redacted": {
+ "name": "redacted",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.app_setting": {
+ "name": "app_setting",
+ "schema": "",
+ "columns": {
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.custom_field": {
+ "name": "custom_field",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_type_id": {
+ "name": "issue_type_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "field_type": {
+ "name": "field_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "show_in_body": {
+ "name": "show_in_body",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "custom_field_project_id_project_id_fk": {
+ "name": "custom_field_project_id_project_id_fk",
+ "tableFrom": "custom_field",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "custom_field_issue_type_id_issue_type_id_fk": {
+ "name": "custom_field_issue_type_id_issue_type_id_fk",
+ "tableFrom": "custom_field",
+ "tableTo": "issue_type",
+ "columnsFrom": [
+ "issue_type_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "custom_field_field_type_check": {
+ "name": "custom_field_field_type_check",
+ "value": "\"custom_field\".\"field_type\" IN ('text', 'markdown', 'url', 'number', 'boolean', 'date', 'datetime', 'datetime_range', 'select', 'multi_select')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.custom_field_option": {
+ "name": "custom_field_option",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "field_id": {
+ "name": "field_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'#6b7280'"
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "custom_field_option_field_id_custom_field_id_fk": {
+ "name": "custom_field_option_field_id_custom_field_id_fk",
+ "tableFrom": "custom_field_option",
+ "tableTo": "custom_field",
+ "columnsFrom": [
+ "field_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "custom_field_option_field_id_value_unique": {
+ "name": "custom_field_option_field_id_value_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "field_id",
+ "value"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.cycle": {
+ "name": "cycle",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "goal": {
+ "name": "goal",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "start_date": {
+ "name": "start_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "end_date": {
+ "name": "end_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "cycle_project_idx": {
+ "name": "cycle_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "start_date",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "cycle_project_id_project_id_fk": {
+ "name": "cycle_project_id_project_id_fk",
+ "tableFrom": "cycle",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "cycle_dates_check": {
+ "name": "cycle_dates_check",
+ "value": "\"cycle\".\"end_date\" >= \"cycle\".\"start_date\""
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.initiative": {
+ "name": "initiative",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'planned'"
+ },
+ "owner_user_id": {
+ "name": "owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "priority": {
+ "name": "priority",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "start_date": {
+ "name": "start_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "target_date": {
+ "name": "target_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "initiative_project_idx": {
+ "name": "initiative_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "initiative_project_id_project_id_fk": {
+ "name": "initiative_project_id_project_id_fk",
+ "tableFrom": "initiative",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "initiative_owner_user_id_user_id_fk": {
+ "name": "initiative_owner_user_id_user_id_fk",
+ "tableFrom": "initiative",
+ "tableTo": "user",
+ "columnsFrom": [
+ "owner_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "initiative_status_check": {
+ "name": "initiative_status_check",
+ "value": "\"initiative\".\"status\" IN ('proposed', 'planned', 'active', 'completed', 'canceled')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.initiative_label": {
+ "name": "initiative_label",
+ "schema": "",
+ "columns": {
+ "initiative_id": {
+ "name": "initiative_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "label_id": {
+ "name": "label_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "initiative_label_initiative_id_initiative_id_fk": {
+ "name": "initiative_label_initiative_id_initiative_id_fk",
+ "tableFrom": "initiative_label",
+ "tableTo": "initiative",
+ "columnsFrom": [
+ "initiative_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "initiative_label_label_id_label_id_fk": {
+ "name": "initiative_label_label_id_label_id_fk",
+ "tableFrom": "initiative_label",
+ "tableTo": "label",
+ "columnsFrom": [
+ "label_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "initiative_label_initiative_id_label_id_pk": {
+ "name": "initiative_label_initiative_id_label_id_pk",
+ "columns": [
+ "initiative_id",
+ "label_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.integration_credential": {
+ "name": "integration_credential",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "integration_key": {
+ "name": "integration_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ciphertext": {
+ "name": "ciphertext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "iv": {
+ "name": "iv",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "auth_tag": {
+ "name": "auth_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "redacted": {
+ "name": "redacted",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "integration_credential_project_idx": {
+ "name": "integration_credential_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "integration_credential_project_id_project_id_fk": {
+ "name": "integration_credential_project_id_project_id_fk",
+ "tableFrom": "integration_credential",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue": {
+ "name": "issue",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sequence_number": {
+ "name": "sequence_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type_id": {
+ "name": "type_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "initiative_id": {
+ "name": "initiative_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cycle_id": {
+ "name": "cycle_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "column_id": {
+ "name": "column_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "parent_id": {
+ "name": "parent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "assignee_user_id": {
+ "name": "assignee_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delegate_user_id": {
+ "name": "delegate_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "priority": {
+ "name": "priority",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "start_date": {
+ "name": "start_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "due_date": {
+ "name": "due_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "share_token": {
+ "name": "share_token",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "share_extended": {
+ "name": "share_extended",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_project_active_idx": {
+ "name": "issue_project_active_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "column_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"issue\".\"archived_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_parent_idx": {
+ "name": "issue_parent_idx",
+ "columns": [
+ {
+ "expression": "parent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"issue\".\"parent_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_cycle_idx": {
+ "name": "issue_cycle_idx",
+ "columns": [
+ {
+ "expression": "cycle_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"issue\".\"cycle_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_project_id_project_id_fk": {
+ "name": "issue_project_id_project_id_fk",
+ "tableFrom": "issue",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_type_id_issue_type_id_fk": {
+ "name": "issue_type_id_issue_type_id_fk",
+ "tableFrom": "issue",
+ "tableTo": "issue_type",
+ "columnsFrom": [
+ "type_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "issue_initiative_id_initiative_id_fk": {
+ "name": "issue_initiative_id_initiative_id_fk",
+ "tableFrom": "issue",
+ "tableTo": "initiative",
+ "columnsFrom": [
+ "initiative_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "issue_cycle_id_cycle_id_fk": {
+ "name": "issue_cycle_id_cycle_id_fk",
+ "tableFrom": "issue",
+ "tableTo": "cycle",
+ "columnsFrom": [
+ "cycle_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "issue_column_id_project_column_id_fk": {
+ "name": "issue_column_id_project_column_id_fk",
+ "tableFrom": "issue",
+ "tableTo": "project_column",
+ "columnsFrom": [
+ "column_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "issue_parent_id_issue_id_fk": {
+ "name": "issue_parent_id_issue_id_fk",
+ "tableFrom": "issue",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "parent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "issue_assignee_user_id_user_id_fk": {
+ "name": "issue_assignee_user_id_user_id_fk",
+ "tableFrom": "issue",
+ "tableTo": "user",
+ "columnsFrom": [
+ "assignee_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "issue_delegate_user_id_user_id_fk": {
+ "name": "issue_delegate_user_id_user_id_fk",
+ "tableFrom": "issue",
+ "tableTo": "user",
+ "columnsFrom": [
+ "delegate_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "issue_share_token_unique": {
+ "name": "issue_share_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "share_token"
+ ]
+ },
+ "issue_project_id_sequence_number_unique": {
+ "name": "issue_project_id_sequence_number_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "sequence_number"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_activity": {
+ "name": "issue_activity",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "initiative_id": {
+ "name": "initiative_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_user_id": {
+ "name": "actor_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_name": {
+ "name": "actor_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "body": {
+ "name": "body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "action": {
+ "name": "action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "subject": {
+ "name": "subject",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "from_text": {
+ "name": "from_text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "to_text": {
+ "name": "to_text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_activity_issue_idx": {
+ "name": "issue_activity_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_activity_initiative_idx": {
+ "name": "issue_activity_initiative_idx",
+ "columns": [
+ {
+ "expression": "initiative_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_activity_issue_id_issue_id_fk": {
+ "name": "issue_activity_issue_id_issue_id_fk",
+ "tableFrom": "issue_activity",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_activity_initiative_id_initiative_id_fk": {
+ "name": "issue_activity_initiative_id_initiative_id_fk",
+ "tableFrom": "issue_activity",
+ "tableTo": "initiative",
+ "columnsFrom": [
+ "initiative_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_activity_actor_user_id_user_id_fk": {
+ "name": "issue_activity_actor_user_id_user_id_fk",
+ "tableFrom": "issue_activity",
+ "tableTo": "user",
+ "columnsFrom": [
+ "actor_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "issue_activity_kind_check": {
+ "name": "issue_activity_kind_check",
+ "value": "\"issue_activity\".\"kind\" IN ('comment', 'activity')"
+ },
+ "issue_activity_owner_check": {
+ "name": "issue_activity_owner_check",
+ "value": "(\"issue_activity\".\"issue_id\" IS NOT NULL) <> (\"issue_activity\".\"initiative_id\" IS NOT NULL)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.issue_attachment": {
+ "name": "issue_attachment",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "public_id": {
+ "name": "public_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "s3_key": {
+ "name": "s3_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "filename": {
+ "name": "filename",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content_type": {
+ "name": "content_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "size_bytes": {
+ "name": "size_bytes",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_attachment_issue_idx": {
+ "name": "issue_attachment_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_attachment_issue_id_issue_id_fk": {
+ "name": "issue_attachment_issue_id_issue_id_fk",
+ "tableFrom": "issue_attachment",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "issue_attachment_public_id_unique": {
+ "name": "issue_attachment_public_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "public_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_checklist": {
+ "name": "issue_checklist",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_checklist_issue_idx": {
+ "name": "issue_checklist_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_checklist_issue_id_issue_id_fk": {
+ "name": "issue_checklist_issue_id_issue_id_fk",
+ "tableFrom": "issue_checklist",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_checklist_item": {
+ "name": "issue_checklist_item",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "checklist_id": {
+ "name": "checklist_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "done": {
+ "name": "done",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_checklist_item_checklist_idx": {
+ "name": "issue_checklist_item_checklist_idx",
+ "columns": [
+ {
+ "expression": "checklist_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_checklist_item_checklist_id_issue_checklist_id_fk": {
+ "name": "issue_checklist_item_checklist_id_issue_checklist_id_fk",
+ "tableFrom": "issue_checklist_item",
+ "tableTo": "issue_checklist",
+ "columnsFrom": [
+ "checklist_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_field_option": {
+ "name": "issue_field_option",
+ "schema": "",
+ "columns": {
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "field_id": {
+ "name": "field_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "option_id": {
+ "name": "option_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "issue_field_option_issue_id_issue_id_fk": {
+ "name": "issue_field_option_issue_id_issue_id_fk",
+ "tableFrom": "issue_field_option",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_field_option_field_id_custom_field_id_fk": {
+ "name": "issue_field_option_field_id_custom_field_id_fk",
+ "tableFrom": "issue_field_option",
+ "tableTo": "custom_field",
+ "columnsFrom": [
+ "field_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_field_option_option_id_custom_field_option_id_fk": {
+ "name": "issue_field_option_option_id_custom_field_option_id_fk",
+ "tableFrom": "issue_field_option",
+ "tableTo": "custom_field_option",
+ "columnsFrom": [
+ "option_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "issue_field_option_issue_id_field_id_option_id_pk": {
+ "name": "issue_field_option_issue_id_field_id_option_id_pk",
+ "columns": [
+ "issue_id",
+ "field_id",
+ "option_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_field_value": {
+ "name": "issue_field_value",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "field_id": {
+ "name": "field_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value_text": {
+ "name": "value_text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "value_number": {
+ "name": "value_number",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "value_bool": {
+ "name": "value_bool",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "value_date": {
+ "name": "value_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "value_datetime": {
+ "name": "value_datetime",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "value_datetime_end": {
+ "name": "value_datetime_end",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "issue_field_value_issue_id_issue_id_fk": {
+ "name": "issue_field_value_issue_id_issue_id_fk",
+ "tableFrom": "issue_field_value",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_field_value_field_id_custom_field_id_fk": {
+ "name": "issue_field_value_field_id_custom_field_id_fk",
+ "tableFrom": "issue_field_value",
+ "tableTo": "custom_field",
+ "columnsFrom": [
+ "field_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "issue_field_value_issue_id_field_id_unique": {
+ "name": "issue_field_value_issue_id_field_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "issue_id",
+ "field_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_label": {
+ "name": "issue_label",
+ "schema": "",
+ "columns": {
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "label_id": {
+ "name": "label_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "issue_label_issue_id_issue_id_fk": {
+ "name": "issue_label_issue_id_issue_id_fk",
+ "tableFrom": "issue_label",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_label_label_id_label_id_fk": {
+ "name": "issue_label_label_id_label_id_fk",
+ "tableFrom": "issue_label",
+ "tableTo": "label",
+ "columnsFrom": [
+ "label_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "issue_label_issue_id_label_id_pk": {
+ "name": "issue_label_issue_id_label_id_pk",
+ "columns": [
+ "issue_id",
+ "label_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_link": {
+ "name": "issue_link",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "source_issue_id": {
+ "name": "source_issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_issue_id": {
+ "name": "target_issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_link_pair_kind_idx": {
+ "name": "issue_link_pair_kind_idx",
+ "columns": [
+ {
+ "expression": "least(\"source_issue_id\", \"target_issue_id\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "greatest(\"source_issue_id\", \"target_issue_id\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_link_source_idx": {
+ "name": "issue_link_source_idx",
+ "columns": [
+ {
+ "expression": "source_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_link_target_idx": {
+ "name": "issue_link_target_idx",
+ "columns": [
+ {
+ "expression": "target_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_link_source_issue_id_issue_id_fk": {
+ "name": "issue_link_source_issue_id_issue_id_fk",
+ "tableFrom": "issue_link",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "source_issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_link_target_issue_id_issue_id_fk": {
+ "name": "issue_link_target_issue_id_issue_id_fk",
+ "tableFrom": "issue_link",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "target_issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "issue_link_kind_check": {
+ "name": "issue_link_kind_check",
+ "value": "\"issue_link\".\"kind\" IN ('blocks', 'relates', 'duplicates')"
+ },
+ "issue_link_self_check": {
+ "name": "issue_link_self_check",
+ "value": "\"issue_link\".\"source_issue_id\" <> \"issue_link\".\"target_issue_id\""
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.issue_type": {
+ "name": "issue_type",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'#6b7280'"
+ },
+ "is_default": {
+ "name": "is_default",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "issue_type_project_id_project_id_fk": {
+ "name": "issue_type_project_id_project_id_fk",
+ "tableFrom": "issue_type",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "issue_type_project_id_name_unique": {
+ "name": "issue_type_project_id_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_watcher": {
+ "name": "issue_watcher",
+ "schema": "",
+ "columns": {
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subscribed": {
+ "name": "subscribed",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "issue_watcher_issue_id_issue_id_fk": {
+ "name": "issue_watcher_issue_id_issue_id_fk",
+ "tableFrom": "issue_watcher",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_watcher_user_id_user_id_fk": {
+ "name": "issue_watcher_user_id_user_id_fk",
+ "tableFrom": "issue_watcher",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "issue_watcher_issue_id_user_id_pk": {
+ "name": "issue_watcher_issue_id_user_id_pk",
+ "columns": [
+ "issue_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.label": {
+ "name": "label",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "group_id": {
+ "name": "group_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'#6b7280'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "label_project_id_project_id_fk": {
+ "name": "label_project_id_project_id_fk",
+ "tableFrom": "label",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "label_group_id_label_group_id_fk": {
+ "name": "label_group_id_label_group_id_fk",
+ "tableFrom": "label",
+ "tableTo": "label_group",
+ "columnsFrom": [
+ "group_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "label_project_id_name_unique": {
+ "name": "label_project_id_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.label_group": {
+ "name": "label_group",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'#6b7280'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "label_group_project_id_project_id_fk": {
+ "name": "label_group_project_id_project_id_fk",
+ "tableFrom": "label_group",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "label_group_project_id_name_unique": {
+ "name": "label_group_project_id_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.note_board": {
+ "name": "note_board",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owner_user_id": {
+ "name": "owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "canvas": {
+ "name": "canvas",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "note_board_project_idx": {
+ "name": "note_board_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "note_board_project_id_project_id_fk": {
+ "name": "note_board_project_id_project_id_fk",
+ "tableFrom": "note_board",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "note_board_owner_user_id_user_id_fk": {
+ "name": "note_board_owner_user_id_user_id_fk",
+ "tableFrom": "note_board",
+ "tableTo": "user",
+ "columnsFrom": [
+ "owner_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "note_board_created_by_user_id_user_id_fk": {
+ "name": "note_board_created_by_user_id_user_id_fk",
+ "tableFrom": "note_board",
+ "tableTo": "user",
+ "columnsFrom": [
+ "created_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.note_board_member": {
+ "name": "note_board_member",
+ "schema": "",
+ "columns": {
+ "board_id": {
+ "name": "board_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "note_board_member_user_idx": {
+ "name": "note_board_member_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "note_board_member_board_id_note_board_id_fk": {
+ "name": "note_board_member_board_id_note_board_id_fk",
+ "tableFrom": "note_board_member",
+ "tableTo": "note_board",
+ "columnsFrom": [
+ "board_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "note_board_member_user_id_user_id_fk": {
+ "name": "note_board_member_user_id_user_id_fk",
+ "tableFrom": "note_board_member",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "note_board_member_board_id_user_id_pk": {
+ "name": "note_board_member_board_id_user_id_pk",
+ "columns": [
+ "board_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.notification": {
+ "name": "notification",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_activity_id": {
+ "name": "source_activity_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_user_id": {
+ "name": "actor_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_name": {
+ "name": "actor_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "read_at": {
+ "name": "read_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "snoozed_until": {
+ "name": "snoozed_until",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "notification_user_idx": {
+ "name": "notification_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "notification_user_unread_idx": {
+ "name": "notification_user_unread_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"notification\".\"read_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "notification_user_id_user_id_fk": {
+ "name": "notification_user_id_user_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "notification_project_id_project_id_fk": {
+ "name": "notification_project_id_project_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "notification_issue_id_issue_id_fk": {
+ "name": "notification_issue_id_issue_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "notification_source_activity_id_issue_activity_id_fk": {
+ "name": "notification_source_activity_id_issue_activity_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "issue_activity",
+ "columnsFrom": [
+ "source_activity_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "notification_actor_user_id_user_id_fk": {
+ "name": "notification_actor_user_id_user_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "user",
+ "columnsFrom": [
+ "actor_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "notification_type_check": {
+ "name": "notification_type_check",
+ "value": "\"notification\".\"type\" IN ('assigned', 'mentioned', 'commented', 'state_changed')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.notification_delivery": {
+ "name": "notification_delivery",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "channel": {
+ "name": "channel",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "recipient": {
+ "name": "recipient",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "next_attempt_at": {
+ "name": "next_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "notification_delivery_due_idx": {
+ "name": "notification_delivery_due_idx",
+ "columns": [
+ {
+ "expression": "next_attempt_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"notification_delivery\".\"status\" = 'pending'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "notification_delivery_project_id_project_id_fk": {
+ "name": "notification_delivery_project_id_project_id_fk",
+ "tableFrom": "notification_delivery",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "notification_delivery_channel_check": {
+ "name": "notification_delivery_channel_check",
+ "value": "\"notification_delivery\".\"channel\" IN ('email', 'telegram')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.project": {
+ "name": "project",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "next_sequence": {
+ "name": "next_sequence",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "mcp_enabled": {
+ "name": "mcp_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "initiatives_enabled": {
+ "name": "initiatives_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "dashboards_enabled": {
+ "name": "dashboards_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "notes_enabled": {
+ "name": "notes_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "cycles_enabled": {
+ "name": "cycles_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "subtasks_enabled": {
+ "name": "subtasks_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "checklists_enabled": {
+ "name": "checklists_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "issue_stats_enabled": {
+ "name": "issue_stats_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "project_key_unique": {
+ "name": "project_key_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "key"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_action": {
+ "name": "project_action",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "condition": {
+ "name": "condition",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "effect": {
+ "name": "effect",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_action_project_idx": {
+ "name": "project_action_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_action_project_id_project_id_fk": {
+ "name": "project_action_project_id_project_id_fk",
+ "tableFrom": "project_action",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_column": {
+ "name": "project_column",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "state_type": {
+ "name": "state_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'unstarted'"
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'#6b7280'"
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "project_column_project_id_project_id_fk": {
+ "name": "project_column_project_id_project_id_fk",
+ "tableFrom": "project_column",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "project_column_project_id_position_unique": {
+ "name": "project_column_project_id_position_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "position"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "project_column_state_type_check": {
+ "name": "project_column_state_type_check",
+ "value": "\"project_column\".\"state_type\" IN ('backlog', 'unstarted', 'started', 'completed', 'canceled')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.project_dashboard": {
+ "name": "project_dashboard",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "layout": {
+ "name": "layout",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_dashboard_project_idx": {
+ "name": "project_dashboard_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_dashboard_project_id_project_id_fk": {
+ "name": "project_dashboard_project_id_project_id_fk",
+ "tableFrom": "project_dashboard",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_invite": {
+ "name": "project_invite",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'member'"
+ },
+ "role_id": {
+ "name": "role_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "invited_by_user_id": {
+ "name": "invited_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "accepted_by_user_id": {
+ "name": "accepted_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "responded_at": {
+ "name": "responded_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "project_invite_pending_uq": {
+ "name": "project_invite_pending_uq",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "email",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"project_invite\".\"status\" = 'pending'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "project_invite_project_idx": {
+ "name": "project_invite_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_invite_project_id_project_id_fk": {
+ "name": "project_invite_project_id_project_id_fk",
+ "tableFrom": "project_invite",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_invite_role_id_project_role_id_fk": {
+ "name": "project_invite_role_id_project_role_id_fk",
+ "tableFrom": "project_invite",
+ "tableTo": "project_role",
+ "columnsFrom": [
+ "role_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "project_invite_invited_by_user_id_user_id_fk": {
+ "name": "project_invite_invited_by_user_id_user_id_fk",
+ "tableFrom": "project_invite",
+ "tableTo": "user",
+ "columnsFrom": [
+ "invited_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "project_invite_accepted_by_user_id_user_id_fk": {
+ "name": "project_invite_accepted_by_user_id_user_id_fk",
+ "tableFrom": "project_invite",
+ "tableTo": "user",
+ "columnsFrom": [
+ "accepted_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "project_invite_token_unique": {
+ "name": "project_invite_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "token"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "project_invite_role_check": {
+ "name": "project_invite_role_check",
+ "value": "\"project_invite\".\"role\" IN ('owner', 'member')"
+ },
+ "project_invite_status_check": {
+ "name": "project_invite_status_check",
+ "value": "\"project_invite\".\"status\" IN ('pending', 'accepted', 'rejected')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.project_member": {
+ "name": "project_member",
+ "schema": "",
+ "columns": {
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'member'"
+ },
+ "role_id": {
+ "name": "role_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_member_user_idx": {
+ "name": "project_member_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_member_project_id_project_id_fk": {
+ "name": "project_member_project_id_project_id_fk",
+ "tableFrom": "project_member",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_member_user_id_user_id_fk": {
+ "name": "project_member_user_id_user_id_fk",
+ "tableFrom": "project_member",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_member_role_id_project_role_id_fk": {
+ "name": "project_member_role_id_project_role_id_fk",
+ "tableFrom": "project_member",
+ "tableTo": "project_role",
+ "columnsFrom": [
+ "role_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "project_member_project_id_user_id_pk": {
+ "name": "project_member_project_id_user_id_pk",
+ "columns": [
+ "project_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "project_member_role_check": {
+ "name": "project_member_role_check",
+ "value": "\"project_member\".\"role\" IN ('owner', 'member')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.project_notification_setting": {
+ "name": "project_notification_setting",
+ "schema": "",
+ "columns": {
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "ciphertext": {
+ "name": "ciphertext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "iv": {
+ "name": "iv",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "auth_tag": {
+ "name": "auth_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "redacted": {
+ "name": "redacted",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "project_notification_setting_project_id_project_id_fk": {
+ "name": "project_notification_setting_project_id_project_id_fk",
+ "tableFrom": "project_notification_setting",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_role": {
+ "name": "project_role",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_default": {
+ "name": "is_default",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "permissions": {
+ "name": "permissions",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_role_default_uq": {
+ "name": "project_role_default_uq",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"project_role\".\"is_default\"",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "project_role_project_idx": {
+ "name": "project_role_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_role_project_id_project_id_fk": {
+ "name": "project_role_project_id_project_id_fk",
+ "tableFrom": "project_role",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "project_role_project_id_name_unique": {
+ "name": "project_role_project_id_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_setting": {
+ "name": "project_setting",
+ "schema": "",
+ "columns": {
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "project_setting_project_id_project_id_fk": {
+ "name": "project_setting_project_id_project_id_fk",
+ "tableFrom": "project_setting",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "project_setting_project_id_key_pk": {
+ "name": "project_setting_project_id_key_pk",
+ "columns": [
+ "project_id",
+ "key"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_view": {
+ "name": "project_view",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "filters": {
+ "name": "filters",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "display": {
+ "name": "display",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "share_token": {
+ "name": "share_token",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "share_extended": {
+ "name": "share_extended",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_view_project_idx": {
+ "name": "project_view_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_view_project_id_project_id_fk": {
+ "name": "project_view_project_id_project_id_fk",
+ "tableFrom": "project_view",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "project_view_share_token_unique": {
+ "name": "project_view_share_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "share_token"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_view_favorite": {
+ "name": "project_view_favorite",
+ "schema": "",
+ "columns": {
+ "view_id": {
+ "name": "view_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "project_view_favorite_view_id_project_view_id_fk": {
+ "name": "project_view_favorite_view_id_project_view_id_fk",
+ "tableFrom": "project_view_favorite",
+ "tableTo": "project_view",
+ "columnsFrom": [
+ "view_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_view_favorite_user_id_user_id_fk": {
+ "name": "project_view_favorite_user_id_user_id_fk",
+ "tableFrom": "project_view_favorite",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "project_view_favorite_view_id_user_id_pk": {
+ "name": "project_view_favorite_view_id_user_id_pk",
+ "columns": [
+ "view_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.revision": {
+ "name": "revision",
+ "schema": "",
+ "columns": {
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "rev": {
+ "name": "rev",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ }
+ },
+ "indexes": {
+ "revision_project_idx": {
+ "name": "revision_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_notification_preference": {
+ "name": "user_notification_preference",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email_events": {
+ "name": "email_events",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "telegram_events": {
+ "name": "telegram_events",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "user_notification_preference_user_id_user_id_fk": {
+ "name": "user_notification_preference_user_id_user_id_fk",
+ "tableFrom": "user_notification_preference",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "user_notification_preference_project_id_project_id_fk": {
+ "name": "user_notification_preference_project_id_project_id_fk",
+ "tableFrom": "user_notification_preference",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_notification_pref_user_project_unique": {
+ "name": "user_notification_pref_user_project_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "user_id",
+ "project_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_preference": {
+ "name": "user_preference",
+ "schema": "",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "timezone": {
+ "name": "timezone",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'UTC'"
+ },
+ "locale": {
+ "name": "locale",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'en'"
+ },
+ "theme": {
+ "name": "theme",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'system'"
+ },
+ "issue_open_mode": {
+ "name": "issue_open_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'panel'"
+ },
+ "start_page": {
+ "name": "start_page",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'work-items'"
+ },
+ "show_chat_by_default": {
+ "name": "show_chat_by_default",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "issue_stats_open": {
+ "name": "issue_stats_open",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "issue_stats_view": {
+ "name": "issue_stats_view",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'compact'"
+ },
+ "issue_activity_view": {
+ "name": "issue_activity_view",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'flat'"
+ },
+ "auto_watch": {
+ "name": "auto_watch",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "hotkeys": {
+ "name": "hotkeys",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_project_id": {
+ "name": "last_project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "user_preference_user_id_user_id_fk": {
+ "name": "user_preference_user_id_user_id_fk",
+ "tableFrom": "user_preference",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "user_preference_last_project_id_project_id_fk": {
+ "name": "user_preference_last_project_id_project_id_fk",
+ "tableFrom": "user_preference",
+ "tableTo": "project",
+ "columnsFrom": [
+ "last_project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "user_preference_theme_check": {
+ "name": "user_preference_theme_check",
+ "value": "\"user_preference\".\"theme\" IN ('light', 'dark', 'system')"
+ },
+ "user_preference_issue_open_mode_check": {
+ "name": "user_preference_issue_open_mode_check",
+ "value": "\"user_preference\".\"issue_open_mode\" IN ('panel', 'page')"
+ },
+ "user_preference_start_page_check": {
+ "name": "user_preference_start_page_check",
+ "value": "\"user_preference\".\"start_page\" IN ('inbox', 'dashboard', 'work-items', 'initiatives', 'ai-chat')"
+ },
+ "user_preference_issue_stats_view_check": {
+ "name": "user_preference_issue_stats_view_check",
+ "value": "\"user_preference\".\"issue_stats_view\" IN ('compact', 'timeline')"
+ },
+ "user_preference_issue_activity_view_check": {
+ "name": "user_preference_issue_activity_view_check",
+ "value": "\"user_preference\".\"issue_activity_view\" IN ('flat', 'grouped')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.user_telegram_account": {
+ "name": "user_telegram_account",
+ "schema": "",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "chat_id": {
+ "name": "chat_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "username": {
+ "name": "username",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "first_name": {
+ "name": "first_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "link_code": {
+ "name": "link_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "link_code_expires_at": {
+ "name": "link_code_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "linked_at": {
+ "name": "linked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "user_telegram_account_chat_id_unique": {
+ "name": "user_telegram_account_chat_id_unique",
+ "columns": [
+ {
+ "expression": "chat_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"user_telegram_account\".\"chat_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "user_telegram_account_link_code_unique": {
+ "name": "user_telegram_account_link_code_unique",
+ "columns": [
+ {
+ "expression": "link_code",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"user_telegram_account\".\"link_code\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_telegram_account_user_id_user_id_fk": {
+ "name": "user_telegram_account_user_id_user_id_fk",
+ "tableFrom": "user_telegram_account",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.webhook": {
+ "name": "webhook",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "secret": {
+ "name": "secret",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "events": {
+ "name": "events",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "consecutive_failures": {
+ "name": "consecutive_failures",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "webhook_project_idx": {
+ "name": "webhook_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "webhook_project_id_project_id_fk": {
+ "name": "webhook_project_id_project_id_fk",
+ "tableFrom": "webhook",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.webhook_delivery": {
+ "name": "webhook_delivery",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "webhook_id": {
+ "name": "webhook_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event_id": {
+ "name": "event_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event_type": {
+ "name": "event_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "next_attempt_at": {
+ "name": "next_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "response_status": {
+ "name": "response_status",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "response_body": {
+ "name": "response_body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "webhook_delivery_due_idx": {
+ "name": "webhook_delivery_due_idx",
+ "columns": [
+ {
+ "expression": "next_attempt_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"webhook_delivery\".\"status\" = 'pending'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "webhook_delivery_webhook_idx": {
+ "name": "webhook_delivery_webhook_idx",
+ "columns": [
+ {
+ "expression": "webhook_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "webhook_delivery_webhook_id_webhook_id_fk": {
+ "name": "webhook_delivery_webhook_id_webhook_id_fk",
+ "tableFrom": "webhook_delivery",
+ "tableTo": "webhook",
+ "columnsFrom": [
+ "webhook_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ }
+ },
+ "enums": {},
+ "schemas": {},
+ "sequences": {},
+ "roles": {},
+ "policies": {},
+ "views": {},
+ "_meta": {
+ "columns": {},
+ "schemas": {},
+ "tables": {}
+ }
+}
\ No newline at end of file
diff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.json
index 798e6133..4fc35e3d 100644
--- a/packages/db/drizzle/meta/_journal.json
+++ b/packages/db/drizzle/meta/_journal.json
@@ -526,6 +526,13 @@
"when": 1786572699500,
"tag": "0074_gigantic_lenny_balinger",
"breakpoints": true
+ },
+ {
+ "idx": 75,
+ "version": "7",
+ "when": 1786628860087,
+ "tag": "0075_left_rafael_vega",
+ "breakpoints": true
}
]
}
\ No newline at end of file
diff --git a/packages/db/src/schema/app.ts b/packages/db/src/schema/app.ts
index ae96f15b..f4b3f5b6 100644
--- a/packages/db/src/schema/app.ts
+++ b/packages/db/src/schema/app.ts
@@ -734,7 +734,7 @@ export const customField = pgTable(
(t) => [
check(
'custom_field_field_type_check',
- sql`${t.fieldType} IN ('text', 'markdown', 'url', 'number', 'boolean', 'date', 'select', 'multi_select')`,
+ sql`${t.fieldType} IN ('text', 'markdown', 'url', 'number', 'boolean', 'date', 'datetime', 'datetime_range', 'select', 'multi_select')`,
),
],
);
@@ -992,6 +992,10 @@ export const issueFieldValue = pgTable(
valueNumber: numeric('value_number'),
valueBool: boolean('value_bool'),
valueDate: date('value_date'),
+ // datetime and datetime_range fields. A datetime_range keeps its end here;
+ // for a datetime the end stays NULL.
+ valueDatetime: timestamp('value_datetime', { withTimezone: true }),
+ valueDatetimeEnd: timestamp('value_datetime_end', { withTimezone: true }),
},
(t) => [unique().on(t.issueId, t.fieldId)],
);