The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import { assert, it } from "@effect/vitest"; |
| 2 | import * as NodeSqliteClient from "@t3tools/shared/nodeSqliteClient"; |
| 3 | import * as Effect from "effect/Effect"; |
| 4 | import * as SqlClient from "effect/sql/SqlClient"; |
| 5 | |
| 6 | import { runMigrations } from "../Migrations.ts"; |
| 7 | |
| 8 | const layer = it.layer(NodeSqliteClient.layer({ filename: ":memory:" })); |
| 9 | |
| 10 | layer("087_ProjectionProjectsCustomTitle", (it) => { |
| 11 | it.effect("marks projects with a recorded title update as renamed", () => |
| 12 | Effect.gen(function* () { |
| 13 | const sql = yield* SqlClient.SqlClient; |
| 14 | yield* runMigrations({ toMigrationInclusive: 86 }); |
| 15 | for (const projectId of ["renamed", "untouched"]) { |
| 16 | yield* sql` |
| 17 | INSERT INTO projection_projects |
| 18 | (project_id, title, workspace_root, scripts_json, created_at, updated_at) |
| 19 | VALUES (${projectId}, 'repo', ${"/tmp/" + projectId}, '[]', '2026-10-01', '2026-10-01') |
| 20 | `; |
| 21 | yield* sql` |
| 22 | INSERT INTO orchestration_events |
| 23 | (event_id, aggregate_kind, stream_id, stream_version, event_type, occurred_at, |
| 24 | actor_kind, payload_json, metadata_json, application_event_version) |
| 25 | VALUES (${projectId}, 'project', ${projectId}, 1, 'project.meta-updated', '2026-10-01', |
| 26 | 'client', ${JSON.stringify(projectId === "renamed" ? { title: "repo" } : { autoPull: true })}, '{}', 2) |
| 27 | `; |
| 28 | } |
| 29 | // Builds of this change before renumbering already added the column. |
| 30 | yield* sql`ALTER TABLE projection_projects ADD COLUMN has_custom_title INTEGER NOT NULL DEFAULT 0`; |
| 31 | yield* runMigrations(); |
| 32 | assert.deepStrictEqual( |
| 33 | yield* sql`SELECT project_id, has_custom_title FROM projection_projects ORDER BY project_id`, |
| 34 | [ |
| 35 | { project_id: "renamed", has_custom_title: 1 }, |
| 36 | { project_id: "untouched", has_custom_title: 0 }, |
| 37 | ], |
| 38 | ); |
| 39 | }), |
| 40 | ); |
| 41 | }); |