@storyshelf/db-postgres 0.6.2 → 0.7.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/README.md +56 -0
- package/dist/ddl.d.mts +1 -1
- package/dist/ddl.mjs +209 -13
- package/dist/ddl.mjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/migrate.mjs +83 -3
- package/dist/migrate.mjs.map +1 -1
- package/dist/neon-http.mjs +1 -1
- package/dist/neon-http.mjs.map +1 -1
- package/dist/neon.mjs +1 -1
- package/dist/neon.mjs.map +1 -1
- package/dist/pg.mjs +1 -1
- package/dist/pg.mjs.map +1 -1
- package/dist/pglite.mjs +2 -2
- package/dist/pglite.mjs.map +1 -1
- package/dist/schema/baseline.d.mts +54 -0
- package/dist/schema/baseline.mjs +4 -1
- package/dist/schema/baseline.mjs.map +1 -1
- package/dist/schema/{status-config.d.mts → build-component.d.mts} +42 -35
- package/dist/schema/build-component.mjs +25 -0
- package/dist/schema/build-component.mjs.map +1 -0
- package/dist/schema/build-review.d.mts +118 -0
- package/dist/schema/build-review.mjs +23 -0
- package/dist/schema/build-review.mjs.map +1 -0
- package/dist/schema/build.d.mts +38 -2
- package/dist/schema/build.mjs +3 -0
- package/dist/schema/build.mjs.map +1 -1
- package/dist/schema/capture-job.d.mts +330 -0
- package/dist/schema/capture-job.mjs +56 -0
- package/dist/schema/capture-job.mjs.map +1 -0
- package/dist/schema/capture-shard.d.mts +257 -0
- package/dist/schema/capture-shard.mjs +40 -0
- package/dist/schema/capture-shard.mjs.map +1 -0
- package/dist/schema/comment.d.mts +18 -0
- package/dist/schema/comment.mjs +3 -2
- package/dist/schema/comment.mjs.map +1 -1
- package/dist/schema/connection.d.mts +173 -0
- package/dist/schema/connection.mjs +35 -0
- package/dist/schema/connection.mjs.map +1 -0
- package/dist/schema/design.d.mts +589 -0
- package/dist/schema/design.mjs +73 -0
- package/dist/schema/design.mjs.map +1 -0
- package/dist/schema/insight.d.mts +633 -0
- package/dist/schema/insight.mjs +68 -0
- package/dist/schema/insight.mjs.map +1 -0
- package/dist/schema/notification.d.mts +36 -0
- package/dist/schema/notification.mjs +5 -0
- package/dist/schema/notification.mjs.map +1 -1
- package/dist/schema/project.d.mts +126 -0
- package/dist/schema/project.mjs +8 -1
- package/dist/schema/project.mjs.map +1 -1
- package/dist/schema/site-setting.d.mts +99 -0
- package/dist/schema/site-setting.mjs +23 -0
- package/dist/schema/site-setting.mjs.map +1 -0
- package/dist/schema/snapshot.d.mts +108 -0
- package/dist/schema/snapshot.mjs +11 -1
- package/dist/schema/snapshot.mjs.map +1 -1
- package/dist/schema/usage.d.mts +267 -0
- package/dist/schema/usage.mjs +36 -0
- package/dist/schema/usage.mjs.map +1 -0
- package/dist/schema.d.mts +24 -3
- package/dist/schema.mjs +25 -4
- package/dist/schema.mjs.map +1 -1
- package/dist/vercel.mjs +1 -1
- package/dist/vercel.mjs.map +1 -1
- package/package.json +5 -5
- package/dist/schema/status-config.mjs +0 -26
- package/dist/schema/status-config.mjs.map +0 -1
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
//#region src/schema/build-review.d.ts
|
|
4
|
+
/** Narrow `build_reviews` table definition: one verdict of one reviewer on one build. */
|
|
5
|
+
declare const buildReviews: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
6
|
+
name: "build_reviews";
|
|
7
|
+
schema: undefined;
|
|
8
|
+
columns: {
|
|
9
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
10
|
+
name: "id";
|
|
11
|
+
tableName: "build_reviews";
|
|
12
|
+
dataType: "string";
|
|
13
|
+
columnType: "PgText";
|
|
14
|
+
data: string;
|
|
15
|
+
driverParam: string;
|
|
16
|
+
notNull: true;
|
|
17
|
+
hasDefault: false;
|
|
18
|
+
isPrimaryKey: true;
|
|
19
|
+
isAutoincrement: false;
|
|
20
|
+
hasRuntimeDefault: false;
|
|
21
|
+
enumValues: [string, ...string[]];
|
|
22
|
+
baseColumn: never;
|
|
23
|
+
identity: undefined;
|
|
24
|
+
generated: undefined;
|
|
25
|
+
}, {}, {}>;
|
|
26
|
+
buildId: import("drizzle-orm/pg-core").PgColumn<{
|
|
27
|
+
name: "build_id";
|
|
28
|
+
tableName: "build_reviews";
|
|
29
|
+
dataType: "string";
|
|
30
|
+
columnType: "PgText";
|
|
31
|
+
data: string;
|
|
32
|
+
driverParam: string;
|
|
33
|
+
notNull: true;
|
|
34
|
+
hasDefault: false;
|
|
35
|
+
isPrimaryKey: false;
|
|
36
|
+
isAutoincrement: false;
|
|
37
|
+
hasRuntimeDefault: false;
|
|
38
|
+
enumValues: [string, ...string[]];
|
|
39
|
+
baseColumn: never;
|
|
40
|
+
identity: undefined;
|
|
41
|
+
generated: undefined;
|
|
42
|
+
}, {}, {}>;
|
|
43
|
+
userId: import("drizzle-orm/pg-core").PgColumn<{
|
|
44
|
+
name: "user_id";
|
|
45
|
+
tableName: "build_reviews";
|
|
46
|
+
dataType: "string";
|
|
47
|
+
columnType: "PgText";
|
|
48
|
+
data: string;
|
|
49
|
+
driverParam: string;
|
|
50
|
+
notNull: false;
|
|
51
|
+
hasDefault: false;
|
|
52
|
+
isPrimaryKey: false;
|
|
53
|
+
isAutoincrement: false;
|
|
54
|
+
hasRuntimeDefault: false;
|
|
55
|
+
enumValues: [string, ...string[]];
|
|
56
|
+
baseColumn: never;
|
|
57
|
+
identity: undefined;
|
|
58
|
+
generated: undefined;
|
|
59
|
+
}, {}, {}>;
|
|
60
|
+
verdict: import("drizzle-orm/pg-core").PgColumn<{
|
|
61
|
+
name: "verdict";
|
|
62
|
+
tableName: "build_reviews";
|
|
63
|
+
dataType: "string";
|
|
64
|
+
columnType: "PgText";
|
|
65
|
+
data: "approved" | "rejected";
|
|
66
|
+
driverParam: string;
|
|
67
|
+
notNull: true;
|
|
68
|
+
hasDefault: false;
|
|
69
|
+
isPrimaryKey: false;
|
|
70
|
+
isAutoincrement: false;
|
|
71
|
+
hasRuntimeDefault: false;
|
|
72
|
+
enumValues: [string, ...string[]];
|
|
73
|
+
baseColumn: never;
|
|
74
|
+
identity: undefined;
|
|
75
|
+
generated: undefined;
|
|
76
|
+
}, {}, {
|
|
77
|
+
$type: "approved" | "rejected";
|
|
78
|
+
}>;
|
|
79
|
+
body: import("drizzle-orm/pg-core").PgColumn<{
|
|
80
|
+
name: "body";
|
|
81
|
+
tableName: "build_reviews";
|
|
82
|
+
dataType: "string";
|
|
83
|
+
columnType: "PgText";
|
|
84
|
+
data: string;
|
|
85
|
+
driverParam: string;
|
|
86
|
+
notNull: false;
|
|
87
|
+
hasDefault: false;
|
|
88
|
+
isPrimaryKey: false;
|
|
89
|
+
isAutoincrement: false;
|
|
90
|
+
hasRuntimeDefault: false;
|
|
91
|
+
enumValues: [string, ...string[]];
|
|
92
|
+
baseColumn: never;
|
|
93
|
+
identity: undefined;
|
|
94
|
+
generated: undefined;
|
|
95
|
+
}, {}, {}>;
|
|
96
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
97
|
+
name: "created_at";
|
|
98
|
+
tableName: "build_reviews";
|
|
99
|
+
dataType: "string";
|
|
100
|
+
columnType: "PgTimestampString";
|
|
101
|
+
data: string;
|
|
102
|
+
driverParam: string;
|
|
103
|
+
notNull: true;
|
|
104
|
+
hasDefault: false;
|
|
105
|
+
isPrimaryKey: false;
|
|
106
|
+
isAutoincrement: false;
|
|
107
|
+
hasRuntimeDefault: false;
|
|
108
|
+
enumValues: undefined;
|
|
109
|
+
baseColumn: never;
|
|
110
|
+
identity: undefined;
|
|
111
|
+
generated: undefined;
|
|
112
|
+
}, {}, {}>;
|
|
113
|
+
};
|
|
114
|
+
dialect: 'pg';
|
|
115
|
+
}>;
|
|
116
|
+
//#endregion
|
|
117
|
+
export { buildReviews };
|
|
118
|
+
//# sourceMappingURL=build-review.d.mts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { builds } from "./build.mjs";
|
|
5
|
+
import { users } from "./user.mjs";
|
|
6
|
+
import { index, pgTable, text, timestamp } from "drizzle-orm/pg-core";
|
|
7
|
+
//#region src/schema/build-review.ts
|
|
8
|
+
/** Narrow `build_reviews` table definition: one verdict of one reviewer on one build. */
|
|
9
|
+
const buildReviews = pgTable("build_reviews", {
|
|
10
|
+
id: text("id").primaryKey(),
|
|
11
|
+
buildId: text("build_id").notNull().references(() => builds.id, { onDelete: "cascade" }),
|
|
12
|
+
userId: text("user_id").references(() => users.id, { onDelete: "cascade" }),
|
|
13
|
+
verdict: text("verdict").$type().notNull(),
|
|
14
|
+
body: text("body"),
|
|
15
|
+
createdAt: timestamp("created_at", {
|
|
16
|
+
withTimezone: true,
|
|
17
|
+
mode: "string"
|
|
18
|
+
}).notNull()
|
|
19
|
+
}, (table) => [index("build_reviews_build_id_idx").on(table.buildId)]);
|
|
20
|
+
//#endregion
|
|
21
|
+
export { buildReviews };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=build-review.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-review.mjs","names":[],"sources":["../../src/schema/build-review.ts"],"sourcesContent":["import { index, pgTable, text, timestamp } from \"drizzle-orm/pg-core\";\nimport { builds } from \"./build.ts\";\nimport { users } from \"./user.ts\";\n\n/** Narrow `build_reviews` table definition: one verdict of one reviewer on one build. */\nexport const buildReviews = pgTable(\n \"build_reviews\",\n {\n id: text(\"id\").primaryKey(),\n buildId: text(\"build_id\")\n .notNull()\n .references(() => builds.id, { onDelete: \"cascade\" }),\n userId: text(\"user_id\").references(() => users.id, { onDelete: \"cascade\" }),\n verdict: text(\"verdict\").$type<\"approved\" | \"rejected\">().notNull(),\n body: text(\"body\"),\n createdAt: timestamp(\"created_at\", { withTimezone: true, mode: \"string\" }).notNull(),\n },\n (table) => [index(\"build_reviews_build_id_idx\").on(table.buildId)],\n);\n"],"mappings":";;;;;;;;AAKA,MAAa,eAAe,QAC1B,iBACA;CACE,IAAI,KAAK,IAAI,CAAC,CAAC,WAAW;CAC1B,SAAS,KAAK,UAAU,CAAC,CACtB,QAAQ,CAAC,CACT,iBAAiB,OAAO,IAAI,EAAE,UAAU,UAAU,CAAC;CACtD,QAAQ,KAAK,SAAS,CAAC,CAAC,iBAAiB,MAAM,IAAI,EAAE,UAAU,UAAU,CAAC;CAC1E,SAAS,KAAK,SAAS,CAAC,CAAC,MAA+B,CAAC,CAAC,QAAQ;CAClE,MAAM,KAAK,MAAM;CACjB,WAAW,UAAU,cAAc;EAAE,cAAc;EAAM,MAAM;CAAS,CAAC,CAAC,CAAC,QAAQ;AACrF,IACC,UAAU,CAAC,MAAM,4BAA4B,CAAC,CAAC,GAAG,MAAM,OAAO,CAAC,CACnE"}
|
package/dist/schema/build.d.mts
CHANGED
|
@@ -165,7 +165,7 @@ declare const builds: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
165
165
|
tableName: "builds";
|
|
166
166
|
dataType: "string";
|
|
167
167
|
columnType: "PgText";
|
|
168
|
-
data: "approved" | "capturing" | "comparing" | "failed" | "pending" | "rejected" | "reviewing";
|
|
168
|
+
data: "approved" | "cancelled" | "capturing" | "comparing" | "failed" | "pending" | "rejected" | "reviewing";
|
|
169
169
|
driverParam: string;
|
|
170
170
|
notNull: true;
|
|
171
171
|
hasDefault: true;
|
|
@@ -177,7 +177,7 @@ declare const builds: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
177
177
|
identity: undefined;
|
|
178
178
|
generated: undefined;
|
|
179
179
|
}, {}, {
|
|
180
|
-
$type: "approved" | "capturing" | "comparing" | "failed" | "pending" | "rejected" | "reviewing";
|
|
180
|
+
$type: "approved" | "cancelled" | "capturing" | "comparing" | "failed" | "pending" | "rejected" | "reviewing";
|
|
181
181
|
}>;
|
|
182
182
|
snapshotCount: import("drizzle-orm/pg-core").PgColumn<{
|
|
183
183
|
name: "snapshot_count";
|
|
@@ -247,6 +247,23 @@ declare const builds: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
247
247
|
identity: undefined;
|
|
248
248
|
generated: undefined;
|
|
249
249
|
}, {}, {}>;
|
|
250
|
+
inheritedCount: import("drizzle-orm/pg-core").PgColumn<{
|
|
251
|
+
name: "inherited_count";
|
|
252
|
+
tableName: "builds";
|
|
253
|
+
dataType: "number";
|
|
254
|
+
columnType: "PgInteger";
|
|
255
|
+
data: number;
|
|
256
|
+
driverParam: string | number;
|
|
257
|
+
notNull: true;
|
|
258
|
+
hasDefault: true;
|
|
259
|
+
isPrimaryKey: false;
|
|
260
|
+
isAutoincrement: false;
|
|
261
|
+
hasRuntimeDefault: false;
|
|
262
|
+
enumValues: undefined;
|
|
263
|
+
baseColumn: never;
|
|
264
|
+
identity: undefined;
|
|
265
|
+
generated: undefined;
|
|
266
|
+
}, {}, {}>;
|
|
250
267
|
affectedOnly: import("drizzle-orm/pg-core").PgColumn<{
|
|
251
268
|
name: "affected_only";
|
|
252
269
|
tableName: "builds";
|
|
@@ -315,6 +332,23 @@ declare const builds: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
315
332
|
identity: undefined;
|
|
316
333
|
generated: undefined;
|
|
317
334
|
}, {}, {}>;
|
|
335
|
+
testResults: import("drizzle-orm/pg-core").PgColumn<{
|
|
336
|
+
name: "test_results";
|
|
337
|
+
tableName: "builds";
|
|
338
|
+
dataType: "string";
|
|
339
|
+
columnType: "PgText";
|
|
340
|
+
data: string;
|
|
341
|
+
driverParam: string;
|
|
342
|
+
notNull: false;
|
|
343
|
+
hasDefault: false;
|
|
344
|
+
isPrimaryKey: false;
|
|
345
|
+
isAutoincrement: false;
|
|
346
|
+
hasRuntimeDefault: false;
|
|
347
|
+
enumValues: [string, ...string[]];
|
|
348
|
+
baseColumn: never;
|
|
349
|
+
identity: undefined;
|
|
350
|
+
generated: undefined;
|
|
351
|
+
}, {}, {}>;
|
|
318
352
|
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
319
353
|
name: "created_at";
|
|
320
354
|
tableName: "builds";
|
|
@@ -368,10 +402,12 @@ interface Build {
|
|
|
368
402
|
changedCount: number;
|
|
369
403
|
approvedCount: number;
|
|
370
404
|
rejectedCount: number;
|
|
405
|
+
inheritedCount: number;
|
|
371
406
|
affectedOnly: boolean;
|
|
372
407
|
baselineSha: string | null;
|
|
373
408
|
changedFiles: string | null;
|
|
374
409
|
affectedImportPaths: string | null;
|
|
410
|
+
testResults: string | null;
|
|
375
411
|
createdAt: string;
|
|
376
412
|
updatedAt: string;
|
|
377
413
|
}
|
package/dist/schema/build.mjs
CHANGED
|
@@ -20,10 +20,13 @@ const builds = pgTable("builds", {
|
|
|
20
20
|
changedCount: integer("changed_count").notNull().default(0),
|
|
21
21
|
approvedCount: integer("approved_count").notNull().default(0),
|
|
22
22
|
rejectedCount: integer("rejected_count").notNull().default(0),
|
|
23
|
+
/** Snapshots inherited from the baseline without rendering (affected capture). */
|
|
24
|
+
inheritedCount: integer("inherited_count").notNull().default(0),
|
|
23
25
|
affectedOnly: boolean("affected_only").notNull().default(true),
|
|
24
26
|
baselineSha: text("baseline_sha"),
|
|
25
27
|
changedFiles: text("changed_files"),
|
|
26
28
|
affectedImportPaths: text("affected_import_paths"),
|
|
29
|
+
testResults: text("test_results"),
|
|
27
30
|
createdAt: timestamp("created_at", {
|
|
28
31
|
withTimezone: true,
|
|
29
32
|
mode: "string"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.mjs","names":[],"sources":["../../src/schema/build.ts"],"sourcesContent":["import type { BuildStatus } from \"@storyshelf/core/types\";\nimport { boolean, index, integer, pgTable, text, timestamp } from \"drizzle-orm/pg-core\";\nimport { projects } from \"./project.ts\";\n\n/** Narrow `builds` table definition. */\nexport const builds = pgTable(\n \"builds\",\n {\n id: text(\"id\").primaryKey(),\n projectId: text(\"project_id\")\n .notNull()\n .references(() => projects.id, { onDelete: \"cascade\" }),\n gitSha: text(\"git_sha\").notNull(),\n gitBranch: text(\"git_branch\").notNull(),\n isDefault: boolean(\"is_default\").notNull().default(false),\n authorEmail: text(\"author_email\"),\n authorName: text(\"author_name\"),\n message: text(\"message\"),\n public: boolean(\"public\").notNull().default(false),\n status: text(\"status\").$type<BuildStatus>().notNull().default(\"pending\"),\n snapshotCount: integer(\"snapshot_count\").notNull().default(0),\n changedCount: integer(\"changed_count\").notNull().default(0),\n approvedCount: integer(\"approved_count\").notNull().default(0),\n rejectedCount: integer(\"rejected_count\").notNull().default(0),\n affectedOnly: boolean(\"affected_only\").notNull().default(true),\n baselineSha: text(\"baseline_sha\"),\n changedFiles: text(\"changed_files\"),\n affectedImportPaths: text(\"affected_import_paths\"),\n createdAt: timestamp(\"created_at\", { withTimezone: true, mode: \"string\" }).notNull(),\n updatedAt: timestamp(\"updated_at\", { withTimezone: true, mode: \"string\" }).notNull(),\n },\n (t) => [\n index(\"builds_project_gitsha_idx\").on(t.projectId, t.gitSha),\n index(\"builds_git_branch_idx\").on(t.gitBranch),\n ],\n);\n\n/** A build row. */\nexport interface Build {\n id: string;\n projectId: string;\n gitSha: string;\n gitBranch: string;\n isDefault: boolean;\n authorEmail: string | null;\n authorName: string | null;\n message: string | null;\n public: boolean;\n status: BuildStatus;\n snapshotCount: number;\n changedCount: number;\n approvedCount: number;\n rejectedCount: number;\n affectedOnly: boolean;\n baselineSha: string | null;\n changedFiles: string | null;\n affectedImportPaths: string | null;\n createdAt: string;\n updatedAt: string;\n}\n"],"mappings":";;;;;;;AAKA,MAAa,SAAS,QACpB,UACA;CACE,IAAI,KAAK,IAAI,CAAC,CAAC,WAAW;CAC1B,WAAW,KAAK,YAAY,CAAC,CAC1B,QAAQ,CAAC,CACT,iBAAiB,SAAS,IAAI,EAAE,UAAU,UAAU,CAAC;CACxD,QAAQ,KAAK,SAAS,CAAC,CAAC,QAAQ;CAChC,WAAW,KAAK,YAAY,CAAC,CAAC,QAAQ;CACtC,WAAW,QAAQ,YAAY,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,KAAK;CACxD,aAAa,KAAK,cAAc;CAChC,YAAY,KAAK,aAAa;CAC9B,SAAS,KAAK,SAAS;CACvB,QAAQ,QAAQ,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,KAAK;CACjD,QAAQ,KAAK,QAAQ,CAAC,CAAC,MAAmB,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,SAAS;CACvE,eAAe,QAAQ,gBAAgB,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC;CAC5D,cAAc,QAAQ,eAAe,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC;CAC1D,eAAe,QAAQ,gBAAgB,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC;CAC5D,eAAe,QAAQ,gBAAgB,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"build.mjs","names":[],"sources":["../../src/schema/build.ts"],"sourcesContent":["import type { BuildStatus } from \"@storyshelf/core/types\";\nimport { boolean, index, integer, pgTable, text, timestamp } from \"drizzle-orm/pg-core\";\nimport { projects } from \"./project.ts\";\n\n/** Narrow `builds` table definition. */\nexport const builds = pgTable(\n \"builds\",\n {\n id: text(\"id\").primaryKey(),\n projectId: text(\"project_id\")\n .notNull()\n .references(() => projects.id, { onDelete: \"cascade\" }),\n gitSha: text(\"git_sha\").notNull(),\n gitBranch: text(\"git_branch\").notNull(),\n isDefault: boolean(\"is_default\").notNull().default(false),\n authorEmail: text(\"author_email\"),\n authorName: text(\"author_name\"),\n message: text(\"message\"),\n public: boolean(\"public\").notNull().default(false),\n status: text(\"status\").$type<BuildStatus>().notNull().default(\"pending\"),\n snapshotCount: integer(\"snapshot_count\").notNull().default(0),\n changedCount: integer(\"changed_count\").notNull().default(0),\n approvedCount: integer(\"approved_count\").notNull().default(0),\n rejectedCount: integer(\"rejected_count\").notNull().default(0),\n /** Snapshots inherited from the baseline without rendering (affected capture). */\n inheritedCount: integer(\"inherited_count\").notNull().default(0),\n affectedOnly: boolean(\"affected_only\").notNull().default(true),\n baselineSha: text(\"baseline_sha\"),\n changedFiles: text(\"changed_files\"),\n affectedImportPaths: text(\"affected_import_paths\"),\n testResults: text(\"test_results\"),\n createdAt: timestamp(\"created_at\", { withTimezone: true, mode: \"string\" }).notNull(),\n updatedAt: timestamp(\"updated_at\", { withTimezone: true, mode: \"string\" }).notNull(),\n },\n (t) => [\n index(\"builds_project_gitsha_idx\").on(t.projectId, t.gitSha),\n index(\"builds_git_branch_idx\").on(t.gitBranch),\n ],\n);\n\n/** A build row. */\nexport interface Build {\n id: string;\n projectId: string;\n gitSha: string;\n gitBranch: string;\n isDefault: boolean;\n authorEmail: string | null;\n authorName: string | null;\n message: string | null;\n public: boolean;\n status: BuildStatus;\n snapshotCount: number;\n changedCount: number;\n approvedCount: number;\n rejectedCount: number;\n inheritedCount: number;\n affectedOnly: boolean;\n baselineSha: string | null;\n changedFiles: string | null;\n affectedImportPaths: string | null;\n testResults: string | null;\n createdAt: string;\n updatedAt: string;\n}\n"],"mappings":";;;;;;;AAKA,MAAa,SAAS,QACpB,UACA;CACE,IAAI,KAAK,IAAI,CAAC,CAAC,WAAW;CAC1B,WAAW,KAAK,YAAY,CAAC,CAC1B,QAAQ,CAAC,CACT,iBAAiB,SAAS,IAAI,EAAE,UAAU,UAAU,CAAC;CACxD,QAAQ,KAAK,SAAS,CAAC,CAAC,QAAQ;CAChC,WAAW,KAAK,YAAY,CAAC,CAAC,QAAQ;CACtC,WAAW,QAAQ,YAAY,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,KAAK;CACxD,aAAa,KAAK,cAAc;CAChC,YAAY,KAAK,aAAa;CAC9B,SAAS,KAAK,SAAS;CACvB,QAAQ,QAAQ,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,KAAK;CACjD,QAAQ,KAAK,QAAQ,CAAC,CAAC,MAAmB,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,SAAS;CACvE,eAAe,QAAQ,gBAAgB,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC;CAC5D,cAAc,QAAQ,eAAe,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC;CAC1D,eAAe,QAAQ,gBAAgB,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC;CAC5D,eAAe,QAAQ,gBAAgB,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC;;CAE5D,gBAAgB,QAAQ,iBAAiB,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC;CAC9D,cAAc,QAAQ,eAAe,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,IAAI;CAC7D,aAAa,KAAK,cAAc;CAChC,cAAc,KAAK,eAAe;CAClC,qBAAqB,KAAK,uBAAuB;CACjD,aAAa,KAAK,cAAc;CAChC,WAAW,UAAU,cAAc;EAAE,cAAc;EAAM,MAAM;CAAS,CAAC,CAAC,CAAC,QAAQ;CACnF,WAAW,UAAU,cAAc;EAAE,cAAc;EAAM,MAAM;CAAS,CAAC,CAAC,CAAC,QAAQ;AACrF,IACC,MAAM,CACL,MAAM,2BAA2B,CAAC,CAAC,GAAG,EAAE,WAAW,EAAE,MAAM,GAC3D,MAAM,uBAAuB,CAAC,CAAC,GAAG,EAAE,SAAS,CAC/C,CACF"}
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { CaptureJobEntry, CaptureJobKind } from "@storyshelf/core/schema";
|
|
4
|
+
//#region src/schema/capture-job.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Narrow `capture_jobs` table definition: the database queue's job rows and per-attempt claim rows.
|
|
7
|
+
* No foreign keys: notify jobs may have no build, and finished rows are purged by retention.
|
|
8
|
+
*/
|
|
9
|
+
declare const captureJobs: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
10
|
+
name: "capture_jobs";
|
|
11
|
+
schema: undefined;
|
|
12
|
+
columns: {
|
|
13
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
14
|
+
name: "id";
|
|
15
|
+
tableName: "capture_jobs";
|
|
16
|
+
dataType: "string";
|
|
17
|
+
columnType: "PgText";
|
|
18
|
+
data: string;
|
|
19
|
+
driverParam: string;
|
|
20
|
+
notNull: true;
|
|
21
|
+
hasDefault: false;
|
|
22
|
+
isPrimaryKey: true;
|
|
23
|
+
isAutoincrement: false;
|
|
24
|
+
hasRuntimeDefault: false;
|
|
25
|
+
enumValues: [string, ...string[]];
|
|
26
|
+
baseColumn: never;
|
|
27
|
+
identity: undefined;
|
|
28
|
+
generated: undefined;
|
|
29
|
+
}, {}, {}>;
|
|
30
|
+
entry: import("drizzle-orm/pg-core").PgColumn<{
|
|
31
|
+
name: "entry";
|
|
32
|
+
tableName: "capture_jobs";
|
|
33
|
+
dataType: "string";
|
|
34
|
+
columnType: "PgText";
|
|
35
|
+
data: CaptureJobEntry;
|
|
36
|
+
driverParam: string;
|
|
37
|
+
notNull: true;
|
|
38
|
+
hasDefault: false;
|
|
39
|
+
isPrimaryKey: false;
|
|
40
|
+
isAutoincrement: false;
|
|
41
|
+
hasRuntimeDefault: false;
|
|
42
|
+
enumValues: [string, ...string[]];
|
|
43
|
+
baseColumn: never;
|
|
44
|
+
identity: undefined;
|
|
45
|
+
generated: undefined;
|
|
46
|
+
}, {}, {
|
|
47
|
+
$type: CaptureJobEntry;
|
|
48
|
+
}>;
|
|
49
|
+
jobId: import("drizzle-orm/pg-core").PgColumn<{
|
|
50
|
+
name: "job_id";
|
|
51
|
+
tableName: "capture_jobs";
|
|
52
|
+
dataType: "string";
|
|
53
|
+
columnType: "PgText";
|
|
54
|
+
data: string;
|
|
55
|
+
driverParam: string;
|
|
56
|
+
notNull: true;
|
|
57
|
+
hasDefault: false;
|
|
58
|
+
isPrimaryKey: false;
|
|
59
|
+
isAutoincrement: false;
|
|
60
|
+
hasRuntimeDefault: false;
|
|
61
|
+
enumValues: [string, ...string[]];
|
|
62
|
+
baseColumn: never;
|
|
63
|
+
identity: undefined;
|
|
64
|
+
generated: undefined;
|
|
65
|
+
}, {}, {}>;
|
|
66
|
+
kind: import("drizzle-orm/pg-core").PgColumn<{
|
|
67
|
+
name: "kind";
|
|
68
|
+
tableName: "capture_jobs";
|
|
69
|
+
dataType: "string";
|
|
70
|
+
columnType: "PgText";
|
|
71
|
+
data: CaptureJobKind;
|
|
72
|
+
driverParam: string;
|
|
73
|
+
notNull: true;
|
|
74
|
+
hasDefault: false;
|
|
75
|
+
isPrimaryKey: false;
|
|
76
|
+
isAutoincrement: false;
|
|
77
|
+
hasRuntimeDefault: false;
|
|
78
|
+
enumValues: [string, ...string[]];
|
|
79
|
+
baseColumn: never;
|
|
80
|
+
identity: undefined;
|
|
81
|
+
generated: undefined;
|
|
82
|
+
}, {}, {
|
|
83
|
+
$type: CaptureJobKind;
|
|
84
|
+
}>;
|
|
85
|
+
buildId: import("drizzle-orm/pg-core").PgColumn<{
|
|
86
|
+
name: "build_id";
|
|
87
|
+
tableName: "capture_jobs";
|
|
88
|
+
dataType: "string";
|
|
89
|
+
columnType: "PgText";
|
|
90
|
+
data: string;
|
|
91
|
+
driverParam: string;
|
|
92
|
+
notNull: false;
|
|
93
|
+
hasDefault: false;
|
|
94
|
+
isPrimaryKey: false;
|
|
95
|
+
isAutoincrement: false;
|
|
96
|
+
hasRuntimeDefault: false;
|
|
97
|
+
enumValues: [string, ...string[]];
|
|
98
|
+
baseColumn: never;
|
|
99
|
+
identity: undefined;
|
|
100
|
+
generated: undefined;
|
|
101
|
+
}, {}, {}>;
|
|
102
|
+
shardId: import("drizzle-orm/pg-core").PgColumn<{
|
|
103
|
+
name: "shard_id";
|
|
104
|
+
tableName: "capture_jobs";
|
|
105
|
+
dataType: "string";
|
|
106
|
+
columnType: "PgText";
|
|
107
|
+
data: string;
|
|
108
|
+
driverParam: string;
|
|
109
|
+
notNull: false;
|
|
110
|
+
hasDefault: false;
|
|
111
|
+
isPrimaryKey: false;
|
|
112
|
+
isAutoincrement: false;
|
|
113
|
+
hasRuntimeDefault: false;
|
|
114
|
+
enumValues: [string, ...string[]];
|
|
115
|
+
baseColumn: never;
|
|
116
|
+
identity: undefined;
|
|
117
|
+
generated: undefined;
|
|
118
|
+
}, {}, {}>;
|
|
119
|
+
attempt: import("drizzle-orm/pg-core").PgColumn<{
|
|
120
|
+
name: "attempt";
|
|
121
|
+
tableName: "capture_jobs";
|
|
122
|
+
dataType: "number";
|
|
123
|
+
columnType: "PgInteger";
|
|
124
|
+
data: number;
|
|
125
|
+
driverParam: string | number;
|
|
126
|
+
notNull: true;
|
|
127
|
+
hasDefault: true;
|
|
128
|
+
isPrimaryKey: false;
|
|
129
|
+
isAutoincrement: false;
|
|
130
|
+
hasRuntimeDefault: false;
|
|
131
|
+
enumValues: undefined;
|
|
132
|
+
baseColumn: never;
|
|
133
|
+
identity: undefined;
|
|
134
|
+
generated: undefined;
|
|
135
|
+
}, {}, {}>;
|
|
136
|
+
maxAttempts: import("drizzle-orm/pg-core").PgColumn<{
|
|
137
|
+
name: "max_attempts";
|
|
138
|
+
tableName: "capture_jobs";
|
|
139
|
+
dataType: "number";
|
|
140
|
+
columnType: "PgInteger";
|
|
141
|
+
data: number;
|
|
142
|
+
driverParam: string | number;
|
|
143
|
+
notNull: true;
|
|
144
|
+
hasDefault: true;
|
|
145
|
+
isPrimaryKey: false;
|
|
146
|
+
isAutoincrement: false;
|
|
147
|
+
hasRuntimeDefault: false;
|
|
148
|
+
enumValues: undefined;
|
|
149
|
+
baseColumn: never;
|
|
150
|
+
identity: undefined;
|
|
151
|
+
generated: undefined;
|
|
152
|
+
}, {}, {}>;
|
|
153
|
+
status: import("drizzle-orm/pg-core").PgColumn<{
|
|
154
|
+
name: "status";
|
|
155
|
+
tableName: "capture_jobs";
|
|
156
|
+
dataType: "string";
|
|
157
|
+
columnType: "PgText";
|
|
158
|
+
data: "cancelled" | "done" | "expired" | "failed" | "queued" | "running";
|
|
159
|
+
driverParam: string;
|
|
160
|
+
notNull: true;
|
|
161
|
+
hasDefault: false;
|
|
162
|
+
isPrimaryKey: false;
|
|
163
|
+
isAutoincrement: false;
|
|
164
|
+
hasRuntimeDefault: false;
|
|
165
|
+
enumValues: [string, ...string[]];
|
|
166
|
+
baseColumn: never;
|
|
167
|
+
identity: undefined;
|
|
168
|
+
generated: undefined;
|
|
169
|
+
}, {}, {
|
|
170
|
+
$type: "cancelled" | "done" | "expired" | "failed" | "queued" | "running";
|
|
171
|
+
}>;
|
|
172
|
+
visibleAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
173
|
+
name: "visible_at";
|
|
174
|
+
tableName: "capture_jobs";
|
|
175
|
+
dataType: "string";
|
|
176
|
+
columnType: "PgTimestampString";
|
|
177
|
+
data: string;
|
|
178
|
+
driverParam: string;
|
|
179
|
+
notNull: false;
|
|
180
|
+
hasDefault: false;
|
|
181
|
+
isPrimaryKey: false;
|
|
182
|
+
isAutoincrement: false;
|
|
183
|
+
hasRuntimeDefault: false;
|
|
184
|
+
enumValues: undefined;
|
|
185
|
+
baseColumn: never;
|
|
186
|
+
identity: undefined;
|
|
187
|
+
generated: undefined;
|
|
188
|
+
}, {}, {}>;
|
|
189
|
+
owner: import("drizzle-orm/pg-core").PgColumn<{
|
|
190
|
+
name: "owner";
|
|
191
|
+
tableName: "capture_jobs";
|
|
192
|
+
dataType: "string";
|
|
193
|
+
columnType: "PgText";
|
|
194
|
+
data: string;
|
|
195
|
+
driverParam: string;
|
|
196
|
+
notNull: false;
|
|
197
|
+
hasDefault: false;
|
|
198
|
+
isPrimaryKey: false;
|
|
199
|
+
isAutoincrement: false;
|
|
200
|
+
hasRuntimeDefault: false;
|
|
201
|
+
enumValues: [string, ...string[]];
|
|
202
|
+
baseColumn: never;
|
|
203
|
+
identity: undefined;
|
|
204
|
+
generated: undefined;
|
|
205
|
+
}, {}, {}>;
|
|
206
|
+
payload: import("drizzle-orm/pg-core").PgColumn<{
|
|
207
|
+
name: "payload";
|
|
208
|
+
tableName: "capture_jobs";
|
|
209
|
+
dataType: "string";
|
|
210
|
+
columnType: "PgText";
|
|
211
|
+
data: string;
|
|
212
|
+
driverParam: string;
|
|
213
|
+
notNull: false;
|
|
214
|
+
hasDefault: false;
|
|
215
|
+
isPrimaryKey: false;
|
|
216
|
+
isAutoincrement: false;
|
|
217
|
+
hasRuntimeDefault: false;
|
|
218
|
+
enumValues: [string, ...string[]];
|
|
219
|
+
baseColumn: never;
|
|
220
|
+
identity: undefined;
|
|
221
|
+
generated: undefined;
|
|
222
|
+
}, {}, {}>;
|
|
223
|
+
cancelRequestedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
224
|
+
name: "cancel_requested_at";
|
|
225
|
+
tableName: "capture_jobs";
|
|
226
|
+
dataType: "string";
|
|
227
|
+
columnType: "PgTimestampString";
|
|
228
|
+
data: string;
|
|
229
|
+
driverParam: string;
|
|
230
|
+
notNull: false;
|
|
231
|
+
hasDefault: false;
|
|
232
|
+
isPrimaryKey: false;
|
|
233
|
+
isAutoincrement: false;
|
|
234
|
+
hasRuntimeDefault: false;
|
|
235
|
+
enumValues: undefined;
|
|
236
|
+
baseColumn: never;
|
|
237
|
+
identity: undefined;
|
|
238
|
+
generated: undefined;
|
|
239
|
+
}, {}, {}>;
|
|
240
|
+
error: import("drizzle-orm/pg-core").PgColumn<{
|
|
241
|
+
name: "error";
|
|
242
|
+
tableName: "capture_jobs";
|
|
243
|
+
dataType: "string";
|
|
244
|
+
columnType: "PgText";
|
|
245
|
+
data: string;
|
|
246
|
+
driverParam: string;
|
|
247
|
+
notNull: false;
|
|
248
|
+
hasDefault: false;
|
|
249
|
+
isPrimaryKey: false;
|
|
250
|
+
isAutoincrement: false;
|
|
251
|
+
hasRuntimeDefault: false;
|
|
252
|
+
enumValues: [string, ...string[]];
|
|
253
|
+
baseColumn: never;
|
|
254
|
+
identity: undefined;
|
|
255
|
+
generated: undefined;
|
|
256
|
+
}, {}, {}>;
|
|
257
|
+
startedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
258
|
+
name: "started_at";
|
|
259
|
+
tableName: "capture_jobs";
|
|
260
|
+
dataType: "string";
|
|
261
|
+
columnType: "PgTimestampString";
|
|
262
|
+
data: string;
|
|
263
|
+
driverParam: string;
|
|
264
|
+
notNull: false;
|
|
265
|
+
hasDefault: false;
|
|
266
|
+
isPrimaryKey: false;
|
|
267
|
+
isAutoincrement: false;
|
|
268
|
+
hasRuntimeDefault: false;
|
|
269
|
+
enumValues: undefined;
|
|
270
|
+
baseColumn: never;
|
|
271
|
+
identity: undefined;
|
|
272
|
+
generated: undefined;
|
|
273
|
+
}, {}, {}>;
|
|
274
|
+
finishedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
275
|
+
name: "finished_at";
|
|
276
|
+
tableName: "capture_jobs";
|
|
277
|
+
dataType: "string";
|
|
278
|
+
columnType: "PgTimestampString";
|
|
279
|
+
data: string;
|
|
280
|
+
driverParam: string;
|
|
281
|
+
notNull: false;
|
|
282
|
+
hasDefault: false;
|
|
283
|
+
isPrimaryKey: false;
|
|
284
|
+
isAutoincrement: false;
|
|
285
|
+
hasRuntimeDefault: false;
|
|
286
|
+
enumValues: undefined;
|
|
287
|
+
baseColumn: never;
|
|
288
|
+
identity: undefined;
|
|
289
|
+
generated: undefined;
|
|
290
|
+
}, {}, {}>;
|
|
291
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
292
|
+
name: "created_at";
|
|
293
|
+
tableName: "capture_jobs";
|
|
294
|
+
dataType: "string";
|
|
295
|
+
columnType: "PgTimestampString";
|
|
296
|
+
data: string;
|
|
297
|
+
driverParam: string;
|
|
298
|
+
notNull: true;
|
|
299
|
+
hasDefault: false;
|
|
300
|
+
isPrimaryKey: false;
|
|
301
|
+
isAutoincrement: false;
|
|
302
|
+
hasRuntimeDefault: false;
|
|
303
|
+
enumValues: undefined;
|
|
304
|
+
baseColumn: never;
|
|
305
|
+
identity: undefined;
|
|
306
|
+
generated: undefined;
|
|
307
|
+
}, {}, {}>;
|
|
308
|
+
updatedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
309
|
+
name: "updated_at";
|
|
310
|
+
tableName: "capture_jobs";
|
|
311
|
+
dataType: "string";
|
|
312
|
+
columnType: "PgTimestampString";
|
|
313
|
+
data: string;
|
|
314
|
+
driverParam: string;
|
|
315
|
+
notNull: true;
|
|
316
|
+
hasDefault: false;
|
|
317
|
+
isPrimaryKey: false;
|
|
318
|
+
isAutoincrement: false;
|
|
319
|
+
hasRuntimeDefault: false;
|
|
320
|
+
enumValues: undefined;
|
|
321
|
+
baseColumn: never;
|
|
322
|
+
identity: undefined;
|
|
323
|
+
generated: undefined;
|
|
324
|
+
}, {}, {}>;
|
|
325
|
+
};
|
|
326
|
+
dialect: 'pg';
|
|
327
|
+
}>;
|
|
328
|
+
//#endregion
|
|
329
|
+
export { captureJobs };
|
|
330
|
+
//# sourceMappingURL=capture-job.d.mts.map
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { index, integer, pgTable, text, timestamp } from "drizzle-orm/pg-core";
|
|
5
|
+
//#region src/schema/capture-job.ts
|
|
6
|
+
/**
|
|
7
|
+
* Narrow `capture_jobs` table definition: the database queue's job rows and per-attempt claim rows.
|
|
8
|
+
* No foreign keys: notify jobs may have no build, and finished rows are purged by retention.
|
|
9
|
+
*/
|
|
10
|
+
const captureJobs = pgTable("capture_jobs", {
|
|
11
|
+
id: text("id").primaryKey(),
|
|
12
|
+
entry: text("entry").$type().notNull(),
|
|
13
|
+
jobId: text("job_id").notNull(),
|
|
14
|
+
kind: text("kind").$type().notNull(),
|
|
15
|
+
buildId: text("build_id"),
|
|
16
|
+
shardId: text("shard_id"),
|
|
17
|
+
attempt: integer("attempt").notNull().default(0),
|
|
18
|
+
maxAttempts: integer("max_attempts").notNull().default(3),
|
|
19
|
+
status: text("status").$type().notNull(),
|
|
20
|
+
visibleAt: timestamp("visible_at", {
|
|
21
|
+
withTimezone: true,
|
|
22
|
+
mode: "string"
|
|
23
|
+
}),
|
|
24
|
+
owner: text("owner"),
|
|
25
|
+
payload: text("payload"),
|
|
26
|
+
cancelRequestedAt: timestamp("cancel_requested_at", {
|
|
27
|
+
withTimezone: true,
|
|
28
|
+
mode: "string"
|
|
29
|
+
}),
|
|
30
|
+
error: text("error"),
|
|
31
|
+
startedAt: timestamp("started_at", {
|
|
32
|
+
withTimezone: true,
|
|
33
|
+
mode: "string"
|
|
34
|
+
}),
|
|
35
|
+
finishedAt: timestamp("finished_at", {
|
|
36
|
+
withTimezone: true,
|
|
37
|
+
mode: "string"
|
|
38
|
+
}),
|
|
39
|
+
createdAt: timestamp("created_at", {
|
|
40
|
+
withTimezone: true,
|
|
41
|
+
mode: "string"
|
|
42
|
+
}).notNull(),
|
|
43
|
+
updatedAt: timestamp("updated_at", {
|
|
44
|
+
withTimezone: true,
|
|
45
|
+
mode: "string"
|
|
46
|
+
}).notNull()
|
|
47
|
+
}, (table) => [
|
|
48
|
+
index("capture_jobs_poll_idx").on(table.kind, table.visibleAt, table.status),
|
|
49
|
+
index("capture_jobs_job_id_idx").on(table.jobId),
|
|
50
|
+
index("capture_jobs_build_id_idx").on(table.buildId),
|
|
51
|
+
index("capture_jobs_entry_created_idx").on(table.entry, table.createdAt)
|
|
52
|
+
]);
|
|
53
|
+
//#endregion
|
|
54
|
+
export { captureJobs };
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=capture-job.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture-job.mjs","names":[],"sources":["../../src/schema/capture-job.ts"],"sourcesContent":["import type {\n CaptureAttemptStatus,\n CaptureJobEntry,\n CaptureJobKind,\n CaptureJobStatus,\n} from \"@storyshelf/core/schema\";\nimport { index, integer, pgTable, text, timestamp } from \"drizzle-orm/pg-core\";\n\n/**\n * Narrow `capture_jobs` table definition: the database queue's job rows and per-attempt claim rows.\n * No foreign keys: notify jobs may have no build, and finished rows are purged by retention.\n */\nexport const captureJobs = pgTable(\n \"capture_jobs\",\n {\n id: text(\"id\").primaryKey(),\n entry: text(\"entry\").$type<CaptureJobEntry>().notNull(),\n jobId: text(\"job_id\").notNull(),\n kind: text(\"kind\").$type<CaptureJobKind>().notNull(),\n buildId: text(\"build_id\"),\n shardId: text(\"shard_id\"),\n attempt: integer(\"attempt\").notNull().default(0),\n maxAttempts: integer(\"max_attempts\").notNull().default(3),\n status: text(\"status\").$type<CaptureJobStatus | CaptureAttemptStatus>().notNull(),\n visibleAt: timestamp(\"visible_at\", { withTimezone: true, mode: \"string\" }),\n owner: text(\"owner\"),\n payload: text(\"payload\"),\n cancelRequestedAt: timestamp(\"cancel_requested_at\", { withTimezone: true, mode: \"string\" }),\n error: text(\"error\"),\n startedAt: timestamp(\"started_at\", { withTimezone: true, mode: \"string\" }),\n finishedAt: timestamp(\"finished_at\", { withTimezone: true, mode: \"string\" }),\n createdAt: timestamp(\"created_at\", { withTimezone: true, mode: \"string\" }).notNull(),\n updatedAt: timestamp(\"updated_at\", { withTimezone: true, mode: \"string\" }).notNull(),\n },\n (table) => [\n index(\"capture_jobs_poll_idx\").on(table.kind, table.visibleAt, table.status),\n index(\"capture_jobs_job_id_idx\").on(table.jobId),\n index(\"capture_jobs_build_id_idx\").on(table.buildId),\n index(\"capture_jobs_entry_created_idx\").on(table.entry, table.createdAt),\n ],\n);\n"],"mappings":";;;;;;;;;AAYA,MAAa,cAAc,QACzB,gBACA;CACE,IAAI,KAAK,IAAI,CAAC,CAAC,WAAW;CAC1B,OAAO,KAAK,OAAO,CAAC,CAAC,MAAuB,CAAC,CAAC,QAAQ;CACtD,OAAO,KAAK,QAAQ,CAAC,CAAC,QAAQ;CAC9B,MAAM,KAAK,MAAM,CAAC,CAAC,MAAsB,CAAC,CAAC,QAAQ;CACnD,SAAS,KAAK,UAAU;CACxB,SAAS,KAAK,UAAU;CACxB,SAAS,QAAQ,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC;CAC/C,aAAa,QAAQ,cAAc,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC;CACxD,QAAQ,KAAK,QAAQ,CAAC,CAAC,MAA+C,CAAC,CAAC,QAAQ;CAChF,WAAW,UAAU,cAAc;EAAE,cAAc;EAAM,MAAM;CAAS,CAAC;CACzE,OAAO,KAAK,OAAO;CACnB,SAAS,KAAK,SAAS;CACvB,mBAAmB,UAAU,uBAAuB;EAAE,cAAc;EAAM,MAAM;CAAS,CAAC;CAC1F,OAAO,KAAK,OAAO;CACnB,WAAW,UAAU,cAAc;EAAE,cAAc;EAAM,MAAM;CAAS,CAAC;CACzE,YAAY,UAAU,eAAe;EAAE,cAAc;EAAM,MAAM;CAAS,CAAC;CAC3E,WAAW,UAAU,cAAc;EAAE,cAAc;EAAM,MAAM;CAAS,CAAC,CAAC,CAAC,QAAQ;CACnF,WAAW,UAAU,cAAc;EAAE,cAAc;EAAM,MAAM;CAAS,CAAC,CAAC,CAAC,QAAQ;AACrF,IACC,UAAU;CACT,MAAM,uBAAuB,CAAC,CAAC,GAAG,MAAM,MAAM,MAAM,WAAW,MAAM,MAAM;CAC3E,MAAM,yBAAyB,CAAC,CAAC,GAAG,MAAM,KAAK;CAC/C,MAAM,2BAA2B,CAAC,CAAC,GAAG,MAAM,OAAO;CACnD,MAAM,gCAAgC,CAAC,CAAC,GAAG,MAAM,OAAO,MAAM,SAAS;AACzE,CACF"}
|