@kernhq/module-tracker 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +662 -0
- package/README.md +265 -0
- package/dist/contract/events.d.ts +140 -0
- package/dist/contract/events.d.ts.map +1 -0
- package/dist/contract/events.js +51 -0
- package/dist/contract/events.js.map +1 -0
- package/dist/contract/index.d.ts +6 -0
- package/dist/contract/index.d.ts.map +1 -0
- package/dist/contract/index.js +6 -0
- package/dist/contract/index.js.map +1 -0
- package/dist/contract/models.d.ts +2547 -0
- package/dist/contract/models.d.ts.map +1 -0
- package/dist/contract/models.js +1214 -0
- package/dist/contract/models.js.map +1 -0
- package/dist/contract/notifications.d.ts +4 -0
- package/dist/contract/notifications.d.ts.map +1 -0
- package/dist/contract/notifications.js +46 -0
- package/dist/contract/notifications.js.map +1 -0
- package/dist/contract/permissions.d.ts +161 -0
- package/dist/contract/permissions.d.ts.map +1 -0
- package/dist/contract/permissions.js +192 -0
- package/dist/contract/permissions.js.map +1 -0
- package/dist/contract/router.d.ts +9659 -0
- package/dist/contract/router.d.ts.map +1 -0
- package/dist/contract/router.js +732 -0
- package/dist/contract/router.js.map +1 -0
- package/dist/kql/ast.d.ts +90 -0
- package/dist/kql/ast.d.ts.map +1 -0
- package/dist/kql/ast.js +80 -0
- package/dist/kql/ast.js.map +1 -0
- package/dist/kql/dates.d.ts +16 -0
- package/dist/kql/dates.d.ts.map +1 -0
- package/dist/kql/dates.js +54 -0
- package/dist/kql/dates.js.map +1 -0
- package/dist/kql/fields.d.ts +61 -0
- package/dist/kql/fields.d.ts.map +1 -0
- package/dist/kql/fields.js +106 -0
- package/dist/kql/fields.js.map +1 -0
- package/dist/kql/index.d.ts +16 -0
- package/dist/kql/index.d.ts.map +1 -0
- package/dist/kql/index.js +16 -0
- package/dist/kql/index.js.map +1 -0
- package/dist/kql/lexer.d.ts +28 -0
- package/dist/kql/lexer.d.ts.map +1 -0
- package/dist/kql/lexer.js +127 -0
- package/dist/kql/lexer.js.map +1 -0
- package/dist/kql/parser.d.ts +14 -0
- package/dist/kql/parser.d.ts.map +1 -0
- package/dist/kql/parser.js +290 -0
- package/dist/kql/parser.js.map +1 -0
- package/dist/kql/suggest.d.ts +8 -0
- package/dist/kql/suggest.d.ts.map +1 -0
- package/dist/kql/suggest.js +96 -0
- package/dist/kql/suggest.js.map +1 -0
- package/dist/kql/validate.d.ts +10 -0
- package/dist/kql/validate.d.ts.map +1 -0
- package/dist/kql/validate.js +84 -0
- package/dist/kql/validate.js.map +1 -0
- package/dist/server/index.d.ts +17 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +583 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/kql/compile.d.ts +49 -0
- package/dist/server/kql/compile.d.ts.map +1 -0
- package/dist/server/kql/compile.js +372 -0
- package/dist/server/kql/compile.js.map +1 -0
- package/dist/server/rank.d.ts +23 -0
- package/dist/server/rank.d.ts.map +1 -0
- package/dist/server/rank.js +66 -0
- package/dist/server/rank.js.map +1 -0
- package/dist/server/rich.d.ts +30 -0
- package/dist/server/rich.d.ts.map +1 -0
- package/dist/server/rich.js +97 -0
- package/dist/server/rich.js.map +1 -0
- package/dist/server/router.d.ts +10589 -0
- package/dist/server/router.d.ts.map +1 -0
- package/dist/server/router.js +431 -0
- package/dist/server/router.js.map +1 -0
- package/dist/server/schema.d.ts +6622 -0
- package/dist/server/schema.d.ts.map +1 -0
- package/dist/server/schema.js +581 -0
- package/dist/server/schema.js.map +1 -0
- package/dist/server/services/access.d.ts +53 -0
- package/dist/server/services/access.d.ts.map +1 -0
- package/dist/server/services/access.js +146 -0
- package/dist/server/services/access.js.map +1 -0
- package/dist/server/services/comments.d.ts +36 -0
- package/dist/server/services/comments.d.ts.map +1 -0
- package/dist/server/services/comments.js +231 -0
- package/dist/server/services/comments.js.map +1 -0
- package/dist/server/services/config.d.ts +130 -0
- package/dist/server/services/config.d.ts.map +1 -0
- package/dist/server/services/config.js +797 -0
- package/dist/server/services/config.js.map +1 -0
- package/dist/server/services/db.d.ts +93 -0
- package/dist/server/services/db.d.ts.map +1 -0
- package/dist/server/services/db.js +519 -0
- package/dist/server/services/db.js.map +1 -0
- package/dist/server/services/imports.d.ts +37 -0
- package/dist/server/services/imports.d.ts.map +1 -0
- package/dist/server/services/imports.js +324 -0
- package/dist/server/services/imports.js.map +1 -0
- package/dist/server/services/index.d.ts +36 -0
- package/dist/server/services/index.d.ts.map +1 -0
- package/dist/server/services/index.js +57 -0
- package/dist/server/services/index.js.map +1 -0
- package/dist/server/services/intake.d.ts +47 -0
- package/dist/server/services/intake.d.ts.map +1 -0
- package/dist/server/services/intake.js +268 -0
- package/dist/server/services/intake.js.map +1 -0
- package/dist/server/services/issues.d.ts +763 -0
- package/dist/server/services/issues.d.ts.map +1 -0
- package/dist/server/services/issues.js +1381 -0
- package/dist/server/services/issues.js.map +1 -0
- package/dist/server/services/notify.d.ts +51 -0
- package/dist/server/services/notify.d.ts.map +1 -0
- package/dist/server/services/notify.js +90 -0
- package/dist/server/services/notify.js.map +1 -0
- package/dist/server/services/planning.d.ts +62 -0
- package/dist/server/services/planning.d.ts.map +1 -0
- package/dist/server/services/planning.js +614 -0
- package/dist/server/services/planning.js.map +1 -0
- package/dist/server/services/projects.d.ts +43 -0
- package/dist/server/services/projects.d.ts.map +1 -0
- package/dist/server/services/projects.js +375 -0
- package/dist/server/services/projects.js.map +1 -0
- package/dist/server/services/query.d.ts +24 -0
- package/dist/server/services/query.d.ts.map +1 -0
- package/dist/server/services/query.js +312 -0
- package/dist/server/services/query.js.map +1 -0
- package/dist/server/services/reports.d.ts +30 -0
- package/dist/server/services/reports.d.ts.map +1 -0
- package/dist/server/services/reports.js +295 -0
- package/dist/server/services/reports.js.map +1 -0
- package/dist/server/services/time.d.ts +53 -0
- package/dist/server/services/time.d.ts.map +1 -0
- package/dist/server/services/time.js +192 -0
- package/dist/server/services/time.js.map +1 -0
- package/dist/server/services/transitions.d.ts +61 -0
- package/dist/server/services/transitions.d.ts.map +1 -0
- package/dist/server/services/transitions.js +493 -0
- package/dist/server/services/transitions.js.map +1 -0
- package/dist/server/services/views.d.ts +33 -0
- package/dist/server/services/views.d.ts.map +1 -0
- package/dist/server/services/views.js +195 -0
- package/dist/server/services/views.js.map +1 -0
- package/migrations/0000_init.sql +529 -0
- package/migrations/0001_rls.sql +259 -0
- package/migrations/meta/0000_snapshot.json +4140 -0
- package/migrations/meta/_journal.json +20 -0
- package/package.json +82 -0
- package/src/client/api.ts +15 -0
- package/src/client/format.ts +164 -0
- package/src/client/group.ts +150 -0
- package/src/client/index.ts +60 -0
- package/src/client/kql.ts +492 -0
- package/src/client/rank.ts +87 -0
- package/src/client/types.ts +57 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/server/schema.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,MAAM,uDAA0B,CAAA;AAU7C;;;;GAIG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGrB,CAAA;AAMF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BpB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAa,ifAiChB,CAAA"}
|
|
@@ -0,0 +1,581 @@
|
|
|
1
|
+
import { sql } from 'drizzle-orm';
|
|
2
|
+
import { boolean, customType, date, doublePrecision, index, integer, jsonb, pgSchema, primaryKey, text, timestamp, uniqueIndex, uuid, } from 'drizzle-orm/pg-core';
|
|
3
|
+
// `pgSchema` directly (not `moduleSchema` from @kernhq/kernel) so drizzle-kit can load this file standalone
|
|
4
|
+
export const schema = pgSchema('mod_tracker');
|
|
5
|
+
const tsvector = customType({ dataType: () => 'tsvector' });
|
|
6
|
+
const ts = (name) => timestamp(name, { withTimezone: true });
|
|
7
|
+
const id = () => uuid('id').primaryKey().default(sql `uuidv7()`);
|
|
8
|
+
const ws = () => uuid('workspace_id').notNull();
|
|
9
|
+
const uuidArray = (name) => uuid(name).array().notNull().default(sql `'{}'::uuid[]`);
|
|
10
|
+
const jsonObject = (name) => jsonb(name).notNull().default(sql `'{}'::jsonb`);
|
|
11
|
+
const jsonArray = (name) => jsonb(name).notNull().default(sql `'[]'::jsonb`);
|
|
12
|
+
/**
|
|
13
|
+
* Workspaces the tracker is active in. Deliberately **not** a tenant table: it holds nothing but ids,
|
|
14
|
+
* and the scheduled jobs (due dates, recurring issues, cycle roll-over, SLA clocks) need to enumerate
|
|
15
|
+
* tenants before they can open an RLS-bound transaction per workspace.
|
|
16
|
+
*/
|
|
17
|
+
export const workspaces = schema.table('workspaces', {
|
|
18
|
+
workspaceId: uuid('workspace_id').primaryKey(),
|
|
19
|
+
createdAt: ts('created_at').notNull().defaultNow(),
|
|
20
|
+
});
|
|
21
|
+
// =====================================================================================
|
|
22
|
+
// projects
|
|
23
|
+
// =====================================================================================
|
|
24
|
+
export const projects = schema.table('projects', {
|
|
25
|
+
id: id(),
|
|
26
|
+
workspaceId: ws(),
|
|
27
|
+
key: text('key').notNull(),
|
|
28
|
+
name: text('name').notNull(),
|
|
29
|
+
description: text('description'),
|
|
30
|
+
icon: text('icon'),
|
|
31
|
+
color: text('color'),
|
|
32
|
+
leadId: uuid('lead_id'),
|
|
33
|
+
visibility: text('visibility').notNull().default('workspace'), // workspace | private
|
|
34
|
+
defaultAssignee: text('default_assignee').notNull().default('unassigned'), // unassigned | lead
|
|
35
|
+
workflowSchemeId: uuid('workflow_scheme_id'),
|
|
36
|
+
typeSchemeId: uuid('type_scheme_id'),
|
|
37
|
+
fieldSchemeId: uuid('field_scheme_id'),
|
|
38
|
+
settings: jsonObject('settings'),
|
|
39
|
+
/** public intake form token; null disables the form */
|
|
40
|
+
intakeToken: text('intake_token'),
|
|
41
|
+
memberCount: integer('member_count').notNull().default(0),
|
|
42
|
+
archivedAt: ts('archived_at'),
|
|
43
|
+
createdBy: uuid('created_by'),
|
|
44
|
+
createdAt: ts('created_at').notNull().defaultNow(),
|
|
45
|
+
updatedAt: ts('updated_at').notNull().defaultNow(),
|
|
46
|
+
}, (t) => [
|
|
47
|
+
uniqueIndex('projects_ws_key_uq').on(t.workspaceId, t.key),
|
|
48
|
+
uniqueIndex('projects_intake_token_uq').on(t.intakeToken).where(sql `intake_token is not null`),
|
|
49
|
+
index('projects_ws_idx').on(t.workspaceId, t.archivedAt),
|
|
50
|
+
]);
|
|
51
|
+
/**
|
|
52
|
+
* Public intake tokens. Like `workspaces` this is deliberately not a tenant table: the public intake
|
|
53
|
+
* form and inbound email arrive with nothing but a token, so the token has to be resolvable to a
|
|
54
|
+
* workspace *before* an RLS-bound transaction can be opened. It holds no tenant content.
|
|
55
|
+
*/
|
|
56
|
+
export const intakeTokens = schema.table('intake_tokens', {
|
|
57
|
+
token: text('token').primaryKey(),
|
|
58
|
+
workspaceId: uuid('workspace_id').notNull(),
|
|
59
|
+
projectId: uuid('project_id').notNull(),
|
|
60
|
+
createdAt: ts('created_at').notNull().defaultNow(),
|
|
61
|
+
});
|
|
62
|
+
/**
|
|
63
|
+
* Per-project sequence generators. Kept out of `projects` so allocating an issue key locks one narrow
|
|
64
|
+
* row instead of the project itself (`update … returning` serialises concurrent creates per project).
|
|
65
|
+
*/
|
|
66
|
+
export const issueCounters = schema.table('issue_counters', {
|
|
67
|
+
projectId: uuid('project_id').primaryKey(),
|
|
68
|
+
workspaceId: ws(),
|
|
69
|
+
lastIssueNumber: integer('last_issue_number').notNull().default(0),
|
|
70
|
+
lastCycleNumber: integer('last_cycle_number').notNull().default(0),
|
|
71
|
+
});
|
|
72
|
+
export const projectMembers = schema.table('project_members', {
|
|
73
|
+
projectId: uuid('project_id').notNull(),
|
|
74
|
+
workspaceId: ws(),
|
|
75
|
+
userId: uuid('user_id').notNull(),
|
|
76
|
+
role: text('role').notNull().default('member'), // admin | member | viewer
|
|
77
|
+
addedBy: uuid('added_by'),
|
|
78
|
+
addedAt: ts('added_at').notNull().defaultNow(),
|
|
79
|
+
}, (t) => [
|
|
80
|
+
primaryKey({ columns: [t.projectId, t.userId] }),
|
|
81
|
+
index('project_members_ws_user_idx').on(t.workspaceId, t.userId),
|
|
82
|
+
]);
|
|
83
|
+
export const projectTemplates = schema.table('project_templates', {
|
|
84
|
+
id: id(),
|
|
85
|
+
workspaceId: ws(),
|
|
86
|
+
key: text('key').notNull(),
|
|
87
|
+
name: text('name').notNull(),
|
|
88
|
+
description: text('description'),
|
|
89
|
+
icon: text('icon'),
|
|
90
|
+
body: jsonObject('body'),
|
|
91
|
+
builtin: boolean('builtin').notNull().default(false),
|
|
92
|
+
createdAt: ts('created_at').notNull().defaultNow(),
|
|
93
|
+
}, (t) => [uniqueIndex('project_templates_ws_key_uq').on(t.workspaceId, t.key)]);
|
|
94
|
+
// =====================================================================================
|
|
95
|
+
// work item types, custom fields, workflows
|
|
96
|
+
// =====================================================================================
|
|
97
|
+
export const workItemTypes = schema.table('work_item_types', {
|
|
98
|
+
id: id(),
|
|
99
|
+
workspaceId: ws(),
|
|
100
|
+
/** null = workspace-level type shared by every project */
|
|
101
|
+
projectId: uuid('project_id'),
|
|
102
|
+
key: text('key').notNull(),
|
|
103
|
+
name: text('name').notNull(),
|
|
104
|
+
description: text('description'),
|
|
105
|
+
icon: text('icon'),
|
|
106
|
+
color: text('color'),
|
|
107
|
+
level: integer('level').notNull().default(0),
|
|
108
|
+
isDefault: boolean('is_default').notNull().default(false),
|
|
109
|
+
workflowId: uuid('workflow_id'),
|
|
110
|
+
fieldLayout: jsonArray('field_layout'),
|
|
111
|
+
templateBody: jsonb('template_body'),
|
|
112
|
+
order: integer('order').notNull().default(0),
|
|
113
|
+
archivedAt: ts('archived_at'),
|
|
114
|
+
createdAt: ts('created_at').notNull().defaultNow(),
|
|
115
|
+
updatedAt: ts('updated_at').notNull().defaultNow(),
|
|
116
|
+
}, (t) => [
|
|
117
|
+
uniqueIndex('work_item_types_ws_project_key_uq')
|
|
118
|
+
.on(t.workspaceId, t.projectId, t.key)
|
|
119
|
+
.where(sql `project_id is not null`),
|
|
120
|
+
uniqueIndex('work_item_types_ws_key_uq').on(t.workspaceId, t.key).where(sql `project_id is null`),
|
|
121
|
+
index('work_item_types_ws_idx').on(t.workspaceId, t.projectId, t.order),
|
|
122
|
+
]);
|
|
123
|
+
export const typeSchemes = schema.table('type_schemes', {
|
|
124
|
+
id: id(),
|
|
125
|
+
workspaceId: ws(),
|
|
126
|
+
name: text('name').notNull(),
|
|
127
|
+
typeIds: uuidArray('type_ids'),
|
|
128
|
+
defaultTypeId: uuid('default_type_id'),
|
|
129
|
+
createdAt: ts('created_at').notNull().defaultNow(),
|
|
130
|
+
}, (t) => [index('type_schemes_ws_idx').on(t.workspaceId, t.createdAt)]);
|
|
131
|
+
/** Per-workspace parenting rules (one row per workspace). */
|
|
132
|
+
export const hierarchyRules = schema.table('hierarchy_rules', {
|
|
133
|
+
workspaceId: uuid('workspace_id').primaryKey(),
|
|
134
|
+
rules: jsonObject('rules'),
|
|
135
|
+
updatedAt: ts('updated_at').notNull().defaultNow(),
|
|
136
|
+
});
|
|
137
|
+
export const fieldDefs = schema.table('field_defs', {
|
|
138
|
+
id: id(),
|
|
139
|
+
workspaceId: ws(),
|
|
140
|
+
projectId: uuid('project_id'),
|
|
141
|
+
key: text('key').notNull(),
|
|
142
|
+
name: text('name').notNull(),
|
|
143
|
+
description: text('description'),
|
|
144
|
+
type: text('type').notNull(),
|
|
145
|
+
options: jsonArray('options'),
|
|
146
|
+
defaultValue: jsonb('default_value'),
|
|
147
|
+
config: jsonObject('config'),
|
|
148
|
+
searchable: boolean('searchable').notNull().default(false),
|
|
149
|
+
required: boolean('required').notNull().default(false),
|
|
150
|
+
showInCards: boolean('show_in_cards').notNull().default(false),
|
|
151
|
+
order: integer('order').notNull().default(0),
|
|
152
|
+
archivedAt: ts('archived_at'),
|
|
153
|
+
createdAt: ts('created_at').notNull().defaultNow(),
|
|
154
|
+
updatedAt: ts('updated_at').notNull().defaultNow(),
|
|
155
|
+
}, (t) => [
|
|
156
|
+
uniqueIndex('field_defs_ws_project_key_uq')
|
|
157
|
+
.on(t.workspaceId, t.projectId, t.key)
|
|
158
|
+
.where(sql `project_id is not null`),
|
|
159
|
+
uniqueIndex('field_defs_ws_key_uq').on(t.workspaceId, t.key).where(sql `project_id is null`),
|
|
160
|
+
index('field_defs_ws_idx').on(t.workspaceId, t.projectId, t.order),
|
|
161
|
+
]);
|
|
162
|
+
export const fieldSchemes = schema.table('field_schemes', {
|
|
163
|
+
id: id(),
|
|
164
|
+
workspaceId: ws(),
|
|
165
|
+
name: text('name').notNull(),
|
|
166
|
+
fieldIds: uuidArray('field_ids'),
|
|
167
|
+
createdAt: ts('created_at').notNull().defaultNow(),
|
|
168
|
+
}, (t) => [index('field_schemes_ws_idx').on(t.workspaceId, t.createdAt)]);
|
|
169
|
+
export const workflows = schema.table('workflows', {
|
|
170
|
+
id: id(),
|
|
171
|
+
workspaceId: ws(),
|
|
172
|
+
projectId: uuid('project_id'),
|
|
173
|
+
name: text('name').notNull(),
|
|
174
|
+
description: text('description'),
|
|
175
|
+
definition: jsonObject('definition'),
|
|
176
|
+
isDefault: boolean('is_default').notNull().default(false),
|
|
177
|
+
archivedAt: ts('archived_at'),
|
|
178
|
+
createdAt: ts('created_at').notNull().defaultNow(),
|
|
179
|
+
updatedAt: ts('updated_at').notNull().defaultNow(),
|
|
180
|
+
}, (t) => [index('workflows_ws_idx').on(t.workspaceId, t.projectId, t.archivedAt)]);
|
|
181
|
+
export const workflowSchemes = schema.table('workflow_schemes', {
|
|
182
|
+
id: id(),
|
|
183
|
+
workspaceId: ws(),
|
|
184
|
+
name: text('name').notNull(),
|
|
185
|
+
defaultWorkflowId: uuid('default_workflow_id').notNull(),
|
|
186
|
+
mappings: jsonArray('mappings'),
|
|
187
|
+
createdAt: ts('created_at').notNull().defaultNow(),
|
|
188
|
+
updatedAt: ts('updated_at').notNull().defaultNow(),
|
|
189
|
+
}, (t) => [index('workflow_schemes_ws_idx').on(t.workspaceId, t.createdAt)]);
|
|
190
|
+
// =====================================================================================
|
|
191
|
+
// issues
|
|
192
|
+
// =====================================================================================
|
|
193
|
+
export const issues = schema.table('issues', {
|
|
194
|
+
id: id(),
|
|
195
|
+
workspaceId: ws(),
|
|
196
|
+
projectId: uuid('project_id').notNull(),
|
|
197
|
+
key: text('key').notNull(),
|
|
198
|
+
number: integer('number').notNull(),
|
|
199
|
+
typeId: uuid('type_id').notNull(),
|
|
200
|
+
title: text('title').notNull(),
|
|
201
|
+
description: jsonb('description'),
|
|
202
|
+
descriptionText: text('description_text').notNull().default(''),
|
|
203
|
+
statusId: text('status_id').notNull(),
|
|
204
|
+
statusCategory: text('status_category').notNull(),
|
|
205
|
+
priority: text('priority').notNull().default('none'),
|
|
206
|
+
assigneeIds: uuidArray('assignee_ids'),
|
|
207
|
+
reporterId: uuid('reporter_id'),
|
|
208
|
+
creatorId: uuid('creator_id'),
|
|
209
|
+
labelIds: uuidArray('label_ids'),
|
|
210
|
+
componentIds: uuidArray('component_ids'),
|
|
211
|
+
versionIds: uuidArray('version_ids'),
|
|
212
|
+
affectsVersionIds: uuidArray('affects_version_ids'),
|
|
213
|
+
cycleId: uuid('cycle_id'),
|
|
214
|
+
milestoneId: uuid('milestone_id'),
|
|
215
|
+
parentId: uuid('parent_id'),
|
|
216
|
+
/** fractional index (base-62) for manual ordering in backlogs and boards */
|
|
217
|
+
rank: text('rank').notNull(),
|
|
218
|
+
estimate: doublePrecision('estimate'),
|
|
219
|
+
estimateUnit: text('estimate_unit').notNull().default('points'),
|
|
220
|
+
startDate: date('start_date', { mode: 'string' }),
|
|
221
|
+
dueDate: date('due_date', { mode: 'string' }),
|
|
222
|
+
completedAt: ts('completed_at'),
|
|
223
|
+
cancelledAt: ts('cancelled_at'),
|
|
224
|
+
resolution: text('resolution'),
|
|
225
|
+
/** custom field values keyed by field key */
|
|
226
|
+
custom: jsonObject('custom'),
|
|
227
|
+
watcherIds: uuidArray('watcher_ids'),
|
|
228
|
+
commentCount: integer('comment_count').notNull().default(0),
|
|
229
|
+
attachmentCount: integer('attachment_count').notNull().default(0),
|
|
230
|
+
timeSpentSec: integer('time_spent_sec').notNull().default(0),
|
|
231
|
+
remainingSec: integer('remaining_sec'),
|
|
232
|
+
originalEstimateSec: integer('original_estimate_sec'),
|
|
233
|
+
sla: jsonb('sla'),
|
|
234
|
+
triage: boolean('triage').notNull().default(false),
|
|
235
|
+
snoozedUntil: ts('snoozed_until'),
|
|
236
|
+
source: text('source').notNull().default('app'),
|
|
237
|
+
externalRef: text('external_ref'),
|
|
238
|
+
chatChannelId: uuid('chat_channel_id'),
|
|
239
|
+
archivedAt: ts('archived_at'),
|
|
240
|
+
createdAt: ts('created_at').notNull().defaultNow(),
|
|
241
|
+
updatedAt: ts('updated_at').notNull().defaultNow(),
|
|
242
|
+
lastActivityAt: ts('last_activity_at').notNull().defaultNow(),
|
|
243
|
+
search: tsvector('search').generatedAlwaysAs(sql `to_tsvector('simple', coalesce(title, '') || ' ' || coalesce(description_text, ''))`),
|
|
244
|
+
}, (t) => [
|
|
245
|
+
uniqueIndex('issues_ws_key_uq').on(t.workspaceId, t.key),
|
|
246
|
+
uniqueIndex('issues_project_number_uq').on(t.projectId, t.number),
|
|
247
|
+
index('issues_ws_project_rank_idx').on(t.workspaceId, t.projectId, t.rank),
|
|
248
|
+
index('issues_ws_project_status_idx').on(t.workspaceId, t.projectId, t.statusId),
|
|
249
|
+
index('issues_ws_updated_idx').on(t.workspaceId, t.updatedAt),
|
|
250
|
+
index('issues_ws_cycle_idx').on(t.workspaceId, t.cycleId).where(sql `cycle_id is not null`),
|
|
251
|
+
index('issues_ws_parent_idx').on(t.workspaceId, t.parentId).where(sql `parent_id is not null`),
|
|
252
|
+
index('issues_ws_due_idx').on(t.workspaceId, t.dueDate).where(sql `due_date is not null`),
|
|
253
|
+
index('issues_ws_triage_idx').on(t.workspaceId, t.projectId).where(sql `triage`),
|
|
254
|
+
index('issues_external_ref_idx').on(t.workspaceId, t.externalRef).where(sql `external_ref is not null`),
|
|
255
|
+
index('issues_assignees_idx').using('gin', t.assigneeIds),
|
|
256
|
+
index('issues_labels_idx').using('gin', t.labelIds),
|
|
257
|
+
index('issues_components_idx').using('gin', t.componentIds),
|
|
258
|
+
index('issues_versions_idx').using('gin', t.versionIds),
|
|
259
|
+
index('issues_watchers_idx').using('gin', t.watcherIds),
|
|
260
|
+
index('issues_custom_idx').using('gin', t.custom),
|
|
261
|
+
index('issues_search_idx').using('gin', t.search),
|
|
262
|
+
]);
|
|
263
|
+
export const comments = schema.table('comments', {
|
|
264
|
+
id: id(),
|
|
265
|
+
workspaceId: ws(),
|
|
266
|
+
issueId: uuid('issue_id').notNull(),
|
|
267
|
+
parentId: uuid('parent_id'),
|
|
268
|
+
authorId: uuid('author_id'),
|
|
269
|
+
body: jsonObject('body'),
|
|
270
|
+
bodyText: text('body_text').notNull().default(''),
|
|
271
|
+
mentionIds: uuidArray('mention_ids'),
|
|
272
|
+
internal: boolean('internal').notNull().default(false),
|
|
273
|
+
source: text('source').notNull().default('app'),
|
|
274
|
+
replyCount: integer('reply_count').notNull().default(0),
|
|
275
|
+
editedAt: ts('edited_at'),
|
|
276
|
+
deletedAt: ts('deleted_at'),
|
|
277
|
+
createdAt: ts('created_at').notNull().defaultNow(),
|
|
278
|
+
updatedAt: ts('updated_at').notNull().defaultNow(),
|
|
279
|
+
search: tsvector('search').generatedAlwaysAs(sql `to_tsvector('simple', coalesce(body_text, ''))`),
|
|
280
|
+
}, (t) => [
|
|
281
|
+
index('comments_issue_idx').on(t.issueId, t.createdAt),
|
|
282
|
+
index('comments_thread_idx').on(t.parentId, t.createdAt).where(sql `parent_id is not null`),
|
|
283
|
+
index('comments_search_idx').using('gin', t.search),
|
|
284
|
+
]);
|
|
285
|
+
export const commentReactions = schema.table('comment_reactions', {
|
|
286
|
+
commentId: uuid('comment_id').notNull(),
|
|
287
|
+
workspaceId: ws(),
|
|
288
|
+
userId: uuid('user_id').notNull(),
|
|
289
|
+
emoji: text('emoji').notNull(),
|
|
290
|
+
createdAt: ts('created_at').notNull().defaultNow(),
|
|
291
|
+
}, (t) => [primaryKey({ columns: [t.commentId, t.userId, t.emoji] })]);
|
|
292
|
+
export const relations = schema.table('relations', {
|
|
293
|
+
id: id(),
|
|
294
|
+
workspaceId: ws(),
|
|
295
|
+
type: text('type').notNull(),
|
|
296
|
+
fromIssueId: uuid('from_issue_id').notNull(),
|
|
297
|
+
toIssueId: uuid('to_issue_id').notNull(),
|
|
298
|
+
createdBy: uuid('created_by'),
|
|
299
|
+
createdAt: ts('created_at').notNull().defaultNow(),
|
|
300
|
+
}, (t) => [
|
|
301
|
+
uniqueIndex('relations_edge_uq').on(t.fromIssueId, t.toIssueId, t.type),
|
|
302
|
+
index('relations_to_idx').on(t.toIssueId),
|
|
303
|
+
]);
|
|
304
|
+
export const attachments = schema.table('attachments', {
|
|
305
|
+
id: id(),
|
|
306
|
+
workspaceId: ws(),
|
|
307
|
+
issueId: uuid('issue_id').notNull(),
|
|
308
|
+
fileId: uuid('file_id').notNull(),
|
|
309
|
+
name: text('name').notNull(),
|
|
310
|
+
mimeType: text('mime_type').notNull().default('application/octet-stream'),
|
|
311
|
+
size: integer('size').notNull().default(0),
|
|
312
|
+
uploadedBy: uuid('uploaded_by'),
|
|
313
|
+
createdAt: ts('created_at').notNull().defaultNow(),
|
|
314
|
+
}, (t) => [
|
|
315
|
+
uniqueIndex('attachments_issue_file_uq').on(t.issueId, t.fileId),
|
|
316
|
+
index('attachments_issue_idx').on(t.issueId, t.createdAt),
|
|
317
|
+
]);
|
|
318
|
+
export const links = schema.table('links', {
|
|
319
|
+
id: id(),
|
|
320
|
+
workspaceId: ws(),
|
|
321
|
+
issueId: uuid('issue_id').notNull(),
|
|
322
|
+
url: text('url').notNull(),
|
|
323
|
+
title: text('title'),
|
|
324
|
+
kind: text('kind').notNull().default('generic'),
|
|
325
|
+
createdBy: uuid('created_by'),
|
|
326
|
+
createdAt: ts('created_at').notNull().defaultNow(),
|
|
327
|
+
}, (t) => [index('links_issue_idx').on(t.issueId, t.createdAt)]);
|
|
328
|
+
/** Field-level history. Mirrored into `core.activity` but kept locally so history reads stay in one schema. */
|
|
329
|
+
export const issueHistory = schema.table('issue_history', {
|
|
330
|
+
id: id(),
|
|
331
|
+
workspaceId: ws(),
|
|
332
|
+
issueId: uuid('issue_id').notNull(),
|
|
333
|
+
actorId: uuid('actor_id'),
|
|
334
|
+
action: text('action').notNull(),
|
|
335
|
+
changes: jsonArray('changes'),
|
|
336
|
+
data: jsonObject('data'),
|
|
337
|
+
occurredAt: ts('occurred_at').notNull().defaultNow(),
|
|
338
|
+
}, (t) => [index('issue_history_issue_idx').on(t.issueId, t.occurredAt)]);
|
|
339
|
+
/** Status transitions with the time spent in the previous status: the source of CFD and cycle-time reports. */
|
|
340
|
+
export const issueStatusHistory = schema.table('issue_status_history', {
|
|
341
|
+
id: id(),
|
|
342
|
+
workspaceId: ws(),
|
|
343
|
+
issueId: uuid('issue_id').notNull(),
|
|
344
|
+
projectId: uuid('project_id').notNull(),
|
|
345
|
+
fromStatusId: text('from_status_id'),
|
|
346
|
+
toStatusId: text('to_status_id').notNull(),
|
|
347
|
+
fromCategory: text('from_category'),
|
|
348
|
+
toCategory: text('to_category').notNull(),
|
|
349
|
+
actorId: uuid('actor_id'),
|
|
350
|
+
transitionId: text('transition_id'),
|
|
351
|
+
durationSec: integer('duration_sec'),
|
|
352
|
+
occurredAt: ts('occurred_at').notNull().defaultNow(),
|
|
353
|
+
}, (t) => [
|
|
354
|
+
index('issue_status_history_issue_idx').on(t.issueId, t.occurredAt),
|
|
355
|
+
index('issue_status_history_project_idx').on(t.projectId, t.occurredAt),
|
|
356
|
+
]);
|
|
357
|
+
export const issueApprovals = schema.table('issue_approvals', {
|
|
358
|
+
id: id(),
|
|
359
|
+
workspaceId: ws(),
|
|
360
|
+
issueId: uuid('issue_id').notNull(),
|
|
361
|
+
transitionId: text('transition_id').notNull(),
|
|
362
|
+
state: jsonObject('state'),
|
|
363
|
+
createdAt: ts('created_at').notNull().defaultNow(),
|
|
364
|
+
updatedAt: ts('updated_at').notNull().defaultNow(),
|
|
365
|
+
}, (t) => [uniqueIndex('issue_approvals_issue_transition_uq').on(t.issueId, t.transitionId)]);
|
|
366
|
+
export const issueTemplates = schema.table('issue_templates', {
|
|
367
|
+
id: id(),
|
|
368
|
+
workspaceId: ws(),
|
|
369
|
+
projectId: uuid('project_id'),
|
|
370
|
+
name: text('name').notNull(),
|
|
371
|
+
description: text('description'),
|
|
372
|
+
typeId: uuid('type_id'),
|
|
373
|
+
defaults: jsonObject('defaults'),
|
|
374
|
+
subItems: jsonArray('sub_items'),
|
|
375
|
+
createdBy: uuid('created_by'),
|
|
376
|
+
createdAt: ts('created_at').notNull().defaultNow(),
|
|
377
|
+
updatedAt: ts('updated_at').notNull().defaultNow(),
|
|
378
|
+
}, (t) => [index('issue_templates_ws_idx').on(t.workspaceId, t.projectId)]);
|
|
379
|
+
export const recurringIssues = schema.table('recurring_issues', {
|
|
380
|
+
id: id(),
|
|
381
|
+
workspaceId: ws(),
|
|
382
|
+
projectId: uuid('project_id').notNull(),
|
|
383
|
+
name: text('name').notNull(),
|
|
384
|
+
rule: jsonObject('rule'),
|
|
385
|
+
defaults: jsonObject('defaults'),
|
|
386
|
+
enabled: boolean('enabled').notNull().default(true),
|
|
387
|
+
nextRunAt: ts('next_run_at'),
|
|
388
|
+
lastRunAt: ts('last_run_at'),
|
|
389
|
+
lastIssueId: uuid('last_issue_id'),
|
|
390
|
+
runCount: integer('run_count').notNull().default(0),
|
|
391
|
+
createdBy: uuid('created_by'),
|
|
392
|
+
createdAt: ts('created_at').notNull().defaultNow(),
|
|
393
|
+
updatedAt: ts('updated_at').notNull().defaultNow(),
|
|
394
|
+
}, (t) => [
|
|
395
|
+
index('recurring_issues_project_idx').on(t.projectId),
|
|
396
|
+
index('recurring_issues_due_idx').on(t.nextRunAt).where(sql `enabled`),
|
|
397
|
+
]);
|
|
398
|
+
// =====================================================================================
|
|
399
|
+
// planning
|
|
400
|
+
// =====================================================================================
|
|
401
|
+
export const cycles = schema.table('cycles', {
|
|
402
|
+
id: id(),
|
|
403
|
+
workspaceId: ws(),
|
|
404
|
+
projectId: uuid('project_id').notNull(),
|
|
405
|
+
number: integer('number').notNull(),
|
|
406
|
+
name: text('name').notNull(),
|
|
407
|
+
goal: text('goal'),
|
|
408
|
+
startAt: ts('start_at').notNull(),
|
|
409
|
+
endAt: ts('end_at').notNull(),
|
|
410
|
+
status: text('status').notNull().default('upcoming'), // upcoming | active | completed
|
|
411
|
+
startedAt: ts('started_at'),
|
|
412
|
+
completedAt: ts('completed_at'),
|
|
413
|
+
carryOverCount: integer('carry_over_count').notNull().default(0),
|
|
414
|
+
/** scope snapshot taken when the cycle started (committed work, for velocity) */
|
|
415
|
+
committed: jsonObject('committed'),
|
|
416
|
+
createdAt: ts('created_at').notNull().defaultNow(),
|
|
417
|
+
updatedAt: ts('updated_at').notNull().defaultNow(),
|
|
418
|
+
}, (t) => [
|
|
419
|
+
uniqueIndex('cycles_project_number_uq').on(t.projectId, t.number),
|
|
420
|
+
index('cycles_project_status_idx').on(t.projectId, t.status, t.startAt),
|
|
421
|
+
]);
|
|
422
|
+
export const milestones = schema.table('milestones', {
|
|
423
|
+
id: id(),
|
|
424
|
+
workspaceId: ws(),
|
|
425
|
+
projectId: uuid('project_id').notNull(),
|
|
426
|
+
name: text('name').notNull(),
|
|
427
|
+
description: text('description'),
|
|
428
|
+
targetDate: date('target_date', { mode: 'string' }),
|
|
429
|
+
status: text('status').notNull().default('open'),
|
|
430
|
+
completedAt: ts('completed_at'),
|
|
431
|
+
createdAt: ts('created_at').notNull().defaultNow(),
|
|
432
|
+
updatedAt: ts('updated_at').notNull().defaultNow(),
|
|
433
|
+
}, (t) => [index('milestones_project_idx').on(t.projectId, t.targetDate)]);
|
|
434
|
+
export const versions = schema.table('versions', {
|
|
435
|
+
id: id(),
|
|
436
|
+
workspaceId: ws(),
|
|
437
|
+
projectId: uuid('project_id').notNull(),
|
|
438
|
+
name: text('name').notNull(),
|
|
439
|
+
description: text('description'),
|
|
440
|
+
status: text('status').notNull().default('unreleased'),
|
|
441
|
+
startDate: date('start_date', { mode: 'string' }),
|
|
442
|
+
releaseDate: date('release_date', { mode: 'string' }),
|
|
443
|
+
releasedAt: ts('released_at'),
|
|
444
|
+
order: integer('order').notNull().default(0),
|
|
445
|
+
createdAt: ts('created_at').notNull().defaultNow(),
|
|
446
|
+
updatedAt: ts('updated_at').notNull().defaultNow(),
|
|
447
|
+
}, (t) => [index('versions_project_idx').on(t.projectId, t.order)]);
|
|
448
|
+
export const components = schema.table('components', {
|
|
449
|
+
id: id(),
|
|
450
|
+
workspaceId: ws(),
|
|
451
|
+
projectId: uuid('project_id').notNull(),
|
|
452
|
+
name: text('name').notNull(),
|
|
453
|
+
description: text('description'),
|
|
454
|
+
leadId: uuid('lead_id'),
|
|
455
|
+
defaultAssignee: text('default_assignee').notNull().default('project'),
|
|
456
|
+
createdAt: ts('created_at').notNull().defaultNow(),
|
|
457
|
+
updatedAt: ts('updated_at').notNull().defaultNow(),
|
|
458
|
+
}, (t) => [uniqueIndex('components_project_name_uq').on(t.projectId, t.name)]);
|
|
459
|
+
export const labels = schema.table('labels', {
|
|
460
|
+
id: id(),
|
|
461
|
+
workspaceId: ws(),
|
|
462
|
+
projectId: uuid('project_id'),
|
|
463
|
+
name: text('name').notNull(),
|
|
464
|
+
color: text('color'),
|
|
465
|
+
description: text('description'),
|
|
466
|
+
/** labels sharing a group are mutually exclusive on an issue */
|
|
467
|
+
groupName: text('group_name'),
|
|
468
|
+
archivedAt: ts('archived_at'),
|
|
469
|
+
createdAt: ts('created_at').notNull().defaultNow(),
|
|
470
|
+
}, (t) => [
|
|
471
|
+
uniqueIndex('labels_project_name_uq').on(t.projectId, t.name).where(sql `project_id is not null`),
|
|
472
|
+
uniqueIndex('labels_ws_name_uq').on(t.workspaceId, t.name).where(sql `project_id is null`),
|
|
473
|
+
index('labels_ws_idx').on(t.workspaceId, t.projectId),
|
|
474
|
+
]);
|
|
475
|
+
// =====================================================================================
|
|
476
|
+
// views, time tracking, imports
|
|
477
|
+
// =====================================================================================
|
|
478
|
+
export const views = schema.table('views', {
|
|
479
|
+
id: id(),
|
|
480
|
+
workspaceId: ws(),
|
|
481
|
+
projectId: uuid('project_id'),
|
|
482
|
+
name: text('name').notNull(),
|
|
483
|
+
description: text('description'),
|
|
484
|
+
icon: text('icon'),
|
|
485
|
+
kql: text('kql').notNull().default(''),
|
|
486
|
+
layout: text('layout').notNull().default('list'),
|
|
487
|
+
display: jsonObject('display'),
|
|
488
|
+
filters: jsonObject('filters'),
|
|
489
|
+
visibility: text('visibility').notNull().default('private'),
|
|
490
|
+
ownerId: uuid('owner_id'),
|
|
491
|
+
builtin: boolean('builtin').notNull().default(false),
|
|
492
|
+
order: integer('order').notNull().default(0),
|
|
493
|
+
createdAt: ts('created_at').notNull().defaultNow(),
|
|
494
|
+
updatedAt: ts('updated_at').notNull().defaultNow(),
|
|
495
|
+
}, (t) => [index('views_ws_idx').on(t.workspaceId, t.projectId, t.order)]);
|
|
496
|
+
/** Sidebar pinning is per user, so it cannot live on the shared view row. */
|
|
497
|
+
export const viewPins = schema.table('view_pins', {
|
|
498
|
+
viewId: uuid('view_id').notNull(),
|
|
499
|
+
workspaceId: ws(),
|
|
500
|
+
userId: uuid('user_id').notNull(),
|
|
501
|
+
createdAt: ts('created_at').notNull().defaultNow(),
|
|
502
|
+
}, (t) => [
|
|
503
|
+
primaryKey({ columns: [t.viewId, t.userId] }),
|
|
504
|
+
index('view_pins_ws_user_idx').on(t.workspaceId, t.userId),
|
|
505
|
+
]);
|
|
506
|
+
export const worklogs = schema.table('worklogs', {
|
|
507
|
+
id: id(),
|
|
508
|
+
workspaceId: ws(),
|
|
509
|
+
projectId: uuid('project_id').notNull(),
|
|
510
|
+
issueId: uuid('issue_id').notNull(),
|
|
511
|
+
userId: uuid('user_id').notNull(),
|
|
512
|
+
startedAt: ts('started_at').notNull().defaultNow(),
|
|
513
|
+
durationSec: integer('duration_sec').notNull(),
|
|
514
|
+
note: text('note'),
|
|
515
|
+
billable: boolean('billable').notNull().default(false),
|
|
516
|
+
createdAt: ts('created_at').notNull().defaultNow(),
|
|
517
|
+
updatedAt: ts('updated_at').notNull().defaultNow(),
|
|
518
|
+
}, (t) => [
|
|
519
|
+
index('worklogs_issue_idx').on(t.issueId, t.startedAt),
|
|
520
|
+
index('worklogs_ws_user_started_idx').on(t.workspaceId, t.userId, t.startedAt),
|
|
521
|
+
index('worklogs_project_started_idx').on(t.projectId, t.startedAt),
|
|
522
|
+
]);
|
|
523
|
+
export const timers = schema.table('timers', {
|
|
524
|
+
id: id(),
|
|
525
|
+
workspaceId: ws(),
|
|
526
|
+
issueId: uuid('issue_id').notNull(),
|
|
527
|
+
userId: uuid('user_id').notNull(),
|
|
528
|
+
startedAt: ts('started_at').notNull().defaultNow(),
|
|
529
|
+
note: text('note'),
|
|
530
|
+
}, (t) => [uniqueIndex('timers_ws_user_uq').on(t.workspaceId, t.userId)]);
|
|
531
|
+
export const importJobs = schema.table('import_jobs', {
|
|
532
|
+
id: id(),
|
|
533
|
+
workspaceId: ws(),
|
|
534
|
+
projectId: uuid('project_id').notNull(),
|
|
535
|
+
source: text('source').notNull(),
|
|
536
|
+
fileId: uuid('file_id').notNull(),
|
|
537
|
+
mapping: jsonObject('mapping'),
|
|
538
|
+
status: text('status').notNull().default('pending'),
|
|
539
|
+
progress: jsonObject('progress'),
|
|
540
|
+
errors: jsonArray('errors'),
|
|
541
|
+
createdBy: uuid('created_by'),
|
|
542
|
+
startedAt: ts('started_at'),
|
|
543
|
+
finishedAt: ts('finished_at'),
|
|
544
|
+
createdAt: ts('created_at').notNull().defaultNow(),
|
|
545
|
+
}, (t) => [index('import_jobs_project_idx').on(t.projectId, t.createdAt)]);
|
|
546
|
+
/** Every table protected by the workspace RLS policy (see migrations/0001_rls.sql). */
|
|
547
|
+
export const TENANT_TABLES = [
|
|
548
|
+
'projects',
|
|
549
|
+
'issue_counters',
|
|
550
|
+
'project_members',
|
|
551
|
+
'project_templates',
|
|
552
|
+
'work_item_types',
|
|
553
|
+
'type_schemes',
|
|
554
|
+
'hierarchy_rules',
|
|
555
|
+
'field_defs',
|
|
556
|
+
'field_schemes',
|
|
557
|
+
'workflows',
|
|
558
|
+
'workflow_schemes',
|
|
559
|
+
'issues',
|
|
560
|
+
'comments',
|
|
561
|
+
'comment_reactions',
|
|
562
|
+
'relations',
|
|
563
|
+
'attachments',
|
|
564
|
+
'links',
|
|
565
|
+
'issue_history',
|
|
566
|
+
'issue_status_history',
|
|
567
|
+
'issue_approvals',
|
|
568
|
+
'issue_templates',
|
|
569
|
+
'recurring_issues',
|
|
570
|
+
'cycles',
|
|
571
|
+
'milestones',
|
|
572
|
+
'versions',
|
|
573
|
+
'components',
|
|
574
|
+
'labels',
|
|
575
|
+
'views',
|
|
576
|
+
'view_pins',
|
|
577
|
+
'worklogs',
|
|
578
|
+
'timers',
|
|
579
|
+
'import_jobs',
|
|
580
|
+
];
|
|
581
|
+
//# sourceMappingURL=schema.js.map
|