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:
Connecting to remote database...


Local | Remote | Time (UTC)
----------------|----------------|---------------------
20250919170614 | 20250919170614 | 2025-09-19 17:06:14
20250919171051 | 20250919171051 | 2025-09-19 17:10:51
20250919171125 | 20250919171125 | 2025-09-19 17:11:25
20250919171226 | 20250919171226 | 2025-09-19 17:12:26
20250919171240 | 20250919171240 | 2025-09-19 17:12:40
20250920082841 | 20250920082841 | 2025-09-20 08:28:41
| 20250930132918 | 2025-09-30 13:29:18
Connecting to remote database...


Local | Remote | Time (UTC)
----------------|----------------|---------------------
20250919170614 | 20250919170614 | 2025-09-19 17:06:14
20250919171051 | 20250919171051 | 2025-09-19 17:10:51
20250919171125 | 20250919171125 | 2025-09-19 17:11:25
20250919171226 | 20250919171226 | 2025-09-19 17:12:26
20250919171240 | 20250919171240 | 2025-09-19 17:12:40
20250920082841 | 20250920082841 | 2025-09-20 08:28:41
| 20250930132918 | 2025-09-30 13:29:18
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
ihm40
ihm405h ago
do you use any AI tool (these tend to mess up migrations) try running supabase db pull
Steve
SteveOP5h ago
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
ihm40
ihm405h ago
you might have to revert it then, this won't change the remote database but check what those changes are first
Steve
SteveOP5h ago
can you explain what does repair/revert do? does it change my local migrations history or the remote one?
ihm40
ihm405h ago
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
ihm40
ihm405h ago
but you might need that migration if it is important
Steve
SteveOP5h ago
I'm sure you meant ?schema=supabase_migrations in the end?
ihm40
ihm405h ago
i think that is the schema name and then there is a table for migrations is it different for you?
Steve
SteveOP5h ago
not its under ?schema=supabase_migrations and table is called schema_migrations
ihm40
ihm405h ago
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
Steve
SteveOP5h ago
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"" ]
ihm40
ihm405h ago
these schemas do not exist in supabase and presumably you don't recognise those table names?
Steve
SteveOP4h ago
i just aksed gpt to anonymize the data because it's from my company
ihm40
ihm404h ago
oh okay, that makes sense
Steve
SteveOP4h ago
thats why table names are different so i cant get this migration also locally?
ihm40
ihm404h ago
give me a second
Steve
SteveOP4h ago
i have to wait for the other dev to push his latest migration to github?
ihm40
ihm404h ago
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 down
Steve
SteveOP4h ago
it worked! thank you!
No description
ihm40
ihm404h ago
nice, yeah in general reverting changes are only a good idea when things are really out of wack
Steve
SteveOP4h ago
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
Steve
SteveOP4h ago
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
ihm40
ihm404h ago
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
Steve
SteveOP2h ago
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?

Did you find this page helpful?