@storyshelf/db-sqlite 0.6.2 → 0.8.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 +9 -9
- package/dist/better-sqlite3.d.mts +0 -2
- package/dist/better-sqlite3.mjs +8 -4
- package/dist/better-sqlite3.mjs.map +1 -1
- package/dist/bun-sqlite.d.mts +0 -2
- package/dist/bun-sqlite.mjs +8 -4
- package/dist/bun-sqlite.mjs.map +1 -1
- package/dist/d1.d.mts +0 -2
- package/dist/d1.mjs +6 -5
- package/dist/d1.mjs.map +1 -1
- package/dist/ddl.d.mts +10 -4
- package/dist/ddl.mjs +247 -16
- package/dist/ddl.mjs.map +1 -1
- package/dist/drizzle-factory.d.mts +0 -2
- package/dist/drizzle-factory.mjs +6 -3
- package/dist/drizzle-factory.mjs.map +1 -1
- package/dist/ensure-db-dir.mjs +2 -4
- package/dist/ensure-db-dir.mjs.map +1 -1
- package/dist/index.d.mts +4 -3
- package/dist/index.mjs +9 -5
- package/dist/index.mjs.map +1 -1
- package/dist/schema/baseline.d.mts +87 -13
- package/dist/schema/baseline.mjs +6 -3
- package/dist/schema/baseline.mjs.map +1 -1
- package/dist/schema/{status-config.d.mts → build-component.d.mts} +41 -36
- package/dist/schema/build-component.mjs +21 -0
- package/dist/schema/build-component.mjs.map +1 -0
- package/dist/schema/build-review.d.mts +127 -0
- package/dist/schema/build-review.mjs +19 -0
- package/dist/schema/build-review.mjs.map +1 -0
- package/dist/schema/build.d.mts +81 -25
- package/dist/schema/build.mjs +5 -2
- package/dist/schema/build.mjs.map +1 -1
- package/dist/schema/capture-attempt.d.mts +25 -27
- package/dist/schema/capture-attempt.mjs +1 -2
- package/dist/schema/capture-job.d.mts +357 -0
- package/dist/schema/capture-job.mjs +37 -0
- package/dist/schema/capture-job.mjs.map +1 -0
- package/dist/schema/capture-shard.d.mts +279 -0
- package/dist/schema/capture-shard.mjs +27 -0
- package/dist/schema/capture-shard.mjs.map +1 -0
- package/dist/schema/comment.d.mts +31 -13
- package/dist/schema/comment.mjs +4 -4
- package/dist/schema/comment.mjs.map +1 -1
- package/dist/schema/connection.d.mts +189 -0
- package/dist/schema/connection.mjs +25 -0
- package/dist/schema/connection.mjs.map +1 -0
- package/dist/schema/content-refs.d.mts +0 -2
- package/dist/schema/content-refs.mjs +1 -2
- package/dist/schema/design.d.mts +647 -0
- package/dist/schema/design.mjs +48 -0
- package/dist/schema/design.mjs.map +1 -0
- package/dist/schema/insight.d.mts +687 -0
- package/dist/schema/insight.mjs +52 -0
- package/dist/schema/insight.mjs.map +1 -0
- package/dist/schema/label.d.mts +15 -17
- package/dist/schema/label.mjs +1 -2
- package/dist/schema/member.d.mts +7 -9
- package/dist/schema/member.mjs +1 -2
- package/dist/schema/notification.d.mts +58 -20
- package/dist/schema/notification.mjs +3 -2
- package/dist/schema/notification.mjs.map +1 -1
- package/dist/schema/project-group-mapping.d.mts +6 -8
- package/dist/schema/project-group-mapping.mjs +1 -2
- package/dist/schema/project.d.mts +132 -2
- package/dist/schema/project.mjs +9 -3
- package/dist/schema/project.mjs.map +1 -1
- package/dist/schema/site-setting.d.mts +107 -0
- package/dist/schema/site-setting.mjs +16 -0
- package/dist/schema/site-setting.mjs.map +1 -0
- package/dist/schema/snapshot.d.mts +203 -27
- package/dist/schema/snapshot.mjs +15 -3
- package/dist/schema/snapshot.mjs.map +1 -1
- package/dist/schema/token.d.mts +8 -10
- package/dist/schema/token.mjs +1 -2
- package/dist/schema/usage.d.mts +291 -0
- package/dist/schema/usage.mjs +29 -0
- package/dist/schema/usage.mjs.map +1 -0
- package/dist/schema/user-invite.d.mts +7 -9
- package/dist/schema/user-invite.mjs +1 -2
- package/dist/schema/user.d.mts +0 -2
- package/dist/schema/user.mjs +1 -2
- package/dist/schema/webhook.d.mts +8 -10
- package/dist/schema/webhook.mjs +1 -2
- package/dist/schema.d.mts +24 -5
- package/dist/schema.mjs +26 -6
- package/dist/schema.mjs.map +1 -1
- package/dist/turso.d.mts +2 -4
- package/dist/turso.mjs +20 -8
- package/dist/turso.mjs.map +1 -1
- package/package.json +7 -7
- package/dist/schema/status-config.mjs +0 -20
- package/dist/schema/status-config.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import "node:path";
|
|
2
2
|
import "node:url";
|
|
3
3
|
import.meta.url;
|
|
4
|
-
import { DDL, tableColumns } from "./ddl.mjs";
|
|
4
|
+
import { DDL, IDENTITY_STATEMENTS, tableColumns } from "./ddl.mjs";
|
|
5
5
|
import { createDrizzleAdapter } from "./drizzle-factory.mjs";
|
|
6
6
|
import { ensureDbDir } from "./ensure-db-dir.mjs";
|
|
7
7
|
import { schema } from "./schema.mjs";
|
|
8
8
|
import { drizzle } from "drizzle-orm/sqlite-proxy";
|
|
9
9
|
import { DatabaseSync } from "node:sqlite";
|
|
10
|
-
|
|
10
|
+
// src/index.ts
|
|
11
11
|
/**
|
|
12
12
|
* Create a SQLite-backed DatabaseAdapter using node:sqlite and Drizzle ORM.
|
|
13
13
|
*
|
|
@@ -24,7 +24,7 @@ function createSqliteDatabase(path) {
|
|
|
24
24
|
return createDrizzleAdapter(db, {
|
|
25
25
|
metadata: {
|
|
26
26
|
name: "SQLite",
|
|
27
|
-
version:
|
|
27
|
+
version: "0.8.0",
|
|
28
28
|
description: "SQLite database adapter (node:sqlite + Drizzle)",
|
|
29
29
|
kind: "sqlite",
|
|
30
30
|
category: "database"
|
|
@@ -112,10 +112,15 @@ function ensureColumns(sqlite, ddl) {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
+
/** Swap in the browser-aware unique indexes (after `ensureColumns` added the column). */
|
|
116
|
+
function applyIdentityStatements(sqlite) {
|
|
117
|
+
for (const statement of IDENTITY_STATEMENTS) execIgnore(sqlite, statement);
|
|
118
|
+
}
|
|
115
119
|
function runMigrations(sqlite) {
|
|
116
120
|
sqlite.exec("PRAGMA foreign_keys = ON");
|
|
117
121
|
sqlite.exec(DDL);
|
|
118
122
|
ensureColumns(sqlite, DDL);
|
|
123
|
+
applyIdentityStatements(sqlite);
|
|
119
124
|
try {
|
|
120
125
|
sqlite.exec(WEBHOOK_SECRET_DROP);
|
|
121
126
|
} catch {}
|
|
@@ -133,7 +138,6 @@ function migrateBuildsGitShaIndex(sqlite) {
|
|
|
133
138
|
sqlite.exec(BUILDS_GITSHA_INDEX);
|
|
134
139
|
} catch {}
|
|
135
140
|
}
|
|
136
|
-
|
|
137
|
-
export { createSqliteDatabase };
|
|
141
|
+
export { createCallback, createSqliteDatabase };
|
|
138
142
|
|
|
139
143
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { DatabaseAdapter } from \"@storyshelf/core/adapter/database\";\nimport { drizzle, type AsyncRemoteCallback } from \"drizzle-orm/sqlite-proxy\";\nimport { DatabaseSync, type SQLInputValue } from \"node:sqlite\";\nimport { DDL, tableColumns } from \"./ddl.ts\";\nimport { createDrizzleAdapter } from \"./drizzle-factory.ts\";\nimport { ensureDbDir } from \"./ensure-db-dir.ts\";\nimport { schema } from \"./schema/index.ts\";\n\ndeclare const __PKG_VERSION__: string | undefined;\n\n/**\n * Create a SQLite-backed DatabaseAdapter using node:sqlite and Drizzle ORM.\n *\n * @param path - Filesystem path to the SQLite database file.\n * @returns A DatabaseAdapter backed by the given SQLite file (WAL mode).\n */\nexport function createSqliteDatabase(path: string): DatabaseAdapter {\n ensureDbDir(path);\n const sqlite = new DatabaseSync(path, { returnArrays: true });\n sqlite.exec(\"PRAGMA journal_mode = WAL\");\n sqlite.exec(\"PRAGMA busy_timeout = 5000\");\n const callback = createCallback(sqlite);\n const db = drizzle(callback, { schema });\n\n return createDrizzleAdapter(db, {\n metadata: {\n name: \"SQLite\",\n version:
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { DatabaseAdapter } from \"@storyshelf/core/adapter/database\";\nimport { drizzle, type AsyncRemoteCallback } from \"drizzle-orm/sqlite-proxy\";\nimport { DatabaseSync, type SQLInputValue } from \"node:sqlite\";\nimport { DDL, IDENTITY_STATEMENTS, tableColumns } from \"./ddl.ts\";\nimport { createDrizzleAdapter } from \"./drizzle-factory.ts\";\nimport { ensureDbDir } from \"./ensure-db-dir.ts\";\nimport { schema } from \"./schema/index.ts\";\n\ndeclare const __PKG_VERSION__: string | undefined;\n\n/**\n * Create a SQLite-backed DatabaseAdapter using node:sqlite and Drizzle ORM.\n *\n * @param path - Filesystem path to the SQLite database file.\n * @returns A DatabaseAdapter backed by the given SQLite file (WAL mode).\n */\nexport function createSqliteDatabase(path: string): DatabaseAdapter {\n ensureDbDir(path);\n const sqlite = new DatabaseSync(path, { returnArrays: true });\n sqlite.exec(\"PRAGMA journal_mode = WAL\");\n sqlite.exec(\"PRAGMA busy_timeout = 5000\");\n const callback = createCallback(sqlite);\n const db = drizzle(callback, { schema });\n\n return createDrizzleAdapter(db, {\n metadata: {\n name: \"SQLite\",\n version: typeof __PKG_VERSION__ === \"string\" ? __PKG_VERSION__ : \"0.0.0\",\n description: \"SQLite database adapter (node:sqlite + Drizzle)\",\n kind: \"sqlite\",\n category: \"database\",\n },\n tables: schema,\n migrate: () => {\n runMigrations(sqlite);\n },\n close: () => {\n sqlite.close();\n },\n ping: () => {\n sqlite.prepare(\"SELECT 1\").get();\n },\n });\n}\n\nconst WEBHOOK_SECRET_DROP = \"ALTER TABLE webhooks DROP COLUMN secret\";\n\n/**\n * Re-runs share `(project_id, git_sha)` by design (ULID build ids), so the\n * lookup index must not be unique. Existing databases created it UNIQUE —\n * drop and recreate it plain.\n */\nconst BUILDS_GITSHA_DEDUP = \"DROP INDEX IF EXISTS builds_project_gitsha_idx\";\nconst BUILDS_GITSHA_INDEX =\n \"CREATE INDEX IF NOT EXISTS builds_project_gitsha_idx ON builds (project_id, git_sha)\";\n\ntype ProxyMethod = \"run\" | \"all\" | \"values\" | \"get\";\n\n/**\n * Execute one Drizzle statement against DatabaseSync, returning proxy-shaped rows.\n * Drizzle builds the SQL and params; only the transport is hand-written.\n * `values` shares the `all` shape (array rows); the factory never emits it.\n * Note: for `get`, the proxy passes `result.rows` straight to the row mapper,\n * so `rows` is the single row (or undefined on a miss) — not a one-row array.\n */\nfunction executeStatement(\n sqlite: DatabaseSync,\n sql: string,\n params: unknown[],\n method: ProxyMethod,\n): { rows: unknown } {\n const stmt = sqlite.prepare(sql);\n // Single contained cast: Drizzle's params are SQLite scalars by construction.\n // oxlint-disable-next-line typescript/no-unnecessary-type-assertion -- tsc requires the narrowing; the rule misfires on the variadic overloads\n const args = params as SQLInputValue[];\n if (method === \"run\") {\n stmt.run(...args);\n return { rows: [] };\n }\n if (method === \"get\") {\n return { rows: stmt.get(...args) };\n }\n return { rows: stmt.all(...args) };\n}\n\nexport function createCallback(sqlite: DatabaseSync): AsyncRemoteCallback {\n const callback = (async (sql: string, params: unknown[], method: ProxyMethod) => {\n await Promise.resolve();\n return executeStatement(sqlite, sql, params, method);\n }) as AsyncRemoteCallback;\n return callback;\n}\n\nfunction execIgnore(sqlite: DatabaseSync, sql: string): void {\n try {\n sqlite.exec(sql);\n } catch {\n // idempotent — column already exists or other no-op\n }\n}\n\nfunction migrateCommentsTable(sqlite: DatabaseSync): void {\n const row = sqlite\n .prepare(\"SELECT sql FROM sqlite_master WHERE type='table' AND name='comments'\")\n .get() as { sql: string } | undefined;\n if (!row?.sql.includes(\"user_id TEXT NOT NULL REFERENCES users\")) {\n return;\n }\n sqlite.exec(\"PRAGMA foreign_keys = OFF\");\n sqlite.exec(`\n CREATE TABLE comments_new (\n id TEXT PRIMARY KEY,\n project_id TEXT NOT NULL REFERENCES projects(id) ON DELETE CASCADE,\n build_id TEXT NOT NULL REFERENCES builds(id) ON DELETE CASCADE,\n snapshot_id TEXT REFERENCES snapshots(id) ON DELETE CASCADE,\n user_id TEXT REFERENCES users(id) ON DELETE CASCADE,\n body TEXT NOT NULL,\n parent_id TEXT,\n resolved INTEGER NOT NULL DEFAULT 0,\n created_at TEXT NOT NULL,\n updated_at TEXT NOT NULL\n )\n `);\n sqlite.exec(\"INSERT INTO comments_new SELECT * FROM comments\");\n sqlite.exec(\"DROP TABLE comments\");\n sqlite.exec(\"ALTER TABLE comments_new RENAME TO comments\");\n sqlite.exec(\"CREATE INDEX IF NOT EXISTS comments_build_id_idx ON comments (build_id)\");\n sqlite.exec(\"PRAGMA foreign_keys = ON\");\n}\n\n/** Add any DDL column missing from a volume created before it shipped. */\nfunction ensureColumns(sqlite: DatabaseSync, ddl: string): void {\n for (const [table, columns] of tableColumns(ddl)) {\n const rows = sqlite.prepare(`PRAGMA table_info(${table})`).all() as unknown as unknown[][];\n const existing = new Set(rows.map((row) => String(row[1])));\n for (const column of columns) {\n const [name] = column.split(/\\s+/u);\n if (name && !existing.has(name)) {\n execIgnore(sqlite, `ALTER TABLE ${table} ADD COLUMN ${column}`);\n }\n }\n }\n}\n\n/** Swap in the browser-aware unique indexes (after `ensureColumns` added the column). */\nfunction applyIdentityStatements(sqlite: DatabaseSync): void {\n for (const statement of IDENTITY_STATEMENTS) {\n execIgnore(sqlite, statement);\n }\n}\n\nfunction runMigrations(sqlite: DatabaseSync): void {\n sqlite.exec(\"PRAGMA foreign_keys = ON\");\n sqlite.exec(DDL);\n ensureColumns(sqlite, DDL);\n applyIdentityStatements(sqlite);\n try {\n sqlite.exec(WEBHOOK_SECRET_DROP);\n } catch {\n // already migrated — ignore\n }\n migrateBuildsGitShaIndex(sqlite);\n try {\n migrateCommentsTable(sqlite);\n } catch {\n execIgnore(sqlite, \"PRAGMA foreign_keys = ON\");\n }\n}\n\n/** Downgrade a legacy UNIQUE project/sha index to a plain lookup index. */\nfunction migrateBuildsGitShaIndex(sqlite: DatabaseSync): void {\n try {\n sqlite.exec(BUILDS_GITSHA_DEDUP);\n sqlite.exec(BUILDS_GITSHA_INDEX);\n } catch {\n // already migrated — ignore\n }\n}\n"],"mappings":"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"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import __tsdown_shims_path from 'node:path';
|
|
2
2
|
import __tsdown_shims_url from 'node:url';
|
|
3
|
-
//#region src/schema/baseline.d.ts
|
|
4
3
|
/** Narrow `baselines` table definition. */
|
|
5
|
-
declare const baselines: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
4
|
+
declare const baselines: import("drizzle-orm/sqlite-core/table.js").SQLiteTableWithColumns<{
|
|
6
5
|
name: "baselines";
|
|
7
6
|
schema: undefined;
|
|
8
7
|
columns: {
|
|
9
|
-
id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
8
|
+
id: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
|
|
10
9
|
name: "id";
|
|
11
10
|
tableName: "baselines";
|
|
12
11
|
dataType: "string";
|
|
@@ -25,7 +24,7 @@ declare const baselines: import("drizzle-orm/sqlite-core").SQLiteTableWithColumn
|
|
|
25
24
|
}, {}, {
|
|
26
25
|
length: number | undefined;
|
|
27
26
|
}>;
|
|
28
|
-
projectId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
27
|
+
projectId: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
|
|
29
28
|
name: "project_id";
|
|
30
29
|
tableName: "baselines";
|
|
31
30
|
dataType: "string";
|
|
@@ -44,7 +43,7 @@ declare const baselines: import("drizzle-orm/sqlite-core").SQLiteTableWithColumn
|
|
|
44
43
|
}, {}, {
|
|
45
44
|
length: number | undefined;
|
|
46
45
|
}>;
|
|
47
|
-
storyId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
46
|
+
storyId: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
|
|
48
47
|
name: "story_id";
|
|
49
48
|
tableName: "baselines";
|
|
50
49
|
dataType: "string";
|
|
@@ -63,7 +62,7 @@ declare const baselines: import("drizzle-orm/sqlite-core").SQLiteTableWithColumn
|
|
|
63
62
|
}, {}, {
|
|
64
63
|
length: number | undefined;
|
|
65
64
|
}>;
|
|
66
|
-
viewportName: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
65
|
+
viewportName: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
|
|
67
66
|
name: "viewport_name";
|
|
68
67
|
tableName: "baselines";
|
|
69
68
|
dataType: "string";
|
|
@@ -82,7 +81,7 @@ declare const baselines: import("drizzle-orm/sqlite-core").SQLiteTableWithColumn
|
|
|
82
81
|
}, {}, {
|
|
83
82
|
length: number | undefined;
|
|
84
83
|
}>;
|
|
85
|
-
branch: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
84
|
+
branch: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
|
|
86
85
|
name: "branch";
|
|
87
86
|
tableName: "baselines";
|
|
88
87
|
dataType: "string";
|
|
@@ -101,7 +100,7 @@ declare const baselines: import("drizzle-orm/sqlite-core").SQLiteTableWithColumn
|
|
|
101
100
|
}, {}, {
|
|
102
101
|
length: number | undefined;
|
|
103
102
|
}>;
|
|
104
|
-
snapshotId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
103
|
+
snapshotId: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
|
|
105
104
|
name: "snapshot_id";
|
|
106
105
|
tableName: "baselines";
|
|
107
106
|
dataType: "string";
|
|
@@ -120,7 +119,26 @@ declare const baselines: import("drizzle-orm/sqlite-core").SQLiteTableWithColumn
|
|
|
120
119
|
}, {}, {
|
|
121
120
|
length: number | undefined;
|
|
122
121
|
}>;
|
|
123
|
-
|
|
122
|
+
sourceBuildId: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
|
|
123
|
+
name: "source_build_id";
|
|
124
|
+
tableName: "baselines";
|
|
125
|
+
dataType: "string";
|
|
126
|
+
columnType: "SQLiteText";
|
|
127
|
+
data: string;
|
|
128
|
+
driverParam: string;
|
|
129
|
+
notNull: false;
|
|
130
|
+
hasDefault: false;
|
|
131
|
+
isPrimaryKey: false;
|
|
132
|
+
isAutoincrement: false;
|
|
133
|
+
hasRuntimeDefault: false;
|
|
134
|
+
enumValues: [string, ...string[]];
|
|
135
|
+
baseColumn: never;
|
|
136
|
+
identity: undefined;
|
|
137
|
+
generated: undefined;
|
|
138
|
+
}, {}, {
|
|
139
|
+
length: number | undefined;
|
|
140
|
+
}>;
|
|
141
|
+
screenshotPath: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
|
|
124
142
|
name: "screenshot_path";
|
|
125
143
|
tableName: "baselines";
|
|
126
144
|
dataType: "string";
|
|
@@ -139,7 +157,7 @@ declare const baselines: import("drizzle-orm/sqlite-core").SQLiteTableWithColumn
|
|
|
139
157
|
}, {}, {
|
|
140
158
|
length: number | undefined;
|
|
141
159
|
}>;
|
|
142
|
-
infraHash: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
160
|
+
infraHash: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
|
|
143
161
|
name: "infra_hash";
|
|
144
162
|
tableName: "baselines";
|
|
145
163
|
dataType: "string";
|
|
@@ -158,7 +176,64 @@ declare const baselines: import("drizzle-orm/sqlite-core").SQLiteTableWithColumn
|
|
|
158
176
|
}, {}, {
|
|
159
177
|
length: number | undefined;
|
|
160
178
|
}>;
|
|
161
|
-
|
|
179
|
+
fingerprint: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
|
|
180
|
+
name: "fingerprint";
|
|
181
|
+
tableName: "baselines";
|
|
182
|
+
dataType: "string";
|
|
183
|
+
columnType: "SQLiteText";
|
|
184
|
+
data: string;
|
|
185
|
+
driverParam: string;
|
|
186
|
+
notNull: false;
|
|
187
|
+
hasDefault: false;
|
|
188
|
+
isPrimaryKey: false;
|
|
189
|
+
isAutoincrement: false;
|
|
190
|
+
hasRuntimeDefault: false;
|
|
191
|
+
enumValues: [string, ...string[]];
|
|
192
|
+
baseColumn: never;
|
|
193
|
+
identity: undefined;
|
|
194
|
+
generated: undefined;
|
|
195
|
+
}, {}, {
|
|
196
|
+
length: number | undefined;
|
|
197
|
+
}>;
|
|
198
|
+
mode: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
|
|
199
|
+
name: "mode";
|
|
200
|
+
tableName: "baselines";
|
|
201
|
+
dataType: "string";
|
|
202
|
+
columnType: "SQLiteText";
|
|
203
|
+
data: string;
|
|
204
|
+
driverParam: string;
|
|
205
|
+
notNull: false;
|
|
206
|
+
hasDefault: false;
|
|
207
|
+
isPrimaryKey: false;
|
|
208
|
+
isAutoincrement: false;
|
|
209
|
+
hasRuntimeDefault: false;
|
|
210
|
+
enumValues: [string, ...string[]];
|
|
211
|
+
baseColumn: never;
|
|
212
|
+
identity: undefined;
|
|
213
|
+
generated: undefined;
|
|
214
|
+
}, {}, {
|
|
215
|
+
length: number | undefined;
|
|
216
|
+
}>;
|
|
217
|
+
browser: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
|
|
218
|
+
name: "browser";
|
|
219
|
+
tableName: "baselines";
|
|
220
|
+
dataType: "string";
|
|
221
|
+
columnType: "SQLiteText";
|
|
222
|
+
data: string;
|
|
223
|
+
driverParam: string;
|
|
224
|
+
notNull: true;
|
|
225
|
+
hasDefault: true;
|
|
226
|
+
isPrimaryKey: false;
|
|
227
|
+
isAutoincrement: false;
|
|
228
|
+
hasRuntimeDefault: false;
|
|
229
|
+
enumValues: [string, ...string[]];
|
|
230
|
+
baseColumn: never;
|
|
231
|
+
identity: undefined;
|
|
232
|
+
generated: undefined;
|
|
233
|
+
}, {}, {
|
|
234
|
+
length: number | undefined;
|
|
235
|
+
}>;
|
|
236
|
+
createdAt: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
|
|
162
237
|
name: "created_at";
|
|
163
238
|
tableName: "baselines";
|
|
164
239
|
dataType: "string";
|
|
@@ -177,7 +252,7 @@ declare const baselines: import("drizzle-orm/sqlite-core").SQLiteTableWithColumn
|
|
|
177
252
|
}, {}, {
|
|
178
253
|
length: number | undefined;
|
|
179
254
|
}>;
|
|
180
|
-
updatedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
255
|
+
updatedAt: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
|
|
181
256
|
name: "updated_at";
|
|
182
257
|
tableName: "baselines";
|
|
183
258
|
dataType: "string";
|
|
@@ -199,6 +274,5 @@ declare const baselines: import("drizzle-orm/sqlite-core").SQLiteTableWithColumn
|
|
|
199
274
|
};
|
|
200
275
|
dialect: 'sqlite';
|
|
201
276
|
}>;
|
|
202
|
-
//#endregion
|
|
203
277
|
export { baselines };
|
|
204
278
|
//# sourceMappingURL=baseline.d.mts.map
|
package/dist/schema/baseline.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import "node:url";
|
|
|
3
3
|
import.meta.url;
|
|
4
4
|
import { projects } from "./project.mjs";
|
|
5
5
|
import { index, sqliteTable, text, uniqueIndex } from "drizzle-orm/sqlite-core";
|
|
6
|
-
|
|
6
|
+
// src/schema/baseline.ts
|
|
7
7
|
/** Narrow `baselines` table definition. */
|
|
8
8
|
const baselines = sqliteTable("baselines", {
|
|
9
9
|
id: text("id").primaryKey(),
|
|
@@ -12,12 +12,15 @@ const baselines = sqliteTable("baselines", {
|
|
|
12
12
|
viewportName: text("viewport_name").notNull().default("desktop"),
|
|
13
13
|
branch: text("branch").notNull(),
|
|
14
14
|
snapshotId: text("snapshot_id"),
|
|
15
|
+
sourceBuildId: text("source_build_id"),
|
|
15
16
|
screenshotPath: text("screenshot_path").notNull(),
|
|
16
17
|
infraHash: text("infra_hash"),
|
|
18
|
+
fingerprint: text("fingerprint"),
|
|
19
|
+
mode: text("mode"),
|
|
20
|
+
browser: text("browser").notNull().default("chromium"),
|
|
17
21
|
createdAt: text("created_at").notNull(),
|
|
18
22
|
updatedAt: text("updated_at").notNull()
|
|
19
|
-
}, (t) => [uniqueIndex("
|
|
20
|
-
//#endregion
|
|
23
|
+
}, (t) => [uniqueIndex("baselines_project_story_mode_browser_branch_idx").on(t.projectId, t.storyId, t.viewportName, t.browser, t.branch), index("baselines_project_story_idx").on(t.projectId, t.storyId)]);
|
|
21
24
|
export { baselines };
|
|
22
25
|
|
|
23
26
|
//# sourceMappingURL=baseline.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseline.mjs","names":[],"sources":["../../src/schema/baseline.ts"],"sourcesContent":["import { index, sqliteTable, text, uniqueIndex } from \"drizzle-orm/sqlite-core\";\nimport { projects } from \"./project.ts\";\n\n/** Narrow `baselines` table definition. */\nexport const baselines = sqliteTable(\n \"baselines\",\n {\n id: text(\"id\").primaryKey(),\n projectId: text(\"project_id\")\n .notNull()\n .references(() => projects.id, { onDelete: \"cascade\" }),\n storyId: text(\"story_id\").notNull(),\n viewportName: text(\"viewport_name\").notNull().default(\"desktop\"),\n branch: text(\"branch\").notNull(),\n snapshotId: text(\"snapshot_id\"),\n screenshotPath: text(\"screenshot_path\").notNull(),\n infraHash: text(\"infra_hash\"),\n createdAt: text(\"created_at\").notNull(),\n updatedAt: text(\"updated_at\").notNull(),\n },\n (t) => [\n uniqueIndex(\"
|
|
1
|
+
{"version":3,"file":"baseline.mjs","names":[],"sources":["../../src/schema/baseline.ts"],"sourcesContent":["import { index, sqliteTable, text, uniqueIndex } from \"drizzle-orm/sqlite-core\";\nimport { projects } from \"./project.ts\";\n\n/** Narrow `baselines` table definition. */\nexport const baselines = sqliteTable(\n \"baselines\",\n {\n id: text(\"id\").primaryKey(),\n projectId: text(\"project_id\")\n .notNull()\n .references(() => projects.id, { onDelete: \"cascade\" }),\n storyId: text(\"story_id\").notNull(),\n viewportName: text(\"viewport_name\").notNull().default(\"desktop\"),\n branch: text(\"branch\").notNull(),\n snapshotId: text(\"snapshot_id\"),\n sourceBuildId: text(\"source_build_id\"),\n screenshotPath: text(\"screenshot_path\").notNull(),\n infraHash: text(\"infra_hash\"),\n fingerprint: text(\"fingerprint\"),\n mode: text(\"mode\"),\n browser: text(\"browser\").notNull().default(\"chromium\"),\n createdAt: text(\"created_at\").notNull(),\n updatedAt: text(\"updated_at\").notNull(),\n },\n (t) => [\n uniqueIndex(\"baselines_project_story_mode_browser_branch_idx\").on(\n t.projectId,\n t.storyId,\n t.viewportName,\n t.browser,\n t.branch,\n ),\n index(\"baselines_project_story_idx\").on(t.projectId, t.storyId),\n ],\n);\n\n/** A baseline row. */\nexport interface Baseline {\n id: string;\n projectId: string;\n storyId: string;\n viewportName: string;\n branch: string;\n snapshotId: string | null;\n sourceBuildId: string | null;\n screenshotPath: string;\n infraHash: string | null;\n fingerprint: string | null;\n mode: string | null;\n browser: string;\n createdAt: string;\n updatedAt: string;\n}\n"],"mappings":";;;;;;;AAIA,MAAa,YAAY,YACvB,aACA;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,CAAC,QAAQ;CAClC,cAAc,KAAK,eAAe,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,SAAS;CAC/D,QAAQ,KAAK,QAAQ,CAAC,CAAC,QAAQ;CAC/B,YAAY,KAAK,aAAa;CAC9B,eAAe,KAAK,iBAAiB;CACrC,gBAAgB,KAAK,iBAAiB,CAAC,CAAC,QAAQ;CAChD,WAAW,KAAK,YAAY;CAC5B,aAAa,KAAK,aAAa;CAC/B,MAAM,KAAK,MAAM;CACjB,SAAS,KAAK,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,UAAU;CACrD,WAAW,KAAK,YAAY,CAAC,CAAC,QAAQ;CACtC,WAAW,KAAK,YAAY,CAAC,CAAC,QAAQ;AACxC,IACC,MAAM,CACL,YAAY,iDAAiD,CAAC,CAAC,GAC7D,EAAE,WACF,EAAE,SACF,EAAE,cACF,EAAE,SACF,EAAE,MACJ,GACA,MAAM,6BAA6B,CAAC,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,CAChE,CACF"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import __tsdown_shims_path from 'node:path';
|
|
2
2
|
import __tsdown_shims_url from 'node:url';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
name: "project_status_configs";
|
|
3
|
+
/** Narrow `build_components` table definition: one row per component of a published build. */
|
|
4
|
+
declare const buildComponents: import("drizzle-orm/sqlite-core/table.js").SQLiteTableWithColumns<{
|
|
5
|
+
name: "build_components";
|
|
7
6
|
schema: undefined;
|
|
8
7
|
columns: {
|
|
9
|
-
id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
8
|
+
id: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
|
|
10
9
|
name: "id";
|
|
11
|
-
tableName: "
|
|
10
|
+
tableName: "build_components";
|
|
12
11
|
dataType: "string";
|
|
13
12
|
columnType: "SQLiteText";
|
|
14
13
|
data: string;
|
|
@@ -25,9 +24,9 @@ declare const projectStatusConfigs: import("drizzle-orm/sqlite-core").SQLiteTabl
|
|
|
25
24
|
}, {}, {
|
|
26
25
|
length: number | undefined;
|
|
27
26
|
}>;
|
|
28
|
-
projectId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
27
|
+
projectId: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
|
|
29
28
|
name: "project_id";
|
|
30
|
-
tableName: "
|
|
29
|
+
tableName: "build_components";
|
|
31
30
|
dataType: "string";
|
|
32
31
|
columnType: "SQLiteText";
|
|
33
32
|
data: string;
|
|
@@ -44,9 +43,9 @@ declare const projectStatusConfigs: import("drizzle-orm/sqlite-core").SQLiteTabl
|
|
|
44
43
|
}, {}, {
|
|
45
44
|
length: number | undefined;
|
|
46
45
|
}>;
|
|
47
|
-
|
|
48
|
-
name: "
|
|
49
|
-
tableName: "
|
|
46
|
+
buildId: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
|
|
47
|
+
name: "build_id";
|
|
48
|
+
tableName: "build_components";
|
|
50
49
|
dataType: "string";
|
|
51
50
|
columnType: "SQLiteText";
|
|
52
51
|
data: string;
|
|
@@ -63,9 +62,9 @@ declare const projectStatusConfigs: import("drizzle-orm/sqlite-core").SQLiteTabl
|
|
|
63
62
|
}, {}, {
|
|
64
63
|
length: number | undefined;
|
|
65
64
|
}>;
|
|
66
|
-
|
|
67
|
-
name: "
|
|
68
|
-
tableName: "
|
|
65
|
+
importPath: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
|
|
66
|
+
name: "import_path";
|
|
67
|
+
tableName: "build_components";
|
|
69
68
|
dataType: "string";
|
|
70
69
|
columnType: "SQLiteText";
|
|
71
70
|
data: string;
|
|
@@ -82,9 +81,9 @@ declare const projectStatusConfigs: import("drizzle-orm/sqlite-core").SQLiteTabl
|
|
|
82
81
|
}, {}, {
|
|
83
82
|
length: number | undefined;
|
|
84
83
|
}>;
|
|
85
|
-
|
|
86
|
-
name: "
|
|
87
|
-
tableName: "
|
|
84
|
+
title: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
|
|
85
|
+
name: "title";
|
|
86
|
+
tableName: "build_components";
|
|
88
87
|
dataType: "string";
|
|
89
88
|
columnType: "SQLiteText";
|
|
90
89
|
data: string;
|
|
@@ -101,9 +100,26 @@ declare const projectStatusConfigs: import("drizzle-orm/sqlite-core").SQLiteTabl
|
|
|
101
100
|
}, {}, {
|
|
102
101
|
length: number | undefined;
|
|
103
102
|
}>;
|
|
104
|
-
|
|
105
|
-
name: "
|
|
106
|
-
tableName: "
|
|
103
|
+
storyCount: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
|
|
104
|
+
name: "story_count";
|
|
105
|
+
tableName: "build_components";
|
|
106
|
+
dataType: "number";
|
|
107
|
+
columnType: "SQLiteInteger";
|
|
108
|
+
data: number;
|
|
109
|
+
driverParam: number;
|
|
110
|
+
notNull: true;
|
|
111
|
+
hasDefault: true;
|
|
112
|
+
isPrimaryKey: false;
|
|
113
|
+
isAutoincrement: false;
|
|
114
|
+
hasRuntimeDefault: false;
|
|
115
|
+
enumValues: undefined;
|
|
116
|
+
baseColumn: never;
|
|
117
|
+
identity: undefined;
|
|
118
|
+
generated: undefined;
|
|
119
|
+
}, {}, {}>;
|
|
120
|
+
hash: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
|
|
121
|
+
name: "hash";
|
|
122
|
+
tableName: "build_components";
|
|
107
123
|
dataType: "string";
|
|
108
124
|
columnType: "SQLiteText";
|
|
109
125
|
data: string;
|
|
@@ -120,9 +136,9 @@ declare const projectStatusConfigs: import("drizzle-orm/sqlite-core").SQLiteTabl
|
|
|
120
136
|
}, {}, {
|
|
121
137
|
length: number | undefined;
|
|
122
138
|
}>;
|
|
123
|
-
|
|
124
|
-
name: "
|
|
125
|
-
tableName: "
|
|
139
|
+
createdAt: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
|
|
140
|
+
name: "created_at";
|
|
141
|
+
tableName: "build_components";
|
|
126
142
|
dataType: "string";
|
|
127
143
|
columnType: "SQLiteText";
|
|
128
144
|
data: string;
|
|
@@ -142,16 +158,5 @@ declare const projectStatusConfigs: import("drizzle-orm/sqlite-core").SQLiteTabl
|
|
|
142
158
|
};
|
|
143
159
|
dialect: 'sqlite';
|
|
144
160
|
}>;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
id: string;
|
|
148
|
-
projectId: string;
|
|
149
|
-
provider: string;
|
|
150
|
-
config: string;
|
|
151
|
-
tokenEncrypted: string;
|
|
152
|
-
createdAt: string;
|
|
153
|
-
updatedAt: string;
|
|
154
|
-
}
|
|
155
|
-
//#endregion
|
|
156
|
-
export { ProjectStatusConfig, projectStatusConfigs };
|
|
157
|
-
//# sourceMappingURL=status-config.d.mts.map
|
|
161
|
+
export { buildComponents };
|
|
162
|
+
//# sourceMappingURL=build-component.d.mts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { projects } from "./project.mjs";
|
|
5
|
+
import { builds } from "./build.mjs";
|
|
6
|
+
import { index, integer, sqliteTable, text } from "drizzle-orm/sqlite-core";
|
|
7
|
+
// src/schema/build-component.ts
|
|
8
|
+
/** Narrow `build_components` table definition: one row per component of a published build. */
|
|
9
|
+
const buildComponents = sqliteTable("build_components", {
|
|
10
|
+
id: text("id").primaryKey(),
|
|
11
|
+
projectId: text("project_id").notNull().references(() => projects.id, { onDelete: "cascade" }),
|
|
12
|
+
buildId: text("build_id").notNull().references(() => builds.id, { onDelete: "cascade" }),
|
|
13
|
+
importPath: text("import_path").notNull(),
|
|
14
|
+
title: text("title").notNull(),
|
|
15
|
+
storyCount: integer("story_count").notNull().default(0),
|
|
16
|
+
hash: text("hash").notNull(),
|
|
17
|
+
createdAt: text("created_at").notNull()
|
|
18
|
+
}, (table) => [index("build_components_build_id_idx").on(table.buildId), index("build_components_project_import_path_idx").on(table.projectId, table.importPath)]);
|
|
19
|
+
export { buildComponents };
|
|
20
|
+
|
|
21
|
+
//# 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, integer, sqliteTable, text } from \"drizzle-orm/sqlite-core\";\nimport { builds } from \"./build.ts\";\nimport { projects } from \"./project.ts\";\n\n/** Narrow `build_components` table definition: one row per component of a published build. */\nexport const buildComponents = sqliteTable(\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: integer(\"story_count\").notNull().default(0),\n hash: text(\"hash\").notNull(),\n createdAt: text(\"created_at\").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":";;;;;;;;AAKA,MAAa,kBAAkB,YAC7B,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,QAAQ,aAAa,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC;CACtD,MAAM,KAAK,MAAM,CAAC,CAAC,QAAQ;CAC3B,WAAW,KAAK,YAAY,CAAC,CAAC,QAAQ;AACxC,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,127 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
/** Narrow `build_reviews` table definition: one verdict of one reviewer on one build. */
|
|
4
|
+
declare const buildReviews: import("drizzle-orm/sqlite-core/table.js").SQLiteTableWithColumns<{
|
|
5
|
+
name: "build_reviews";
|
|
6
|
+
schema: undefined;
|
|
7
|
+
columns: {
|
|
8
|
+
id: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
|
|
9
|
+
name: "id";
|
|
10
|
+
tableName: "build_reviews";
|
|
11
|
+
dataType: "string";
|
|
12
|
+
columnType: "SQLiteText";
|
|
13
|
+
data: string;
|
|
14
|
+
driverParam: string;
|
|
15
|
+
notNull: true;
|
|
16
|
+
hasDefault: false;
|
|
17
|
+
isPrimaryKey: true;
|
|
18
|
+
isAutoincrement: false;
|
|
19
|
+
hasRuntimeDefault: false;
|
|
20
|
+
enumValues: [string, ...string[]];
|
|
21
|
+
baseColumn: never;
|
|
22
|
+
identity: undefined;
|
|
23
|
+
generated: undefined;
|
|
24
|
+
}, {}, {
|
|
25
|
+
length: number | undefined;
|
|
26
|
+
}>;
|
|
27
|
+
buildId: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
|
|
28
|
+
name: "build_id";
|
|
29
|
+
tableName: "build_reviews";
|
|
30
|
+
dataType: "string";
|
|
31
|
+
columnType: "SQLiteText";
|
|
32
|
+
data: string;
|
|
33
|
+
driverParam: string;
|
|
34
|
+
notNull: true;
|
|
35
|
+
hasDefault: false;
|
|
36
|
+
isPrimaryKey: false;
|
|
37
|
+
isAutoincrement: false;
|
|
38
|
+
hasRuntimeDefault: false;
|
|
39
|
+
enumValues: [string, ...string[]];
|
|
40
|
+
baseColumn: never;
|
|
41
|
+
identity: undefined;
|
|
42
|
+
generated: undefined;
|
|
43
|
+
}, {}, {
|
|
44
|
+
length: number | undefined;
|
|
45
|
+
}>;
|
|
46
|
+
userId: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
|
|
47
|
+
name: "user_id";
|
|
48
|
+
tableName: "build_reviews";
|
|
49
|
+
dataType: "string";
|
|
50
|
+
columnType: "SQLiteText";
|
|
51
|
+
data: string;
|
|
52
|
+
driverParam: string;
|
|
53
|
+
notNull: false;
|
|
54
|
+
hasDefault: false;
|
|
55
|
+
isPrimaryKey: false;
|
|
56
|
+
isAutoincrement: false;
|
|
57
|
+
hasRuntimeDefault: false;
|
|
58
|
+
enumValues: [string, ...string[]];
|
|
59
|
+
baseColumn: never;
|
|
60
|
+
identity: undefined;
|
|
61
|
+
generated: undefined;
|
|
62
|
+
}, {}, {
|
|
63
|
+
length: number | undefined;
|
|
64
|
+
}>;
|
|
65
|
+
verdict: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
|
|
66
|
+
name: "verdict";
|
|
67
|
+
tableName: "build_reviews";
|
|
68
|
+
dataType: "string";
|
|
69
|
+
columnType: "SQLiteText";
|
|
70
|
+
data: "approved" | "rejected";
|
|
71
|
+
driverParam: string;
|
|
72
|
+
notNull: true;
|
|
73
|
+
hasDefault: false;
|
|
74
|
+
isPrimaryKey: false;
|
|
75
|
+
isAutoincrement: false;
|
|
76
|
+
hasRuntimeDefault: false;
|
|
77
|
+
enumValues: [string, ...string[]];
|
|
78
|
+
baseColumn: never;
|
|
79
|
+
identity: undefined;
|
|
80
|
+
generated: undefined;
|
|
81
|
+
}, {}, {
|
|
82
|
+
length: number | undefined;
|
|
83
|
+
$type: "approved" | "rejected";
|
|
84
|
+
}>;
|
|
85
|
+
body: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
|
|
86
|
+
name: "body";
|
|
87
|
+
tableName: "build_reviews";
|
|
88
|
+
dataType: "string";
|
|
89
|
+
columnType: "SQLiteText";
|
|
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
|
+
length: number | undefined;
|
|
103
|
+
}>;
|
|
104
|
+
createdAt: import("drizzle-orm/sqlite-core/index.js").SQLiteColumn<{
|
|
105
|
+
name: "created_at";
|
|
106
|
+
tableName: "build_reviews";
|
|
107
|
+
dataType: "string";
|
|
108
|
+
columnType: "SQLiteText";
|
|
109
|
+
data: string;
|
|
110
|
+
driverParam: string;
|
|
111
|
+
notNull: true;
|
|
112
|
+
hasDefault: false;
|
|
113
|
+
isPrimaryKey: false;
|
|
114
|
+
isAutoincrement: false;
|
|
115
|
+
hasRuntimeDefault: false;
|
|
116
|
+
enumValues: [string, ...string[]];
|
|
117
|
+
baseColumn: never;
|
|
118
|
+
identity: undefined;
|
|
119
|
+
generated: undefined;
|
|
120
|
+
}, {}, {
|
|
121
|
+
length: number | undefined;
|
|
122
|
+
}>;
|
|
123
|
+
};
|
|
124
|
+
dialect: 'sqlite';
|
|
125
|
+
}>;
|
|
126
|
+
export { buildReviews };
|
|
127
|
+
//# sourceMappingURL=build-review.d.mts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
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, sqliteTable, text } from "drizzle-orm/sqlite-core";
|
|
7
|
+
// src/schema/build-review.ts
|
|
8
|
+
/** Narrow `build_reviews` table definition: one verdict of one reviewer on one build. */
|
|
9
|
+
const buildReviews = sqliteTable("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: text("created_at").notNull()
|
|
16
|
+
}, (table) => [index("build_reviews_build_id_idx").on(table.buildId)]);
|
|
17
|
+
export { buildReviews };
|
|
18
|
+
|
|
19
|
+
//# 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, sqliteTable, text } from \"drizzle-orm/sqlite-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 = sqliteTable(\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: text(\"created_at\").notNull(),\n },\n (table) => [index(\"build_reviews_build_id_idx\").on(table.buildId)],\n);\n"],"mappings":";;;;;;;;AAKA,MAAa,eAAe,YAC1B,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,KAAK,YAAY,CAAC,CAAC,QAAQ;AACxC,IACC,UAAU,CAAC,MAAM,4BAA4B,CAAC,CAAC,GAAG,MAAM,OAAO,CAAC,CACnE"}
|