| 1 | import { assert, it } from "@effect/vitest"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import * as Layer from "effect/Layer"; |
| 4 | import * as SqlClient from "effect/sql/SqlClient"; |
| 5 | |
| 6 | import { runMigrations } from "../Migrations.ts"; |
| 7 | import * as NodeSqliteClient from "@t3tools/shared/nodeSqliteClient"; |
| 8 | |
| 9 | const layer = it.layer(Layer.mergeAll(NodeSqliteClient.layer({ filename: ":memory:" }))); |
| 10 | |
| 11 | layer("035_ProjectionThreadTitleRegeneration", (it) => { |
| 12 | it.effect("adds pending title regeneration columns", () => |
| 13 | Effect.gen(function* () { |
| 14 | const sql = yield* SqlClient.SqlClient; |
| 15 | |
| 16 | yield* runMigrations({ toMigrationInclusive: 34 }); |
| 17 | yield* runMigrations({ toMigrationInclusive: 35 }); |
| 18 | |
| 19 | const columns = yield* sql<{ readonly name: string }>` |
| 20 | PRAGMA table_info(projection_threads) |
| 21 | `; |
| 22 | const names = new Set(columns.map((column) => column.name)); |
| 23 | assert.ok(names.has("title_regeneration_request_id")); |
| 24 | assert.ok(names.has("title_regeneration_started_at")); |
| 25 | }), |
| 26 | ); |
| 27 | }); |