| author | |
| committer | |
| log | f9752d7c08ee1e22161bfdd4ec8441c4272c5b99 |
| tree | 8ed0513924ddb4464d59b46daa48e6912ad4f630 |
| parent | 766592b83bc95aa3ca2beacf0f215d2983fe36d1 |
3 files changed, 32 insertions(+), 2 deletions(-)
apps/server/src/persistence/Migrations.ts+2| ... | ... | @@ -17,6 +17,7 @@ import Migration0002 from "./Migrations/002_OrchestrationCommandReceipts.ts"; |
| 17 | 17 | import Migration0003 from "./Migrations/003_CheckpointDiffBlobs.ts"; |
| 18 | 18 | import Migration0004 from "./Migrations/004_ProviderSessionRuntime.ts"; |
| 19 | 19 | import Migration0005 from "./Migrations/005_Projections.ts"; |
| 20 | import Migration0006 from "./Migrations/006_ProjectionThreadSessionRuntimeModeColumns.ts"; | |
| 20 | 21 | |
| 21 | 22 | /** |
| 22 | 23 | * Migration loader with all migrations defined inline. |
| ... | ... | @@ -34,6 +35,7 @@ const loader = Migrator.fromRecord({ |
| 34 | 35 | "3_CheckpointDiffBlobs": Migration0003, |
| 35 | 36 | "4_ProviderSessionRuntime": Migration0004, |
| 36 | 37 | "5_Projections": Migration0005, |
| 38 | "6_ProjectionThreadSessionRuntimeModeColumns": Migration0006, | |
| 37 | 39 | }); |
| 38 | 40 | |
| 39 | 41 | /** |
apps/server/src/persistence/Migrations/005_Projections.ts-2| ... | ... | @@ -65,8 +65,6 @@ export default Effect.gen(function* () { |
| 65 | 65 | provider_name TEXT, |
| 66 | 66 | provider_session_id TEXT, |
| 67 | 67 | provider_thread_id TEXT, |
| 68 | approval_policy TEXT NOT NULL, | |
| 69 | sandbox_mode TEXT NOT NULL, | |
| 70 | 68 | active_turn_id TEXT, |
| 71 | 69 | last_error TEXT, |
| 72 | 70 | updated_at TEXT NOT NULL |
apps/server/src/persistence/Migrations/006_ProjectionThreadSessionRuntimeModeColumns.ts created+30| ... | ... | @@ -0,0 +1,30 @@ |
| 1 | import * as SqlClient from "effect/unstable/sql/SqlClient"; | |
| 2 | import * as Effect from "effect/Effect"; | |
| 3 | ||
| 4 | const DEFAULT_APPROVAL_POLICY = "never"; | |
| 5 | const DEFAULT_SANDBOX_MODE = "workspace-write"; | |
| 6 | ||
| 7 | export default Effect.gen(function* () { | |
| 8 | const sql = yield* SqlClient.SqlClient; | |
| 9 | ||
| 10 | yield* sql` | |
| 11 | ALTER TABLE projection_thread_sessions | |
| 12 | ADD COLUMN approval_policy TEXT NOT NULL DEFAULT 'never' | |
| 13 | `; | |
| 14 | ||
| 15 | yield* sql` | |
| 16 | ALTER TABLE projection_thread_sessions | |
| 17 | ADD COLUMN sandbox_mode TEXT NOT NULL DEFAULT 'workspace-write' | |
| 18 | `; | |
| 19 | ||
| 20 | yield* sql` | |
| 21 | UPDATE projection_thread_sessions | |
| 22 | SET approval_policy = ${DEFAULT_APPROVAL_POLICY} | |
| 23 | WHERE approval_policy IS NULL | |
| 24 | `; | |
| 25 | yield* sql` | |
| 26 | UPDATE projection_thread_sessions | |
| 27 | SET sandbox_mode = ${DEFAULT_SANDBOX_MODE} | |
| 28 | WHERE sandbox_mode IS NULL | |
| 29 | `; | |
| 30 | }); |