Skip to content

Codegen: opt-in auto-sync (models track the live schema)#68

Merged
AndroidPoet merged 1 commit into
mainfrom
feat/codegen-auto-sync
Jun 22, 2026
Merged

Codegen: opt-in auto-sync (models track the live schema)#68
AndroidPoet merged 1 commit into
mainfrom
feat/codegen-auto-sync

Conversation

@AndroidPoet

Copy link
Copy Markdown
Owner

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 } wires generateSupabaseModels to run before every Kotlin compile, writing into build/generated/supabase (gitignore it).
  • Offline/CI safe: if SUPABASE_URL/SUPABASE_KEY are 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).
  • Default remains the on-demand task (commit output, like supabase gen types).

Sample

  • chat-compose switched to auto-sync: dropped the committed generated models; they're now generated into build/ at build time (configuration-cache compatible).

Verified

  • Plugin builds + tests green (added a functional test: autoSync + no creds → build succeeds, codegen skipped).
  • End-to-end: brought up the local Supabase stack and ran the sample's auto-sync task — it fetched the live schema and generated tables/ChatRooms.kt, ChatMessages.kt, E2eMessages.kt into build/generated/supabase/, config-cache clean.

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).
@AndroidPoet AndroidPoet merged commit a0c0a32 into main Jun 22, 2026
6 of 8 checks passed
@AndroidPoet AndroidPoet deleted the feat/codegen-auto-sync branch June 22, 2026 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant