feat: interpret migrations with yaegi instead of compiling#2
Merged
Conversation
…mpiled) Reframe the documentation to make the runtime model explicit: - Migration files are valid Go source — IDE/gopls/go vet treat them as ordinary Go and type-check them via migrations/go.mod. - At runtime they are interpreted by yaegi (an embedded Go interpreter), not compiled by gc. The dialect is "Go-like": yaegi implements the Go spec but cgo, deep reflection, and some generics edge cases differ. - migrations/main.go is now an *optional* standalone-binary fallback, not the primary execution path. Touched files: - README.md: prominent runtime-model callout in the lede; reword feature bullets to reflect "no build step at runtime" and "optional standalone binary". - docs/architecture.md: rewrite the runtime sections, the data flow diagrams, the "Compiled Binary as Source of Truth" decision, the init() registration pattern, the App description, and the directory tree to reflect the in-process yaegi loader. Add a "yaegi Symbol Map" section pointing at migrate/symbols/. - docs/migrations.md: add a runtime-model callout next to the writing guide so authors understand what runs their code; replace the remaining `cd migrations && go build` invocation in showsql with `makemigrations migrate showsql`. - docs/Usage.md: rewrite the migrate intro and showsql section. - docs/installation.md: add a "How migrations run" section, remove the Build the Migrations Binary step from the quickstart, and update the CGO troubleshooting guidance. - docs/commands/init.md: explain main.go is optional and describe what go.mod and main.go are each for; replace the "Rebuild After Changes" section with "No Rebuild Step Required". - docs/commands/makemigrations.md: explain the queryDAG step uses yaegi rather than go build; rewrite all example workflows to use `makemigrations migrate up`; rewrite the troubleshooting entry for load failures. - docs/manual-migration-build.md: reframe the whole guide as the *optional* standalone-binary path with reasons you might want it, and lead the CI/CD example with the yaegi-based recommendation. - docs/commands/db-diff.md: update the "what it does" step that still referred to running the compiled binary. https://claude.ai/code/session_014Wn4chfaL2aTyjxMXeNBmm
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.
Replace the build-and-fork approach with in-process yaegi interpretation:
go build, no temp binary, no GOWORK synthesis, no toolchain version dance.dag --format jsonthrough a child binary.package mainto a virtual package, places the files in an in-memory FS, and overrides migrate.Register with a per-call shim so multiple loads can coexist in one process.yaegi extract-generated for the migrate package) plus a Register() hook so users with third-party imports in their migrations can extend it.The migrations/ directory remains a buildable Go module so IDE tooling keeps working and a standalone binary is still an option for users who want one. Removed the now-dead helpers buildMigrationsBinary, findLocalMakemigrations, upgradeMakemigrationsVersion, isFullGoVersion (~250 lines of build-toolchain plumbing).
https://claude.ai/code/session_014Wn4chfaL2aTyjxMXeNBmm