Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

migr

Julius Marmingef9752d7c08ee
diff --git a/apps/server/src/persistence/Migrations.ts b/apps/server/src/persistence/Migrations.ts
index 3779c16d4..12873ca29 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 ae5e7af07..c950da76a 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 000000000..bcdef2801
--- /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
+ `;
+});