Demo, all content is generated
Question

Made changes in the dashboard, now supabase db push refuses to run

Solved · 1271 views · asked by felix_codes · edited

I mostly use migrations via Claude Code but last week I added a column and an index quickly in the dashboard. Now:

Remote migration versions not found in local migrations directory.

Make sure your local git repo is up-to-date. If the error persists, try repairing the migration history table:
supabase migration repair --status reverted 20250211093012

That version isn't one of mine. I'm afraid that running repair will delete my column.

What I’ve tried

Asked Claude Code, it wanted to run supabase db reset --linked, which I stopped because that sounds like it resets my production database.

Comment
Good call stopping that reset. --linked means the remote database. katja_s · edited
Oh. Glad I stopped it then. felix_codes · edited

2 answers

Marked as helpful by the asker
mira_dev · edited

migration repair only edits the history table (supabase_migrations.schema_migrations), it never touches your tables. So it's safe, but let's do it in the right order so your repo matches reality:

  1. See the mismatch: supabase migration list.
  2. Check what that remote version is: select version, name, statements from supabase_migrations.schema_migrations where version = '20250211093012'; Probably something recorded while you worked in the dashboard, or a migration from another machine.
  3. If you want that change in your repo: supabase migration repair --status reverted 20250211093012, then supabase db pull to write your current remote schema into a new local migration file. Commit it.
  4. supabase db push works again.

And then the boring rule: schema changes only through migration files, dashboard is for looking.

Comment
It was from my laptop, my repo on the desktop was behind. Pulled git first, then only needed db pull for the dashboard column. All green. felix_codes · edited
Classic. Put git pull before everything in your head. mira_dev · edited
katja_s · edited

For the future: a CI step that runs supabase db diff --linked and fails when the output isn't empty. Anything someone changed in the dashboard shows up there the same day instead of three weeks later.

Comment
Adding that to the workflow, thanks felix_codes · edited