Open History to see the last commit
1import { assert, it } from "@effect/vitest";
2import * as Effect from "effect/Effect";
3import * as SqlClient from "effect/unstable/sql/SqlClient";
4import * as NodeSqliteClient from "@t3tools/shared/nodeSqliteClient";
5
6import { runMigrations } from "../Migrations.ts";
7
8const layer = it.layer(NodeSqliteClient.layerMemory());
9
10layer("053_ProjectionThreadMessageActualModel", (it) => {
11 it.effect("adds the nullable actual model to message projections", () =>
12 Effect.gen(function* () {
13 const sql = yield* SqlClient.SqlClient;
14
15 yield* runMigrations({ toMigrationInclusive: 49 });
16 yield* runMigrations({ toMigrationInclusive: 53 });
17
18 const columns = yield* sql<{ readonly name: string; readonly notnull: number }>`
19 PRAGMA table_info(projection_thread_messages)
20 `;
21 const actualModel = columns.find((column) => column.name === "actual_model");
22
23 assert.equal(actualModel?.name, "actual_model");
24 assert.equal(actualModel?.notnull, 0);
25 }),
26 );
27});