Skip to content

Commit 400fd62

Browse files
committed
fix: DB migrating on every run when OPENCODE_CHANNEL is e.g. 'stable'
1 parent 6253ef0 commit 400fd62

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

packages/opencode/src/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ import { WebCommand } from "./cli/cmd/web"
2929
import { PrCommand } from "./cli/cmd/pr"
3030
import { SessionCommand } from "./cli/cmd/session"
3131
import { DbCommand } from "./cli/cmd/db"
32-
import path from "path"
33-
import { Global } from "./global"
3432
import { JsonMigration } from "./storage/json-migration"
3533
import { Database } from "./storage/db"
3634
import { errorMessage } from "./util/error"
@@ -108,8 +106,8 @@ const cli = yargs(args)
108106
args: process.argv.slice(2),
109107
})
110108

111-
const marker = path.join(Global.Path.data, "opencode.db")
112-
if (!(await Filesystem.exists(marker))) {
109+
// Use the database path as the marker to trigger migration if missing
110+
if (!(await Filesystem.exists(Database.Path))) {
113111
const tty = process.stderr.isTTY
114112
process.stderr.write("Performing one time database migration, may take a few minutes..." + EOL)
115113
const width = 36

0 commit comments

Comments
 (0)