Supabase migration drift ("found local migration ... not applied") in CI
Drift means the applied migration history on the remote database and the files in supabase/migrations disagree. This happens when someone changed the schema in the dashboard or applied a migration that was later removed locally.
What this error means
A push or diff step reports "Remote migration versions not found in local migrations directory" or "found local migration files to be inserted before the last migration".
The remote database's migration history does not match local files in
supabase/migrations directory.
Remote migration versions not found in local migrations directory: 20260601000000Common causes
Schema changed outside migrations
A dashboard edit or a manual SQL change altered the remote schema without a corresponding migration file, so the histories diverge.
A local migration was removed or reordered
Deleting or renaming an applied migration file makes the local set inconsistent with what the remote recorded.
How to fix it
Capture the drift into a migration
- Diff the remote against local to see the untracked change.
- Generate a migration that records it, or repair the history.
- Commit the migration so CI and remote agree going forward.
supabase db diff --linked --file capture_driftRepair the migration history
Mark the out-of-band version as applied (or reverted) so the recorded history matches reality.
supabase migration repair --status reverted 20260601000000How to prevent it
- Make schema changes only through committed migrations.
- Avoid editing the schema in the dashboard for environments CI manages.
- Never delete or reorder migration files that have been applied.