fix(db): reload PostgREST schema cache so open_to_work_email is writable - #126
Merged
nikshepsvn merged 3 commits intoAug 18, 2026
Merged
Conversation
Saving a contact email on /hire fails with: Could not find the 'open_to_work_email' column of 'profiles' in the schema cache The column is not missing. Migration 009 adds it and setOpenToWork writes it, but PostgREST serves a cached schema and no migration ever asks it to reload, so the API rejects the write (PGRST204) while the column exists in the table. Add 013_reload_schema_cache.sql issuing NOTIFY pgrst, 'reload schema'. The cache is global, so one reload republishes every column from every earlier migration rather than just this one. Safe to re-run. Document it in the README so the reload is run after any future migration that adds a column.
|
@panbergco is attempting to deploy a commit to the sculpt Team on Vercel. A member of the Team first needs to authorize it. |
013 was taken by month_stats on main while this PR was open. The /hire email failure was the column genuinely missing in prod (009 unapplied), not a stale cache β but the explicit reload is right for any migration applied over psql or the management API, so it stays as 014. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
Thanks for the report and the fix β merging with two adjustments:
π€ Generated with Claude Code |
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.
Saving a contact email on
/hirefails with:Reproduced on production today (profile
panbergco, tier Supernova, rank #7) while opting in to open-to-work.Cause
The column is not missing.
009_open_to_work_email.sqladds it andsetOpenToWorkinsrc/lib/data/supabase/client.tswrites it. But PostgREST serves a cached copy of the schema, and no migration insupabase/migrations/ever asks it to reload βgrep -rn "NOTIFY\|pgrst" supabase/migrations/returns nothing. So the API rejects the write withPGRST204while the column exists in the table.Supabase reloads the cache on its own eventually, and the dashboard SQL editor usually triggers it β which is why this does not reproduce in a fresh local setup. A migration applied via the
supabaseCLI or a directpsqlconnection does not trigger it.Fix
Adds
013_reload_schema_cache.sql:NOTIFY pgrst, 'reload schema';Kept as its own migration rather than a line appended to 009, because the cache is global: one reload republishes every column from every earlier migration, so any other stale column is fixed at the same time. Safe to re-run and harmless when the cache is already current.
README gains a note to run it last, and again after any future migration that adds a column.
Notes
tsc --noEmitorpnpm buildto react to.