Skip to content

fix: DB migrating on every run for non-latest channels#21056

Open
bew wants to merge 1 commit intoanomalyco:devfrom
bew:fix-repeated-migration
Open

fix: DB migrating on every run for non-latest channels#21056
bew wants to merge 1 commit intoanomalyco:devfrom
bew:fix-repeated-migration

Conversation

@bew
Copy link
Copy Markdown

@bew bew commented Apr 4, 2026

Issue for this PR

Closes #21057
Closes #16885
Replaces #16884

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

This PR fixes DB migration that was running on every start of opencode when installed from nixpkgs.
The nix package in nixpkgs sets OPENCODE_CHANNEL = "stable", which makes the DB have the name opencode-stable.db instead of opencode.db that the marker implied.

👉 Using the database function to get the db path, taking the OPENCODE_CHANNEL into account fixes the problem.

(change done manually, zero AI involved)

How did you verify your code works?

Yes, locally.

Screenshots / recordings

image The first run is from `main`, the second is with this PR.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 4, 2026

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions github-actions bot added the needs:compliance This means the issue will auto-close after 2 hours. label Apr 4, 2026
@github-actions github-actions bot removed needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Apr 4, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 4, 2026

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@bew bew force-pushed the fix-repeated-migration branch from 5defc3f to 400fd62 Compare April 5, 2026 00:02
@bew bew changed the title fix: DB migrating on every run when OPENCODE_CHANNEL is e.g. 'stable' fix: DB migrating on every run for non-latest channels Apr 5, 2026
@bew
Copy link
Copy Markdown
Author

bew commented Apr 5, 2026

The failing test / unit (linux) (pull_request) pipeline seems to be for another reason 🤔

1 tests failed:
(fail) memory: abort controller leak > webfetch does not leak memory over many invocations [487.59ms]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant