fix: auto-run database migrations on first use#5
Merged
corvid-agent merged 1 commit intomainfrom May 7, 2026
Merged
Conversation
Replace `fledge sql migrate --dir` with inline CREATE TABLE/INDEX statements executed via `fledge sql query`. The previous approach relied on the migrations directory being resolvable at runtime via `pluginDir`, which can fail when the path contains spaces, the plugin is installed in an unexpected location, or `fledge sql migrate` is unavailable. The inline approach uses IF NOT EXISTS so it is idempotent and safe to re-run on every invocation. Fixes "no such table: memories" on first save/recall/list/delete. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fledge sql migrate --dirwith inlineCREATE TABLE IF NOT EXISTS/CREATE INDEX IF NOT EXISTSstatements executed viafledge sql querypluginDir/migrationsbeing resolvable at runtime, which fails when the path contains spaces, the plugin is installed in an unexpected location, orfledge sql migrateis unavailable in older versions of fledge-plugin-sqlTest plan
.fledge/data.dband runfledge memory save --key test --value works --json-- should succeed without manual migration setupfledge memory recall --key test --json-- should return the saved valuefledge memory list --json-- should list the saved memoryfledge memory delete --key test --json-- should delete successfullyfledge sql schema --path .fledge/data.dbshows the correct schema (memories table + indexes)🤖 Generated with Claude Code