Repository navigation
Inline configs: migrate/check command parity and optional db - #150
Merged
Merged
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
commit: |
sqlfu migrate, check, sync, pending, applied, find, goto and baseline now work on inline defineConfig projects. loadContextConfig resolves an inline project into a real SqlfuContext instead of throwing: a synthesized project config plus the statically-parsed definitions SQL and migration entries as in-memory repo inputs, consumed via the two repo-input seams (readDefinitionsSql / readMigrationsFromContext). All the command internals already only used context.config + context.host, so they work unchanged - including the .sqlfu/app.db default database when no db is declared, matching file-backed configs. Inline configs also accept the same optional db (path or factory) as file-backed configs. The static parser records whether a defineConfig object declares db, and only then does the CLI dynamically import the module (via a new optional host.importConfigModule capability) - so runtime-only modules like Durable Objects importing cloudflare:workers are never imported. String paths resolve relative to the config module; a db on a non-exported config errors with instructions to export it. Deliberate limits: modules with multiple inline defineConfig calls error for db commands (that's the runtime-managed multi-DO shape), drafting for inline stays on the appendInlineMigration path, and the Admin UI backend remains file-backed-only with an updated error message. Docs: the CLI/README command-shape notes now describe parity, and the turso guide's db factory example is back - this time against an API that actually supports it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Collaborator
Author
|
🤖 Merged into #148 directly (fast-forward of |
mmkal
added a commit
that referenced
this pull request
Oct 29, 2026
Both tasks' checklists are done; the commands task shipped as #150, merged into this branch. Co-Authored-By: Claude Opus 5.5 <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
Stacked on #148. Gives inline defineConfig projects the same CLI command surface as file-backed ones:
sqlfu migrate,check,sync,pending,applied,find,goto, andbaselinenow work on inline configs, and inline configs accept the same optionaldb(path or factory).Before / after
Before, every database-touching command rejected inline projects:
After, the same commands work with the same semantics as file-backed configs — inline migration entries are the migrations, the inline
definitionstemplate is the desired schema, and the database is the config'sdbor the.sqlfu/app.dbdefault:Design
loadContextConfigresolves inline projects into a realSqlfuContext(synthesized project config + statically-parsed definitions/migrations as in-memory repo inputs) instead of throwing. The two repo-input seams (readDefinitionsSql,readMigrationsFromContext) consultcontext.inline; every command internal already consumed onlycontext.config+context.host, so the migration engine, diff, and check analysis work unchanged.The CLI only dynamically imports the inline module when it statically detects a
dbproperty (newInlineConfigSource.hasDb+ optionalhost.importConfigModulecapability), so runtime-only modules — Durable Objects importingcloudflare:workers— are never imported. Adbon a non-exported config errors with instructions to export it.Deliberate limits: modules with multiple inline defineConfig calls error for db commands (the runtime-managed multi-DO shape where CLI migrate doesn't apply), inline drafting stays on the
appendInlineMigrationpath, and the Admin UI backend remains file-backed-only.See
tasks/inline-config-commands.mdfor the full spec.Verification
pnpm --filter sqlfu exec vitest run test/inline-commands-parity.test.ts— new end-to-end tests: migrate/check/pending/applied against the default db, adbpath, and adbfactory (real module import through a temp-dirnode_modulessymlink); drift detection with no database; clear errors for non-exporteddband multi-config modulespnpm --filter sqlfu exec vitest run— full suite; only the pre-existing environmental failures (resolve-sqlfu-uineeds the ui package built;generate-watchtimeout flake)pnpm --filter sqlfu typecheck && pnpm --filter @sqlfu/ui typecheck🤖 Generated with Claude Code