Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

045_ProjectionProjectsAutoPull.ts

16 lines469 Bytes

1import * as Effect from "effect/Effect";
2import * as SqlClient from "effect/sql/SqlClient";
3​
4export default Effect.gen(function* () {
5 const sql = yield* SqlClient.SqlClient;
6 const columns = yield* sql<{ readonly name: string }>`
7 PRAGMA table_info(projection_projects)
8 `;
9​
10 if (!columns.some((column) => column.name === "auto_pull")) {
11 yield* sql`
12 ALTER TABLE projection_projects
13 ADD COLUMN auto_pull INTEGER NOT NULL DEFAULT 0
14 `;
15 }
16});