| 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("042_ProjectionThreadLinkedPullRequest", (it) => { |
| 12 | it.effect("adds the linked pull request column", () => |
| 13 | Effect.gen(function* () { |
| 14 | const sql = yield* SqlClient.SqlClient; |
| 15 | |
| 16 | yield* runMigrations({ toMigrationInclusive: 41 }); |
| 17 | yield* runMigrations({ toMigrationInclusive: 42 }); |
| 18 | |
| 19 | const columns = yield* sql<{ readonly name: string }>` |
| 20 | PRAGMA table_info(projection_threads) |
| 21 | `; |
| 22 | assert.ok(columns.some((column) => column.name === "linked_pull_request_json")); |
| 23 | }), |
| 24 | ); |
| 25 | }); |