fix: give the two colliding migrations distinct versions - #62
Closed
skabou wants to merge 1 commit into
Closed
Conversation
20260815140000_assignment_parent_session.sql (#52) and 20260815140000_roster_revoke_anon_read.sql (#48) share a version prefix. Supabase records an applied migration by timestamp as its unique id and compares only timestamps, so the second one is treated as already applied and silently skipped. That means one of these never ran on any database built from this repo: either parent_session_id is missing, or the revoke of anon/authenticated select on roster_students and assignments never happened -- the table holding the free-text adaptations column. Both are renamed rather than one, because there is no way to tell from here which version was recorded. Both are idempotent, so re-running is safe. No SQL changed.
|
Deployment failed for project interactive-learning-experiences with the following error: Learn More: https://vercel.com/variantly?upgradeToPro=build-rate-limit |
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.
20260815140000_assignment_parent_session.sql(#52) and20260815140000_roster_revoke_anon_read.sql(#48) both landed onmainwith the same version prefix.That is not cosmetic. Per the Supabase docs, applying a migration inserts a row "with timestamp as its unique id", and
migration listcompares "only the timestamps". So once20260815140000is recorded, the other file with that version is treated as already applied and silently skipped — no error, no output.Whichever sorts first wins, so one of two things is true of any database built from this repo:
parent_session_idwas never added, and the dashboard's parent/child session grouping is broken, orrevokenever ran, leavingselectonroster_studentsandassignmentsgranted toanon/authenticatedThe second is the one to care about.
roster_studentsholds the free-textadaptationscolumn that the UI solicits IEP and accommodation notes into. That grant is inert today only because RLS is enabled with no policies — a fail-closed accident, as the migration's own comment says. It stops being inert the moment anyone adds a permissive policy.The fix
Both files get fresh, distinct versions:
Both, not just one — whichever version got recorded, the other migration was skipped, and there is no way to know which from here. Giving both new versions makes both run again everywhere and repairs either case.
Safe to re-run:
revokeis idempotent, and the other isadd column if not existspluscreate index if not exists.No SQL was changed, only the filenames.
Not verified locally
There is no Docker on this machine, so I could not stand up a local Supabase and reproduce the skip. The mechanism is from the Supabase documentation rather than observation.
supabase db reseton any machine with Docker would confirm it — worth doing before merge if that is cheap for you.If a deployed database is already in the skipped state, the renamed migrations will apply on the next push and correct it.