bopodev-db 0.1.14 → 0.1.16
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/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-lint.log +4 -0
- package/.turbo/turbo-typecheck.log +1 -1
- package/dist/repositories.d.ts +362 -12
- package/dist/schema.d.ts +2286 -1040
- package/package.json +1 -1
- package/src/bootstrap.ts +72 -5
- package/src/repositories.ts +523 -7
- package/src/schema.ts +67 -4
package/package.json
CHANGED
package/src/bootstrap.ts
CHANGED
|
@@ -20,9 +20,9 @@ export async function bootstrapDatabase(dbPath?: string) {
|
|
|
20
20
|
description TEXT,
|
|
21
21
|
status TEXT NOT NULL DEFAULT 'planned',
|
|
22
22
|
planned_start_at TIMESTAMP,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
execution_workspace_policy TEXT,
|
|
24
|
+
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
25
|
+
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
26
26
|
);
|
|
27
27
|
`);
|
|
28
28
|
await db.execute(sql`
|
|
@@ -35,11 +35,29 @@ export async function bootstrapDatabase(dbPath?: string) {
|
|
|
35
35
|
`);
|
|
36
36
|
await db.execute(sql`
|
|
37
37
|
ALTER TABLE projects
|
|
38
|
-
ADD COLUMN IF NOT EXISTS
|
|
38
|
+
ADD COLUMN IF NOT EXISTS execution_workspace_policy TEXT;
|
|
39
39
|
`);
|
|
40
40
|
await db.execute(sql`
|
|
41
41
|
ALTER TABLE projects
|
|
42
|
-
ADD COLUMN IF NOT EXISTS
|
|
42
|
+
ADD COLUMN IF NOT EXISTS updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
|
43
|
+
`);
|
|
44
|
+
await db.execute(sql`
|
|
45
|
+
CREATE TABLE IF NOT EXISTS project_workspaces (
|
|
46
|
+
id TEXT PRIMARY KEY,
|
|
47
|
+
company_id TEXT NOT NULL REFERENCES companies(id) ON DELETE CASCADE,
|
|
48
|
+
project_id TEXT NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
|
|
49
|
+
name TEXT NOT NULL,
|
|
50
|
+
cwd TEXT,
|
|
51
|
+
repo_url TEXT,
|
|
52
|
+
repo_ref TEXT,
|
|
53
|
+
is_primary BOOLEAN NOT NULL DEFAULT false,
|
|
54
|
+
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
55
|
+
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
56
|
+
);
|
|
57
|
+
`);
|
|
58
|
+
await db.execute(sql`
|
|
59
|
+
CREATE INDEX IF NOT EXISTS idx_project_workspaces_company_project
|
|
60
|
+
ON project_workspaces (company_id, project_id, is_primary DESC, created_at ASC);
|
|
43
61
|
`);
|
|
44
62
|
await db.execute(sql`
|
|
45
63
|
CREATE TABLE IF NOT EXISTS goals (
|
|
@@ -348,6 +366,43 @@ export async function bootstrapDatabase(dbPath?: string) {
|
|
|
348
366
|
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
349
367
|
);
|
|
350
368
|
`);
|
|
369
|
+
await db.execute(sql`
|
|
370
|
+
CREATE TABLE IF NOT EXISTS templates (
|
|
371
|
+
id TEXT PRIMARY KEY,
|
|
372
|
+
company_id TEXT NOT NULL REFERENCES companies(id) ON DELETE CASCADE,
|
|
373
|
+
slug TEXT NOT NULL,
|
|
374
|
+
name TEXT NOT NULL,
|
|
375
|
+
description TEXT,
|
|
376
|
+
current_version TEXT NOT NULL DEFAULT '1.0.0',
|
|
377
|
+
status TEXT NOT NULL DEFAULT 'draft',
|
|
378
|
+
visibility TEXT NOT NULL DEFAULT 'company',
|
|
379
|
+
variables_json TEXT NOT NULL DEFAULT '[]',
|
|
380
|
+
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
381
|
+
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
382
|
+
);
|
|
383
|
+
`);
|
|
384
|
+
await db.execute(sql`
|
|
385
|
+
CREATE TABLE IF NOT EXISTS template_versions (
|
|
386
|
+
id TEXT PRIMARY KEY,
|
|
387
|
+
company_id TEXT NOT NULL REFERENCES companies(id) ON DELETE CASCADE,
|
|
388
|
+
template_id TEXT NOT NULL REFERENCES templates(id) ON DELETE CASCADE,
|
|
389
|
+
version TEXT NOT NULL,
|
|
390
|
+
manifest_json TEXT NOT NULL DEFAULT '{}',
|
|
391
|
+
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
392
|
+
);
|
|
393
|
+
`);
|
|
394
|
+
await db.execute(sql`
|
|
395
|
+
CREATE TABLE IF NOT EXISTS template_installs (
|
|
396
|
+
id TEXT PRIMARY KEY,
|
|
397
|
+
company_id TEXT NOT NULL REFERENCES companies(id) ON DELETE CASCADE,
|
|
398
|
+
template_id TEXT REFERENCES templates(id) ON DELETE SET NULL,
|
|
399
|
+
template_version_id TEXT REFERENCES template_versions(id) ON DELETE SET NULL,
|
|
400
|
+
status TEXT NOT NULL DEFAULT 'applied',
|
|
401
|
+
summary_json TEXT NOT NULL DEFAULT '{}',
|
|
402
|
+
variables_json TEXT NOT NULL DEFAULT '{}',
|
|
403
|
+
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
404
|
+
);
|
|
405
|
+
`);
|
|
351
406
|
await db.execute(sql`
|
|
352
407
|
CREATE TABLE IF NOT EXISTS plugin_configs (
|
|
353
408
|
company_id TEXT NOT NULL REFERENCES companies(id) ON DELETE CASCADE,
|
|
@@ -428,6 +483,18 @@ export async function bootstrapDatabase(dbPath?: string) {
|
|
|
428
483
|
CREATE INDEX IF NOT EXISTS idx_plugin_runs_company_created
|
|
429
484
|
ON plugin_runs (company_id, created_at DESC);
|
|
430
485
|
`);
|
|
486
|
+
await db.execute(sql`
|
|
487
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_templates_company_slug
|
|
488
|
+
ON templates (company_id, slug);
|
|
489
|
+
`);
|
|
490
|
+
await db.execute(sql`
|
|
491
|
+
CREATE INDEX IF NOT EXISTS idx_template_versions_company_template_created
|
|
492
|
+
ON template_versions (company_id, template_id, created_at DESC);
|
|
493
|
+
`);
|
|
494
|
+
await db.execute(sql`
|
|
495
|
+
CREATE INDEX IF NOT EXISTS idx_template_installs_company_created
|
|
496
|
+
ON template_installs (company_id, created_at DESC);
|
|
497
|
+
`);
|
|
431
498
|
|
|
432
499
|
return { db, client };
|
|
433
500
|
}
|