From f9752d7c08ee1e22161bfdd4ec8441c4272c5b99 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 26 Feb 2026 21:23:23 -0800 Subject: [PATCH] migr --- apps/server/src/persistence/Migrations.ts | 2 ++ .../persistence/Migrations/005_Projections.ts | 2 -- ...ojectionThreadSessionRuntimeModeColumns.ts | 30 +++++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 apps/server/src/persistence/Migrations/006_ProjectionThreadSessionRuntimeModeColumns.ts diff --git a/apps/server/src/persistence/Migrations.ts b/apps/server/src/persistence/Migrations.ts index 3779c16d4f130bc3b3c62e8330b9b4b943e40a2d..12873ca29d2a0d72395882f9dd7b7dd76dfab88c 100644 --- a/apps/server/src/persistence/Migrations.ts +++ b/apps/server/src/persistence/Migrations.ts @@ -17,6 +17,7 @@ import Migration0002 from "./Migrations/002_OrchestrationCommandReceipts.ts"; import Migration0003 from "./Migrations/003_CheckpointDiffBlobs.ts"; import Migration0004 from "./Migrations/004_ProviderSessionRuntime.ts"; import Migration0005 from "./Migrations/005_Projections.ts"; +import Migration0006 from "./Migrations/006_ProjectionThreadSessionRuntimeModeColumns.ts"; /** * Migration loader with all migrations defined inline. @@ -34,6 +35,7 @@ const loader = Migrator.fromRecord({ "3_CheckpointDiffBlobs": Migration0003, "4_ProviderSessionRuntime": Migration0004, "5_Projections": Migration0005, + "6_ProjectionThreadSessionRuntimeModeColumns": Migration0006, }); /** diff --git a/apps/server/src/persistence/Migrations/005_Projections.ts b/apps/server/src/persistence/Migrations/005_Projections.ts index ae5e7af07d2c1be71115897441470ec9b40f0efd..c950da76a18e2fd25609109764831ded8c84fbfe 100644 --- a/apps/server/src/persistence/Migrations/005_Projections.ts +++ b/apps/server/src/persistence/Migrations/005_Projections.ts @@ -65,8 +65,6 @@ export default Effect.gen(function* () { provider_name TEXT, provider_session_id TEXT, provider_thread_id TEXT, - approval_policy TEXT NOT NULL, - sandbox_mode TEXT NOT NULL, active_turn_id TEXT, last_error TEXT, updated_at TEXT NOT NULL diff --git a/apps/server/src/persistence/Migrations/006_ProjectionThreadSessionRuntimeModeColumns.ts b/apps/server/src/persistence/Migrations/006_ProjectionThreadSessionRuntimeModeColumns.ts new file mode 100644 index 0000000000000000000000000000000000000000..bcdef280163336a70b725fc34270f6cc6cb54690 --- /dev/null +++ b/apps/server/src/persistence/Migrations/006_ProjectionThreadSessionRuntimeModeColumns.ts @@ -0,0 +1,30 @@ +import * as SqlClient from "effect/unstable/sql/SqlClient"; +import * as Effect from "effect/Effect"; + +const DEFAULT_APPROVAL_POLICY = "never"; +const DEFAULT_SANDBOX_MODE = "workspace-write"; + +export default Effect.gen(function* () { + const sql = yield* SqlClient.SqlClient; + + yield* sql` + ALTER TABLE projection_thread_sessions + ADD COLUMN approval_policy TEXT NOT NULL DEFAULT 'never' + `; + + yield* sql` + ALTER TABLE projection_thread_sessions + ADD COLUMN sandbox_mode TEXT NOT NULL DEFAULT 'workspace-write' + `; + + yield* sql` + UPDATE projection_thread_sessions + SET approval_policy = ${DEFAULT_APPROVAL_POLICY} + WHERE approval_policy IS NULL + `; + yield* sql` + UPDATE projection_thread_sessions + SET sandbox_mode = ${DEFAULT_SANDBOX_MODE} + WHERE sandbox_mode IS NULL + `; +}); -- 2.54.0