summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2026-03-07 16:17:00 -0500
committerDax Raad <[email protected]>2026-03-07 16:17:00 -0500
commita965a062595403a8e0083e85770315d5dc9628ab (patch)
tree36ef5263002866c96d61e4242a2a8058d14f5dbf
parent0654f28c7296cf31de10a6399bf82d43ef626202 (diff)
downloadopencode-a965a062595403a8e0083e85770315d5dc9628ab.tar.gz
opencode-a965a062595403a8e0083e85770315d5dc9628ab.zip
core: add OPENCODE_SKIP_MIGRATIONS flag to bypass database migrations
Allows users to skip automatic database migrations by setting the OPENCODE_SKIP_MIGRATIONS environment variable. Useful for testing scenarios or when manually managing database state.
-rw-r--r--packages/opencode/src/flag/flag.ts1
-rw-r--r--packages/opencode/src/storage/db.ts5
2 files changed, 6 insertions, 0 deletions
diff --git a/packages/opencode/src/flag/flag.ts b/packages/opencode/src/flag/flag.ts
index c743cd18d..6b2b16c67 100644
--- a/packages/opencode/src/flag/flag.ts
+++ b/packages/opencode/src/flag/flag.ts
@@ -61,6 +61,7 @@ export namespace Flag {
export const OPENCODE_MODELS_URL = process.env["OPENCODE_MODELS_URL"]
export const OPENCODE_MODELS_PATH = process.env["OPENCODE_MODELS_PATH"]
export const OPENCODE_DISABLE_CHANNEL_DB = truthy("OPENCODE_DISABLE_CHANNEL_DB")
+ export const OPENCODE_SKIP_MIGRATIONS = truthy("OPENCODE_SKIP_MIGRATIONS")
function number(key: string) {
const value = process.env[key]
diff --git a/packages/opencode/src/storage/db.ts b/packages/opencode/src/storage/db.ts
index d6f8b2ab5..3e584d31a 100644
--- a/packages/opencode/src/storage/db.ts
+++ b/packages/opencode/src/storage/db.ts
@@ -106,6 +106,11 @@ export namespace Database {
count: entries.length,
mode: typeof OPENCODE_MIGRATIONS !== "undefined" ? "bundled" : "dev",
})
+ if (Flag.OPENCODE_SKIP_MIGRATIONS) {
+ for (const item of entries) {
+ item.sql = "select 1;"
+ }
+ }
migrate(db, entries)
}