Remote has more migrations then local
My local migrations are in sync up to 20250920082841, but the remote DB has an extra migration 20250930132918 that I don’t have locally:
Looks like someone applied a migration but didn’t commit it.
👉 Can I pull this missing migration from Supabase, or do I need to recreate it manually?
26 Replies
do you use any AI tool (these tend to mess up migrations)
try running
supabase db pull
Initialising login role...
Connecting to remote database...
The remote database's migration history does not match local files in supabase/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 20250930132918
you might have to revert it then, this won't change the remote database but check what those changes are first
can you explain what does repair/revert do?
does it change my local migrations history or the remote one?
CLI Reference | Supabase Docs
CLI reference for the Supabase CLI
revert removes a migration history in remote which is kind of like removing a database migration file locally. If you want you can see all of your remote migrations in
but you might need that migration if it is important
I'm sure you meant ?schema=supabase_migrations in the end?
i think that is the schema name and then there is a table for migrations
is it different for you?
not its under ?schema=supabase_migrations and table is called schema_migrations
ahh okay, i was using on old project for reference and i think that probably needs an upgrade, checked with another project that is more recent and you're right
the last migration has these statements, looks too important to delete it
[
"revoke references on table "public"."table_a" from "role_x"",
"revoke trigger on table "public"."table_a" from "role_x"",
"revoke truncate on table "public"."table_a" from "role_x"",
"revoke references on table "public"."table_a" from "role_y"",
"revoke trigger on table "public"."table_a" from "role_y"",
"revoke truncate on table "public"."table_a" from "role_y"",
"alter table "public"."table_b" drop constraint "table_b_constraint1"",
"alter table "public"."table_c" add column "flag_col" boolean default true",
"alter table "public"."table_b" add constraint "table_b_constraint1" CHECK (((method)::text = ANY ((ARRAY['option1'::character varying, 'option2'::character varying])::text[]))) not valid",
"alter table "public"."table_b" validate constraint "table_b_constraint1""
]
these schemas do not exist in supabase and presumably you don't recognise those table names?
i just aksed gpt to anonymize the data
because it's from my company
oh okay, that makes sense
thats why table names are different
so i cant get this migration also locally?
give me a second
i have to wait for the other dev to push his latest migration to github?
do
supabase migration fetch
locally
your database is not really broken you just have one extra schema in remote that you should be able to pull downit worked! thank you!

nice, yeah in general reverting changes are only a good idea when things are really out of wack
but why didn't I find this command "supabase migration fetch" on my own? like it's documented right here. how did I miss it? what should I do next time better so I find the solution myself? https://supabase.com/docs/reference/cli/supabase-migration-fetch
CLI Reference | Supabase Docs
CLI reference for the Supabase CLI
yeah in future I will look more into the "Reference" part of the documentation
i relied to much on the "Build" part which doesn't have all commands
i think i became familiar with it by docs also (plus i've solved this a few times for people so i happened to know it can be solved ), normally for cli issues i just look at all the available commands and see if any are suitable
But yeah, any other isssues, feel free to ask on discord
yeah sure thanks for the advice
my company has 2 supabase projects one for dev and one for prod and it's complicated keeping the migrations in sync. how would you approach this?