@storyshelf/db-mysql 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.
Files changed (92) hide show
  1. package/README.md +36 -0
  2. package/dist/ddl.d.mts +1 -1
  3. package/dist/ddl.mjs +381 -138
  4. package/dist/ddl.mjs.map +1 -1
  5. package/dist/drizzle-factory-mysql.mjs +7 -1
  6. package/dist/drizzle-factory-mysql.mjs.map +1 -1
  7. package/dist/foreign-keys.mjs +339 -0
  8. package/dist/foreign-keys.mjs.map +1 -0
  9. package/dist/index.mjs +10 -5
  10. package/dist/index.mjs.map +1 -1
  11. package/dist/migrate.mjs +300 -72
  12. package/dist/migrate.mjs.map +1 -1
  13. package/dist/schema/baseline.d.mts +60 -6
  14. package/dist/schema/baseline.mjs +6 -2
  15. package/dist/schema/baseline.mjs.map +1 -1
  16. package/dist/schema/{status-config.d.mts → build-component.d.mts} +46 -39
  17. package/dist/schema/build-component.mjs +26 -0
  18. package/dist/schema/build-component.mjs.map +1 -0
  19. package/dist/schema/build-review.d.mts +118 -0
  20. package/dist/schema/build-review.mjs +24 -0
  21. package/dist/schema/build-review.mjs.map +1 -0
  22. package/dist/schema/build.d.mts +44 -8
  23. package/dist/schema/build.mjs +5 -1
  24. package/dist/schema/build.mjs.map +1 -1
  25. package/dist/schema/capture-attempt.d.mts +18 -18
  26. package/dist/schema/capture-attempt.mjs +2 -1
  27. package/dist/schema/capture-attempt.mjs.map +1 -1
  28. package/dist/schema/capture-job.d.mts +330 -0
  29. package/dist/schema/capture-job.mjs +57 -0
  30. package/dist/schema/capture-job.mjs.map +1 -0
  31. package/dist/schema/capture-shard.d.mts +257 -0
  32. package/dist/schema/capture-shard.mjs +41 -0
  33. package/dist/schema/capture-shard.mjs.map +1 -0
  34. package/dist/schema/comment.d.mts +24 -6
  35. package/dist/schema/comment.mjs +5 -3
  36. package/dist/schema/comment.mjs.map +1 -1
  37. package/dist/schema/connection.d.mts +173 -0
  38. package/dist/schema/connection.mjs +36 -0
  39. package/dist/schema/connection.mjs.map +1 -0
  40. package/dist/schema/content-refs.d.mts +6 -6
  41. package/dist/schema/content-refs.mjs +2 -1
  42. package/dist/schema/content-refs.mjs.map +1 -1
  43. package/dist/schema/datetime.mjs +47 -0
  44. package/dist/schema/datetime.mjs.map +1 -0
  45. package/dist/schema/design.d.mts +589 -0
  46. package/dist/schema/design.mjs +74 -0
  47. package/dist/schema/design.mjs.map +1 -0
  48. package/dist/schema/insight.d.mts +633 -0
  49. package/dist/schema/insight.mjs +69 -0
  50. package/dist/schema/insight.mjs.map +1 -0
  51. package/dist/schema/label.d.mts +6 -6
  52. package/dist/schema/label.mjs +2 -1
  53. package/dist/schema/label.mjs.map +1 -1
  54. package/dist/schema/member.d.mts +3 -3
  55. package/dist/schema/member.mjs +2 -1
  56. package/dist/schema/member.mjs.map +1 -1
  57. package/dist/schema/notification.d.mts +45 -9
  58. package/dist/schema/notification.mjs +7 -1
  59. package/dist/schema/notification.mjs.map +1 -1
  60. package/dist/schema/project-group-mapping.d.mts +3 -3
  61. package/dist/schema/project-group-mapping.mjs +2 -1
  62. package/dist/schema/project-group-mapping.mjs.map +1 -1
  63. package/dist/schema/project.d.mts +132 -6
  64. package/dist/schema/project.mjs +10 -2
  65. package/dist/schema/project.mjs.map +1 -1
  66. package/dist/schema/site-setting.d.mts +99 -0
  67. package/dist/schema/site-setting.mjs +24 -0
  68. package/dist/schema/site-setting.mjs.map +1 -0
  69. package/dist/schema/snapshot.d.mts +117 -9
  70. package/dist/schema/snapshot.mjs +13 -2
  71. package/dist/schema/snapshot.mjs.map +1 -1
  72. package/dist/schema/token.d.mts +6 -6
  73. package/dist/schema/token.mjs +2 -1
  74. package/dist/schema/token.mjs.map +1 -1
  75. package/dist/schema/usage.d.mts +267 -0
  76. package/dist/schema/usage.mjs +37 -0
  77. package/dist/schema/usage.mjs.map +1 -0
  78. package/dist/schema/user-invite.d.mts +9 -9
  79. package/dist/schema/user-invite.mjs +2 -1
  80. package/dist/schema/user-invite.mjs.map +1 -1
  81. package/dist/schema/user.d.mts +6 -6
  82. package/dist/schema/user.mjs +2 -1
  83. package/dist/schema/user.mjs.map +1 -1
  84. package/dist/schema/webhook.d.mts +6 -6
  85. package/dist/schema/webhook.mjs +2 -1
  86. package/dist/schema/webhook.mjs.map +1 -1
  87. package/dist/schema.d.mts +24 -3
  88. package/dist/schema.mjs +25 -4
  89. package/dist/schema.mjs.map +1 -1
  90. package/package.json +5 -5
  91. package/dist/schema/status-config.mjs +0 -26
  92. package/dist/schema/status-config.mjs.map +0 -1
@@ -1,14 +1,14 @@
1
1
  import __tsdown_shims_path from 'node:path';
2
2
  import __tsdown_shims_url from 'node:url';
3
- //#region src/schema/status-config.d.ts
4
- /** Narrow `project_status_configs` table definition. */
5
- declare const projectStatusConfigs: import("drizzle-orm/mysql-core").MySqlTableWithColumns<{
6
- name: "project_status_configs";
3
+ //#region src/schema/build-component.d.ts
4
+ /** Narrow `build_components` table definition: one row per component of a published build. */
5
+ declare const buildComponents: import("drizzle-orm/mysql-core").MySqlTableWithColumns<{
6
+ name: "build_components";
7
7
  schema: undefined;
8
8
  columns: {
9
9
  id: import("drizzle-orm/mysql-core").MySqlColumn<{
10
10
  name: "id";
11
- tableName: "project_status_configs";
11
+ tableName: "build_components";
12
12
  dataType: "string";
13
13
  columnType: "MySqlText";
14
14
  data: string;
@@ -25,7 +25,7 @@ declare const projectStatusConfigs: import("drizzle-orm/mysql-core").MySqlTableW
25
25
  }, {}, {}>;
26
26
  projectId: import("drizzle-orm/mysql-core").MySqlColumn<{
27
27
  name: "project_id";
28
- tableName: "project_status_configs";
28
+ tableName: "build_components";
29
29
  dataType: "string";
30
30
  columnType: "MySqlText";
31
31
  data: string;
@@ -40,9 +40,9 @@ declare const projectStatusConfigs: import("drizzle-orm/mysql-core").MySqlTableW
40
40
  identity: undefined;
41
41
  generated: undefined;
42
42
  }, {}, {}>;
43
- provider: import("drizzle-orm/mysql-core").MySqlColumn<{
44
- name: "provider";
45
- tableName: "project_status_configs";
43
+ buildId: import("drizzle-orm/mysql-core").MySqlColumn<{
44
+ name: "build_id";
45
+ tableName: "build_components";
46
46
  dataType: "string";
47
47
  columnType: "MySqlText";
48
48
  data: string;
@@ -57,9 +57,9 @@ declare const projectStatusConfigs: import("drizzle-orm/mysql-core").MySqlTableW
57
57
  identity: undefined;
58
58
  generated: undefined;
59
59
  }, {}, {}>;
60
- config: import("drizzle-orm/mysql-core").MySqlColumn<{
61
- name: "config";
62
- tableName: "project_status_configs";
60
+ importPath: import("drizzle-orm/mysql-core").MySqlColumn<{
61
+ name: "import_path";
62
+ tableName: "build_components";
63
63
  dataType: "string";
64
64
  columnType: "MySqlText";
65
65
  data: string;
@@ -74,9 +74,9 @@ declare const projectStatusConfigs: import("drizzle-orm/mysql-core").MySqlTableW
74
74
  identity: undefined;
75
75
  generated: undefined;
76
76
  }, {}, {}>;
77
- tokenEncrypted: import("drizzle-orm/mysql-core").MySqlColumn<{
78
- name: "token_encrypted";
79
- tableName: "project_status_configs";
77
+ title: import("drizzle-orm/mysql-core").MySqlColumn<{
78
+ name: "title";
79
+ tableName: "build_components";
80
80
  dataType: "string";
81
81
  columnType: "MySqlText";
82
82
  data: string;
@@ -91,15 +91,15 @@ declare const projectStatusConfigs: import("drizzle-orm/mysql-core").MySqlTableW
91
91
  identity: undefined;
92
92
  generated: undefined;
93
93
  }, {}, {}>;
94
- createdAt: import("drizzle-orm/mysql-core").MySqlColumn<{
95
- name: "created_at";
96
- tableName: "project_status_configs";
97
- dataType: "string";
98
- columnType: "MySqlDateTimeString";
99
- data: string;
94
+ storyCount: import("drizzle-orm/mysql-core").MySqlColumn<{
95
+ name: "story_count";
96
+ tableName: "build_components";
97
+ dataType: "number";
98
+ columnType: "MySqlInt";
99
+ data: number;
100
100
  driverParam: string | number;
101
101
  notNull: true;
102
- hasDefault: false;
102
+ hasDefault: true;
103
103
  isPrimaryKey: false;
104
104
  isAutoincrement: false;
105
105
  hasRuntimeDefault: false;
@@ -108,13 +108,30 @@ declare const projectStatusConfigs: import("drizzle-orm/mysql-core").MySqlTableW
108
108
  identity: undefined;
109
109
  generated: undefined;
110
110
  }, {}, {}>;
111
- updatedAt: import("drizzle-orm/mysql-core").MySqlColumn<{
112
- name: "updated_at";
113
- tableName: "project_status_configs";
111
+ hash: import("drizzle-orm/mysql-core").MySqlColumn<{
112
+ name: "hash";
113
+ tableName: "build_components";
114
114
  dataType: "string";
115
- columnType: "MySqlDateTimeString";
115
+ columnType: "MySqlText";
116
116
  data: string;
117
- driverParam: string | number;
117
+ driverParam: string;
118
+ notNull: true;
119
+ hasDefault: false;
120
+ isPrimaryKey: false;
121
+ isAutoincrement: false;
122
+ hasRuntimeDefault: false;
123
+ enumValues: [string, ...string[]];
124
+ baseColumn: never;
125
+ identity: undefined;
126
+ generated: undefined;
127
+ }, {}, {}>;
128
+ createdAt: import("drizzle-orm/mysql-core").MySqlColumn<{
129
+ name: "created_at";
130
+ tableName: "build_components";
131
+ dataType: "custom";
132
+ columnType: "MySqlCustomColumn";
133
+ data: string;
134
+ driverParam: string;
118
135
  notNull: true;
119
136
  hasDefault: false;
120
137
  isPrimaryKey: false;
@@ -128,16 +145,6 @@ declare const projectStatusConfigs: import("drizzle-orm/mysql-core").MySqlTableW
128
145
  };
129
146
  dialect: 'mysql';
130
147
  }>;
131
- /** A project status-config row. */
132
- interface ProjectStatusConfig {
133
- id: string;
134
- projectId: string;
135
- provider: string;
136
- config: string;
137
- tokenEncrypted: string;
138
- createdAt: string;
139
- updatedAt: string;
140
- }
141
148
  //#endregion
142
- export { ProjectStatusConfig, projectStatusConfigs };
143
- //# sourceMappingURL=status-config.d.mts.map
149
+ export { buildComponents };
150
+ //# sourceMappingURL=build-component.d.mts.map
@@ -0,0 +1,26 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ import { datetime } from "./datetime.mjs";
5
+ import { projects } from "./project.mjs";
6
+ import { builds } from "./build.mjs";
7
+ import { index, int, mysqlTable, text } from "drizzle-orm/mysql-core";
8
+ //#region src/schema/build-component.ts
9
+ /** Narrow `build_components` table definition: one row per component of a published build. */
10
+ const buildComponents = mysqlTable("build_components", {
11
+ id: text("id").primaryKey(),
12
+ projectId: text("project_id").notNull().references(() => projects.id, { onDelete: "cascade" }),
13
+ buildId: text("build_id").notNull().references(() => builds.id, { onDelete: "cascade" }),
14
+ importPath: text("import_path").notNull(),
15
+ title: text("title").notNull(),
16
+ storyCount: int("story_count").notNull().default(0),
17
+ hash: text("hash").notNull(),
18
+ createdAt: datetime("created_at", {
19
+ mode: "string",
20
+ fsp: 3
21
+ }).notNull()
22
+ }, (table) => [index("build_components_build_id_idx").on(table.buildId), index("build_components_project_import_path_idx").on(table.projectId, table.importPath)]);
23
+ //#endregion
24
+ export { buildComponents };
25
+
26
+ //# sourceMappingURL=build-component.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-component.mjs","names":[],"sources":["../../src/schema/build-component.ts"],"sourcesContent":["import { index, int, mysqlTable, text } from \"drizzle-orm/mysql-core\";\nimport { builds } from \"./build.ts\";\nimport { datetime } from \"./datetime.ts\";\nimport { projects } from \"./project.ts\";\n\n/** Narrow `build_components` table definition: one row per component of a published build. */\nexport const buildComponents = mysqlTable(\n \"build_components\",\n {\n id: text(\"id\").primaryKey(),\n projectId: text(\"project_id\")\n .notNull()\n .references(() => projects.id, { onDelete: \"cascade\" }),\n buildId: text(\"build_id\")\n .notNull()\n .references(() => builds.id, { onDelete: \"cascade\" }),\n importPath: text(\"import_path\").notNull(),\n title: text(\"title\").notNull(),\n storyCount: int(\"story_count\").notNull().default(0),\n hash: text(\"hash\").notNull(),\n createdAt: datetime(\"created_at\", { mode: \"string\", fsp: 3 }).notNull(),\n },\n (table) => [\n index(\"build_components_build_id_idx\").on(table.buildId),\n index(\"build_components_project_import_path_idx\").on(table.projectId, table.importPath),\n ],\n);\n"],"mappings":";;;;;;;;;AAMA,MAAa,kBAAkB,WAC7B,oBACA;CACE,IAAI,KAAK,IAAI,CAAC,CAAC,WAAW;CAC1B,WAAW,KAAK,YAAY,CAAC,CAC1B,QAAQ,CAAC,CACT,iBAAiB,SAAS,IAAI,EAAE,UAAU,UAAU,CAAC;CACxD,SAAS,KAAK,UAAU,CAAC,CACtB,QAAQ,CAAC,CACT,iBAAiB,OAAO,IAAI,EAAE,UAAU,UAAU,CAAC;CACtD,YAAY,KAAK,aAAa,CAAC,CAAC,QAAQ;CACxC,OAAO,KAAK,OAAO,CAAC,CAAC,QAAQ;CAC7B,YAAY,IAAI,aAAa,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC;CAClD,MAAM,KAAK,MAAM,CAAC,CAAC,QAAQ;CAC3B,WAAW,SAAS,cAAc;EAAE,MAAM;EAAU,KAAK;CAAE,CAAC,CAAC,CAAC,QAAQ;AACxE,IACC,UAAU,CACT,MAAM,+BAA+B,CAAC,CAAC,GAAG,MAAM,OAAO,GACvD,MAAM,0CAA0C,CAAC,CAAC,GAAG,MAAM,WAAW,MAAM,UAAU,CACxF,CACF"}
@@ -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/mysql-core").MySqlTableWithColumns<{
6
+ name: "build_reviews";
7
+ schema: undefined;
8
+ columns: {
9
+ id: import("drizzle-orm/mysql-core").MySqlColumn<{
10
+ name: "id";
11
+ tableName: "build_reviews";
12
+ dataType: "string";
13
+ columnType: "MySqlText";
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/mysql-core").MySqlColumn<{
27
+ name: "build_id";
28
+ tableName: "build_reviews";
29
+ dataType: "string";
30
+ columnType: "MySqlText";
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/mysql-core").MySqlColumn<{
44
+ name: "user_id";
45
+ tableName: "build_reviews";
46
+ dataType: "string";
47
+ columnType: "MySqlText";
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/mysql-core").MySqlColumn<{
61
+ name: "verdict";
62
+ tableName: "build_reviews";
63
+ dataType: "string";
64
+ columnType: "MySqlText";
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/mysql-core").MySqlColumn<{
80
+ name: "body";
81
+ tableName: "build_reviews";
82
+ dataType: "string";
83
+ columnType: "MySqlText";
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/mysql-core").MySqlColumn<{
97
+ name: "created_at";
98
+ tableName: "build_reviews";
99
+ dataType: "custom";
100
+ columnType: "MySqlCustomColumn";
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: 'mysql';
115
+ }>;
116
+ //#endregion
117
+ export { buildReviews };
118
+ //# sourceMappingURL=build-review.d.mts.map
@@ -0,0 +1,24 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ import { datetime } from "./datetime.mjs";
5
+ import { builds } from "./build.mjs";
6
+ import { users } from "./user.mjs";
7
+ import { index, mysqlTable, text } from "drizzle-orm/mysql-core";
8
+ //#region src/schema/build-review.ts
9
+ /** Narrow `build_reviews` table definition: one verdict of one reviewer on one build. */
10
+ const buildReviews = mysqlTable("build_reviews", {
11
+ id: text("id").primaryKey(),
12
+ buildId: text("build_id").notNull().references(() => builds.id, { onDelete: "cascade" }),
13
+ userId: text("user_id").references(() => users.id, { onDelete: "cascade" }),
14
+ verdict: text("verdict").$type().notNull(),
15
+ body: text("body"),
16
+ createdAt: datetime("created_at", {
17
+ mode: "string",
18
+ fsp: 3
19
+ }).notNull()
20
+ }, (table) => [index("build_reviews_build_id_idx").on(table.buildId)]);
21
+ //#endregion
22
+ export { buildReviews };
23
+
24
+ //# 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, mysqlTable, text } from \"drizzle-orm/mysql-core\";\nimport { builds } from \"./build.ts\";\nimport { datetime } from \"./datetime.ts\";\nimport { users } from \"./user.ts\";\n\n/** Narrow `build_reviews` table definition: one verdict of one reviewer on one build. */\nexport const buildReviews = mysqlTable(\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: datetime(\"created_at\", { mode: \"string\", fsp: 3 }).notNull(),\n },\n (table) => [index(\"build_reviews_build_id_idx\").on(table.buildId)],\n);\n"],"mappings":";;;;;;;;;AAMA,MAAa,eAAe,WAC1B,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,SAAS,cAAc;EAAE,MAAM;EAAU,KAAK;CAAE,CAAC,CAAC,CAAC,QAAQ;AACxE,IACC,UAAU,CAAC,MAAM,4BAA4B,CAAC,CAAC,GAAG,MAAM,OAAO,CAAC,CACnE"}
@@ -165,7 +165,7 @@ declare const builds: import("drizzle-orm/mysql-core").MySqlTableWithColumns<{
165
165
  tableName: "builds";
166
166
  dataType: "string";
167
167
  columnType: "MySqlText";
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/mysql-core").MySqlTableWithColumns<{
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/mysql-core").MySqlColumn<{
183
183
  name: "snapshot_count";
@@ -247,6 +247,23 @@ declare const builds: import("drizzle-orm/mysql-core").MySqlTableWithColumns<{
247
247
  identity: undefined;
248
248
  generated: undefined;
249
249
  }, {}, {}>;
250
+ inheritedCount: import("drizzle-orm/mysql-core").MySqlColumn<{
251
+ name: "inherited_count";
252
+ tableName: "builds";
253
+ dataType: "number";
254
+ columnType: "MySqlInt";
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/mysql-core").MySqlColumn<{
251
268
  name: "affected_only";
252
269
  tableName: "builds";
@@ -315,13 +332,30 @@ declare const builds: import("drizzle-orm/mysql-core").MySqlTableWithColumns<{
315
332
  identity: undefined;
316
333
  generated: undefined;
317
334
  }, {}, {}>;
335
+ testResults: import("drizzle-orm/mysql-core").MySqlColumn<{
336
+ name: "test_results";
337
+ tableName: "builds";
338
+ dataType: "string";
339
+ columnType: "MySqlText";
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/mysql-core").MySqlColumn<{
319
353
  name: "created_at";
320
354
  tableName: "builds";
321
- dataType: "string";
322
- columnType: "MySqlDateTimeString";
355
+ dataType: "custom";
356
+ columnType: "MySqlCustomColumn";
323
357
  data: string;
324
- driverParam: string | number;
358
+ driverParam: string;
325
359
  notNull: true;
326
360
  hasDefault: false;
327
361
  isPrimaryKey: false;
@@ -335,10 +369,10 @@ declare const builds: import("drizzle-orm/mysql-core").MySqlTableWithColumns<{
335
369
  updatedAt: import("drizzle-orm/mysql-core").MySqlColumn<{
336
370
  name: "updated_at";
337
371
  tableName: "builds";
338
- dataType: "string";
339
- columnType: "MySqlDateTimeString";
372
+ dataType: "custom";
373
+ columnType: "MySqlCustomColumn";
340
374
  data: string;
341
- driverParam: string | number;
375
+ driverParam: string;
342
376
  notNull: true;
343
377
  hasDefault: false;
344
378
  isPrimaryKey: false;
@@ -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
  }
@@ -1,8 +1,9 @@
1
1
  import "node:path";
2
2
  import "node:url";
3
3
  import.meta.url;
4
+ import { datetime } from "./datetime.mjs";
4
5
  import { projects } from "./project.mjs";
5
- import { boolean, datetime, index, int, mysqlTable, text } from "drizzle-orm/mysql-core";
6
+ import { boolean, index, int, mysqlTable, text } from "drizzle-orm/mysql-core";
6
7
  //#region src/schema/build.ts
7
8
  /** Narrow `builds` table definition. */
8
9
  const builds = mysqlTable("builds", {
@@ -20,10 +21,13 @@ const builds = mysqlTable("builds", {
20
21
  changedCount: int("changed_count").notNull().default(0),
21
22
  approvedCount: int("approved_count").notNull().default(0),
22
23
  rejectedCount: int("rejected_count").notNull().default(0),
24
+ /** Snapshots inherited from the baseline without rendering (affected capture). */
25
+ inheritedCount: int("inherited_count").notNull().default(0),
23
26
  affectedOnly: boolean("affected_only").notNull().default(true),
24
27
  baselineSha: text("baseline_sha"),
25
28
  changedFiles: text("changed_files"),
26
29
  affectedImportPaths: text("affected_import_paths"),
30
+ testResults: text("test_results"),
27
31
  createdAt: datetime("created_at", {
28
32
  mode: "string",
29
33
  fsp: 3
@@ -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, int, mysqlTable, text, datetime } from \"drizzle-orm/mysql-core\";\nimport { projects } from \"./project.ts\";\n\n/** Narrow `builds` table definition. */\nexport const builds = mysqlTable(\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: int(\"snapshot_count\").notNull().default(0),\n changedCount: int(\"changed_count\").notNull().default(0),\n approvedCount: int(\"approved_count\").notNull().default(0),\n rejectedCount: int(\"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: datetime(\"created_at\", { mode: \"string\", fsp: 3 }).notNull(),\n updatedAt: datetime(\"updated_at\", { mode: \"string\", fsp: 3 }).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,WACpB,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,IAAI,gBAAgB,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC;CACxD,cAAc,IAAI,eAAe,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC;CACtD,eAAe,IAAI,gBAAgB,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC;CACxD,eAAe,IAAI,gBAAgB,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC;CACxD,cAAc,QAAQ,eAAe,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,IAAI;CAC7D,aAAa,KAAK,cAAc;CAChC,cAAc,KAAK,eAAe;CAClC,qBAAqB,KAAK,uBAAuB;CACjD,WAAW,SAAS,cAAc;EAAE,MAAM;EAAU,KAAK;CAAE,CAAC,CAAC,CAAC,QAAQ;CACtE,WAAW,SAAS,cAAc;EAAE,MAAM;EAAU,KAAK;CAAE,CAAC,CAAC,CAAC,QAAQ;AACxE,IACC,MAAM,CACL,MAAM,2BAA2B,CAAC,CAAC,GAAG,EAAE,WAAW,EAAE,MAAM,GAC3D,MAAM,uBAAuB,CAAC,CAAC,GAAG,EAAE,SAAS,CAC/C,CACF"}
1
+ {"version":3,"file":"build.mjs","names":[],"sources":["../../src/schema/build.ts"],"sourcesContent":["import type { BuildStatus } from \"@storyshelf/core/types\";\nimport { boolean, index, int, mysqlTable, text } from \"drizzle-orm/mysql-core\";\nimport { datetime } from \"./datetime.ts\";\nimport { projects } from \"./project.ts\";\n\n/** Narrow `builds` table definition. */\nexport const builds = mysqlTable(\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: int(\"snapshot_count\").notNull().default(0),\n changedCount: int(\"changed_count\").notNull().default(0),\n approvedCount: int(\"approved_count\").notNull().default(0),\n rejectedCount: int(\"rejected_count\").notNull().default(0),\n /** Snapshots inherited from the baseline without rendering (affected capture). */\n inheritedCount: int(\"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: datetime(\"created_at\", { mode: \"string\", fsp: 3 }).notNull(),\n updatedAt: datetime(\"updated_at\", { mode: \"string\", fsp: 3 }).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":";;;;;;;;AAMA,MAAa,SAAS,WACpB,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,IAAI,gBAAgB,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC;CACxD,cAAc,IAAI,eAAe,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC;CACtD,eAAe,IAAI,gBAAgB,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC;CACxD,eAAe,IAAI,gBAAgB,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC;;CAExD,gBAAgB,IAAI,iBAAiB,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC;CAC1D,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,SAAS,cAAc;EAAE,MAAM;EAAU,KAAK;CAAE,CAAC,CAAC,CAAC,QAAQ;CACtE,WAAW,SAAS,cAAc;EAAE,MAAM;EAAU,KAAK;CAAE,CAAC,CAAC,CAAC,QAAQ;AACxE,IACC,MAAM,CACL,MAAM,2BAA2B,CAAC,CAAC,GAAG,EAAE,WAAW,EAAE,MAAM,GAC3D,MAAM,uBAAuB,CAAC,CAAC,GAAG,EAAE,SAAS,CAC/C,CACF"}
@@ -165,10 +165,10 @@ declare const captureAttempts: import("drizzle-orm/mysql-core").MySqlTableWithCo
165
165
  queuedAt: import("drizzle-orm/mysql-core").MySqlColumn<{
166
166
  name: "queued_at";
167
167
  tableName: "capture_attempts";
168
- dataType: "string";
169
- columnType: "MySqlDateTimeString";
168
+ dataType: "custom";
169
+ columnType: "MySqlCustomColumn";
170
170
  data: string;
171
- driverParam: string | number;
171
+ driverParam: string;
172
172
  notNull: true;
173
173
  hasDefault: false;
174
174
  isPrimaryKey: false;
@@ -182,10 +182,10 @@ declare const captureAttempts: import("drizzle-orm/mysql-core").MySqlTableWithCo
182
182
  startedAt: import("drizzle-orm/mysql-core").MySqlColumn<{
183
183
  name: "started_at";
184
184
  tableName: "capture_attempts";
185
- dataType: "string";
186
- columnType: "MySqlDateTimeString";
185
+ dataType: "custom";
186
+ columnType: "MySqlCustomColumn";
187
187
  data: string;
188
- driverParam: string | number;
188
+ driverParam: string;
189
189
  notNull: false;
190
190
  hasDefault: false;
191
191
  isPrimaryKey: false;
@@ -199,10 +199,10 @@ declare const captureAttempts: import("drizzle-orm/mysql-core").MySqlTableWithCo
199
199
  finishedAt: import("drizzle-orm/mysql-core").MySqlColumn<{
200
200
  name: "finished_at";
201
201
  tableName: "capture_attempts";
202
- dataType: "string";
203
- columnType: "MySqlDateTimeString";
202
+ dataType: "custom";
203
+ columnType: "MySqlCustomColumn";
204
204
  data: string;
205
- driverParam: string | number;
205
+ driverParam: string;
206
206
  notNull: false;
207
207
  hasDefault: false;
208
208
  isPrimaryKey: false;
@@ -216,10 +216,10 @@ declare const captureAttempts: import("drizzle-orm/mysql-core").MySqlTableWithCo
216
216
  createdAt: import("drizzle-orm/mysql-core").MySqlColumn<{
217
217
  name: "created_at";
218
218
  tableName: "capture_attempts";
219
- dataType: "string";
220
- columnType: "MySqlDateTimeString";
219
+ dataType: "custom";
220
+ columnType: "MySqlCustomColumn";
221
221
  data: string;
222
- driverParam: string | number;
222
+ driverParam: string;
223
223
  notNull: true;
224
224
  hasDefault: false;
225
225
  isPrimaryKey: false;
@@ -233,10 +233,10 @@ declare const captureAttempts: import("drizzle-orm/mysql-core").MySqlTableWithCo
233
233
  updatedAt: import("drizzle-orm/mysql-core").MySqlColumn<{
234
234
  name: "updated_at";
235
235
  tableName: "capture_attempts";
236
- dataType: "string";
237
- columnType: "MySqlDateTimeString";
236
+ dataType: "custom";
237
+ columnType: "MySqlCustomColumn";
238
238
  data: string;
239
- driverParam: string | number;
239
+ driverParam: string;
240
240
  notNull: true;
241
241
  hasDefault: false;
242
242
  isPrimaryKey: false;
@@ -394,10 +394,10 @@ declare const captureLogs: import("drizzle-orm/mysql-core").MySqlTableWithColumn
394
394
  createdAt: import("drizzle-orm/mysql-core").MySqlColumn<{
395
395
  name: "created_at";
396
396
  tableName: "capture_logs";
397
- dataType: "string";
398
- columnType: "MySqlDateTimeString";
397
+ dataType: "custom";
398
+ columnType: "MySqlCustomColumn";
399
399
  data: string;
400
- driverParam: string | number;
400
+ driverParam: string;
401
401
  notNull: true;
402
402
  hasDefault: false;
403
403
  isPrimaryKey: false;
@@ -1,9 +1,10 @@
1
1
  import "node:path";
2
2
  import "node:url";
3
3
  import.meta.url;
4
+ import { datetime } from "./datetime.mjs";
4
5
  import { projects } from "./project.mjs";
5
6
  import { builds } from "./build.mjs";
6
- import { datetime, index, int, mysqlTable, text, uniqueIndex } from "drizzle-orm/mysql-core";
7
+ import { index, int, mysqlTable, text, uniqueIndex } from "drizzle-orm/mysql-core";
7
8
  //#region src/schema/capture-attempt.ts
8
9
  /** Narrow `capture_attempts` table definition: one row per build capture run. */
9
10
  const captureAttempts = mysqlTable("capture_attempts", {
@@ -1 +1 @@
1
- {"version":3,"file":"capture-attempt.mjs","names":[],"sources":["../../src/schema/capture-attempt.ts"],"sourcesContent":["import type { JobStatus } from \"@storyshelf/core/adapter/capture-queue\";\nimport { index, int, mysqlTable, text, datetime, uniqueIndex } from \"drizzle-orm/mysql-core\";\nimport { builds } from \"./build.ts\";\nimport { projects } from \"./project.ts\";\n\n/** Narrow `capture_attempts` table definition: one row per build capture run. */\nexport const captureAttempts = mysqlTable(\n \"capture_attempts\",\n {\n id: text(\"id\").primaryKey(),\n projectId: text(\"project_id\")\n .notNull()\n .references(() => projects.id, { onDelete: \"cascade\" }),\n buildId: text(\"build_id\")\n .notNull()\n .references(() => builds.id, { onDelete: \"cascade\" }),\n attemptNo: int(\"attempt_no\").notNull(),\n status: text(\"status\").$type<JobStatus>().notNull().default(\"queued\"),\n error: text(\"error\"),\n reqId: text(\"req_id\"),\n storyCount: int(\"story_count\").notNull().default(0),\n failedCount: int(\"failed_count\").notNull().default(0),\n queuedAt: datetime(\"queued_at\", { mode: \"string\", fsp: 3 }).notNull(),\n startedAt: datetime(\"started_at\", { mode: \"string\", fsp: 3 }),\n finishedAt: datetime(\"finished_at\", { mode: \"string\", fsp: 3 }),\n createdAt: datetime(\"created_at\", { mode: \"string\", fsp: 3 }).notNull(),\n updatedAt: datetime(\"updated_at\", { mode: \"string\", fsp: 3 }).notNull(),\n },\n (t) => [\n uniqueIndex(\"capture_attempts_build_no_idx\").on(t.buildId, t.attemptNo),\n index(\"capture_attempts_build_id_idx\").on(t.buildId),\n ],\n);\n\n/** Narrow `capture_logs` table definition: every log line of an attempt. */\nexport const captureLogs = mysqlTable(\n \"capture_logs\",\n {\n id: text(\"id\").primaryKey(),\n projectId: text(\"project_id\")\n .notNull()\n .references(() => projects.id, { onDelete: \"cascade\" }),\n buildId: text(\"build_id\")\n .notNull()\n .references(() => builds.id, { onDelete: \"cascade\" }),\n attemptId: text(\"attempt_id\")\n .notNull()\n .references(() => captureAttempts.id, { onDelete: \"cascade\" }),\n seq: int(\"seq\").notNull(),\n level: text(\"level\").notNull().default(\"info\"),\n message: text(\"message\").notNull(),\n fields: text(\"fields\"),\n createdAt: datetime(\"created_at\", { mode: \"string\", fsp: 3 }).notNull(),\n },\n (t) => [index(\"capture_logs_attempt_seq_idx\").on(t.attemptId, t.seq)],\n);\n\n/** A capture attempt row. */\nexport interface CaptureAttempt {\n id: string;\n projectId: string;\n buildId: string;\n attemptNo: number;\n status: JobStatus;\n error: string | null;\n reqId: string | null;\n storyCount: number;\n failedCount: number;\n queuedAt: string;\n startedAt: string | null;\n finishedAt: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\n/** A capture log line row. */\nexport interface CaptureLog {\n id: string;\n projectId: string;\n buildId: string;\n attemptId: string;\n seq: number;\n level: string;\n message: string;\n fields: string | null;\n createdAt: string;\n}\n"],"mappings":";;;;;;;;AAMA,MAAa,kBAAkB,WAC7B,oBACA;CACE,IAAI,KAAK,IAAI,CAAC,CAAC,WAAW;CAC1B,WAAW,KAAK,YAAY,CAAC,CAC1B,QAAQ,CAAC,CACT,iBAAiB,SAAS,IAAI,EAAE,UAAU,UAAU,CAAC;CACxD,SAAS,KAAK,UAAU,CAAC,CACtB,QAAQ,CAAC,CACT,iBAAiB,OAAO,IAAI,EAAE,UAAU,UAAU,CAAC;CACtD,WAAW,IAAI,YAAY,CAAC,CAAC,QAAQ;CACrC,QAAQ,KAAK,QAAQ,CAAC,CAAC,MAAiB,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,QAAQ;CACpE,OAAO,KAAK,OAAO;CACnB,OAAO,KAAK,QAAQ;CACpB,YAAY,IAAI,aAAa,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC;CAClD,aAAa,IAAI,cAAc,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC;CACpD,UAAU,SAAS,aAAa;EAAE,MAAM;EAAU,KAAK;CAAE,CAAC,CAAC,CAAC,QAAQ;CACpE,WAAW,SAAS,cAAc;EAAE,MAAM;EAAU,KAAK;CAAE,CAAC;CAC5D,YAAY,SAAS,eAAe;EAAE,MAAM;EAAU,KAAK;CAAE,CAAC;CAC9D,WAAW,SAAS,cAAc;EAAE,MAAM;EAAU,KAAK;CAAE,CAAC,CAAC,CAAC,QAAQ;CACtE,WAAW,SAAS,cAAc;EAAE,MAAM;EAAU,KAAK;CAAE,CAAC,CAAC,CAAC,QAAQ;AACxE,IACC,MAAM,CACL,YAAY,+BAA+B,CAAC,CAAC,GAAG,EAAE,SAAS,EAAE,SAAS,GACtE,MAAM,+BAA+B,CAAC,CAAC,GAAG,EAAE,OAAO,CACrD,CACF;;AAGA,MAAa,cAAc,WACzB,gBACA;CACE,IAAI,KAAK,IAAI,CAAC,CAAC,WAAW;CAC1B,WAAW,KAAK,YAAY,CAAC,CAC1B,QAAQ,CAAC,CACT,iBAAiB,SAAS,IAAI,EAAE,UAAU,UAAU,CAAC;CACxD,SAAS,KAAK,UAAU,CAAC,CACtB,QAAQ,CAAC,CACT,iBAAiB,OAAO,IAAI,EAAE,UAAU,UAAU,CAAC;CACtD,WAAW,KAAK,YAAY,CAAC,CAC1B,QAAQ,CAAC,CACT,iBAAiB,gBAAgB,IAAI,EAAE,UAAU,UAAU,CAAC;CAC/D,KAAK,IAAI,KAAK,CAAC,CAAC,QAAQ;CACxB,OAAO,KAAK,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,MAAM;CAC7C,SAAS,KAAK,SAAS,CAAC,CAAC,QAAQ;CACjC,QAAQ,KAAK,QAAQ;CACrB,WAAW,SAAS,cAAc;EAAE,MAAM;EAAU,KAAK;CAAE,CAAC,CAAC,CAAC,QAAQ;AACxE,IACC,MAAM,CAAC,MAAM,8BAA8B,CAAC,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,CAAC,CACtE"}
1
+ {"version":3,"file":"capture-attempt.mjs","names":[],"sources":["../../src/schema/capture-attempt.ts"],"sourcesContent":["import type { JobStatus } from \"@storyshelf/core/adapter/capture-queue\";\nimport { index, int, mysqlTable, text, uniqueIndex } from \"drizzle-orm/mysql-core\";\nimport { builds } from \"./build.ts\";\nimport { datetime } from \"./datetime.ts\";\nimport { projects } from \"./project.ts\";\n\n/** Narrow `capture_attempts` table definition: one row per build capture run. */\nexport const captureAttempts = mysqlTable(\n \"capture_attempts\",\n {\n id: text(\"id\").primaryKey(),\n projectId: text(\"project_id\")\n .notNull()\n .references(() => projects.id, { onDelete: \"cascade\" }),\n buildId: text(\"build_id\")\n .notNull()\n .references(() => builds.id, { onDelete: \"cascade\" }),\n attemptNo: int(\"attempt_no\").notNull(),\n status: text(\"status\").$type<JobStatus>().notNull().default(\"queued\"),\n error: text(\"error\"),\n reqId: text(\"req_id\"),\n storyCount: int(\"story_count\").notNull().default(0),\n failedCount: int(\"failed_count\").notNull().default(0),\n queuedAt: datetime(\"queued_at\", { mode: \"string\", fsp: 3 }).notNull(),\n startedAt: datetime(\"started_at\", { mode: \"string\", fsp: 3 }),\n finishedAt: datetime(\"finished_at\", { mode: \"string\", fsp: 3 }),\n createdAt: datetime(\"created_at\", { mode: \"string\", fsp: 3 }).notNull(),\n updatedAt: datetime(\"updated_at\", { mode: \"string\", fsp: 3 }).notNull(),\n },\n (t) => [\n uniqueIndex(\"capture_attempts_build_no_idx\").on(t.buildId, t.attemptNo),\n index(\"capture_attempts_build_id_idx\").on(t.buildId),\n ],\n);\n\n/** Narrow `capture_logs` table definition: every log line of an attempt. */\nexport const captureLogs = mysqlTable(\n \"capture_logs\",\n {\n id: text(\"id\").primaryKey(),\n projectId: text(\"project_id\")\n .notNull()\n .references(() => projects.id, { onDelete: \"cascade\" }),\n buildId: text(\"build_id\")\n .notNull()\n .references(() => builds.id, { onDelete: \"cascade\" }),\n attemptId: text(\"attempt_id\")\n .notNull()\n .references(() => captureAttempts.id, { onDelete: \"cascade\" }),\n seq: int(\"seq\").notNull(),\n level: text(\"level\").notNull().default(\"info\"),\n message: text(\"message\").notNull(),\n fields: text(\"fields\"),\n createdAt: datetime(\"created_at\", { mode: \"string\", fsp: 3 }).notNull(),\n },\n (t) => [index(\"capture_logs_attempt_seq_idx\").on(t.attemptId, t.seq)],\n);\n\n/** A capture attempt row. */\nexport interface CaptureAttempt {\n id: string;\n projectId: string;\n buildId: string;\n attemptNo: number;\n status: JobStatus;\n error: string | null;\n reqId: string | null;\n storyCount: number;\n failedCount: number;\n queuedAt: string;\n startedAt: string | null;\n finishedAt: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\n/** A capture log line row. */\nexport interface CaptureLog {\n id: string;\n projectId: string;\n buildId: string;\n attemptId: string;\n seq: number;\n level: string;\n message: string;\n fields: string | null;\n createdAt: string;\n}\n"],"mappings":";;;;;;;;;AAOA,MAAa,kBAAkB,WAC7B,oBACA;CACE,IAAI,KAAK,IAAI,CAAC,CAAC,WAAW;CAC1B,WAAW,KAAK,YAAY,CAAC,CAC1B,QAAQ,CAAC,CACT,iBAAiB,SAAS,IAAI,EAAE,UAAU,UAAU,CAAC;CACxD,SAAS,KAAK,UAAU,CAAC,CACtB,QAAQ,CAAC,CACT,iBAAiB,OAAO,IAAI,EAAE,UAAU,UAAU,CAAC;CACtD,WAAW,IAAI,YAAY,CAAC,CAAC,QAAQ;CACrC,QAAQ,KAAK,QAAQ,CAAC,CAAC,MAAiB,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,QAAQ;CACpE,OAAO,KAAK,OAAO;CACnB,OAAO,KAAK,QAAQ;CACpB,YAAY,IAAI,aAAa,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC;CAClD,aAAa,IAAI,cAAc,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC;CACpD,UAAU,SAAS,aAAa;EAAE,MAAM;EAAU,KAAK;CAAE,CAAC,CAAC,CAAC,QAAQ;CACpE,WAAW,SAAS,cAAc;EAAE,MAAM;EAAU,KAAK;CAAE,CAAC;CAC5D,YAAY,SAAS,eAAe;EAAE,MAAM;EAAU,KAAK;CAAE,CAAC;CAC9D,WAAW,SAAS,cAAc;EAAE,MAAM;EAAU,KAAK;CAAE,CAAC,CAAC,CAAC,QAAQ;CACtE,WAAW,SAAS,cAAc;EAAE,MAAM;EAAU,KAAK;CAAE,CAAC,CAAC,CAAC,QAAQ;AACxE,IACC,MAAM,CACL,YAAY,+BAA+B,CAAC,CAAC,GAAG,EAAE,SAAS,EAAE,SAAS,GACtE,MAAM,+BAA+B,CAAC,CAAC,GAAG,EAAE,OAAO,CACrD,CACF;;AAGA,MAAa,cAAc,WACzB,gBACA;CACE,IAAI,KAAK,IAAI,CAAC,CAAC,WAAW;CAC1B,WAAW,KAAK,YAAY,CAAC,CAC1B,QAAQ,CAAC,CACT,iBAAiB,SAAS,IAAI,EAAE,UAAU,UAAU,CAAC;CACxD,SAAS,KAAK,UAAU,CAAC,CACtB,QAAQ,CAAC,CACT,iBAAiB,OAAO,IAAI,EAAE,UAAU,UAAU,CAAC;CACtD,WAAW,KAAK,YAAY,CAAC,CAC1B,QAAQ,CAAC,CACT,iBAAiB,gBAAgB,IAAI,EAAE,UAAU,UAAU,CAAC;CAC/D,KAAK,IAAI,KAAK,CAAC,CAAC,QAAQ;CACxB,OAAO,KAAK,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,MAAM;CAC7C,SAAS,KAAK,SAAS,CAAC,CAAC,QAAQ;CACjC,QAAQ,KAAK,QAAQ;CACrB,WAAW,SAAS,cAAc;EAAE,MAAM;EAAU,KAAK;CAAE,CAAC,CAAC,CAAC,QAAQ;AACxE,IACC,MAAM,CAAC,MAAM,8BAA8B,CAAC,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,CAAC,CACtE"}