Skip to content

fix: give the two colliding migrations distinct versions - #62

Closed
skabou wants to merge 1 commit into
mainfrom
fix/duplicate-migration-version
Closed

fix: give the two colliding migrations distinct versions#62
skabou wants to merge 1 commit into
mainfrom
fix/duplicate-migration-version

Conversation

@skabou

@skabou skabou commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator

20260815140000_assignment_parent_session.sql (#52) and 20260815140000_roster_revoke_anon_read.sql (#48) both landed on main with 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 list compares "only the timestamps". So once 20260815140000 is 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_id was never added, and the dashboard's parent/child session grouping is broken, or
  • the revoke never ran, leaving select on roster_students and assignments granted to anon/authenticated

The second is the one to care about. roster_students holds the free-text adaptations column 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:

20260815150000_assignment_parent_session.sql
20260815150001_roster_revoke_anon_read.sql

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: revoke is idempotent, and the other is add column if not exists plus create 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 reset on 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.

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.
@vercel

vercel Bot commented Aug 15, 2026

Copy link
Copy Markdown

Deployment failed for project interactive-learning-experiences with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/variantly?upgradeToPro=build-rate-limit

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