26 lines · 863 B · TypeScript
RawDownload
import * as Effect from "effect/Effect";import * as SqlClient from "effect/unstable/sql/SqlClient"; // Client-declared surface (web/desktop/mobile) and app version, refreshed on// every WebSocket connect so the row tracks the client's current build instead// of freezing at session issuance. Nullable: old clients never report them.export default Effect.gen(function* () {  const sql = yield* SqlClient.SqlClient;  const columns = yield* sql<{ readonly name: string }>`    PRAGMA table_info(auth_sessions)  `;   if (!columns.some((column) => column.name === "client_surface")) {    yield* sql`      ALTER TABLE auth_sessions      ADD COLUMN client_surface TEXT    `;  }   if (!columns.some((column) => column.name === "client_app_version")) {    yield* sql`      ALTER TABLE auth_sessions      ADD COLUMN client_app_version TEXT    `;  }});