The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import * as Effect from "effect/Effect"; |
| 2 | import * as SqlClient from "effect/sql/SqlClient"; |
| 3 | |
| 4 | export default Effect.gen(function* () { |
| 5 | const sql = yield* SqlClient.SqlClient; |
| 6 | |
| 7 | const pairingLinkColumns = yield* sql<{ readonly name: string }>` |
| 8 | PRAGMA table_info(auth_pairing_links) |
| 9 | `; |
| 10 | if (!pairingLinkColumns.some((column) => column.name === "requires_connect_approval")) { |
| 11 | yield* sql` |
| 12 | ALTER TABLE auth_pairing_links |
| 13 | ADD COLUMN requires_connect_approval INTEGER NOT NULL DEFAULT 0 |
| 14 | `; |
| 15 | } |
| 16 | if (!pairingLinkColumns.some((column) => column.name === "requested_client_json")) { |
| 17 | yield* sql` |
| 18 | ALTER TABLE auth_pairing_links |
| 19 | ADD COLUMN requested_client_json TEXT |
| 20 | `; |
| 21 | } |
| 22 | |
| 23 | const sessionColumns = yield* sql<{ readonly name: string }>` |
| 24 | PRAGMA table_info(auth_sessions) |
| 25 | `; |
| 26 | if (!sessionColumns.some((column) => column.name === "proof_key_thumbprint")) { |
| 27 | yield* sql` |
| 28 | ALTER TABLE auth_sessions |
| 29 | ADD COLUMN proof_key_thumbprint TEXT |
| 30 | `; |
| 31 | } |
| 32 | |
| 33 | yield* sql` |
| 34 | CREATE TABLE IF NOT EXISTS auth_connect_devices ( |
| 35 | proof_key_thumbprint TEXT PRIMARY KEY, |
| 36 | client_json TEXT, |
| 37 | approved_at TEXT NOT NULL |
| 38 | ) |
| 39 | `; |
| 40 | }); |