Codegen: opt-in auto-sync (models track the live schema)#68
Merged
Conversation
supabaseCodegen { autoSync = true } wires generation into every Kotlin compile so
models are regenerated from the live schema into build/generated/supabase (gitignored,
never hand-edited) — the SQLDelight/RevenueCat 'generated code is build output' model.
Missing SUPABASE_URL/KEY skips with a warning (offline/CI stay green); a reachable-but-
failing fetch still fails the build. Default remains the on-demand task.
Switch the chat-compose sample to auto-sync: drop the committed generated models and
generate them into build/ at build time (config-cache compatible).
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.
Implements auto-sync — the whole point of the codegen: generated models always reflect the live Supabase schema, SQLDelight/RevenueCat style (generated code is build output, never hand-edited).
Plugin
supabaseCodegen { autoSync = true }wiresgenerateSupabaseModelsto run before every Kotlin compile, writing intobuild/generated/supabase(gitignore it).SUPABASE_URL/SUPABASE_KEYare unset, auto-sync skips with a warning rather than failing the build. A configured-but-unreachable fetch still fails (you want to know when code and DB diverge).supabase gen types).Sample
build/at build time (configuration-cache compatible).Verified
tables/ChatRooms.kt,ChatMessages.kt,E2eMessages.ktintobuild/generated/supabase/, config-cache clean.