Short answer
Supabase keeps a list of the migrations it has run on each database and compares it with the files in supabase/migrations. When the two disagree, db push stops. Back up the live database, link the project with supabase link, then run supabase migration list to see where they split. If someone changed the live database by hand, run supabase db pull to capture that as a migration. If only the list is wrong, migration repair fixes the list without running any SQL.
Find the gap, then close it
01
Start with supabase migration list
“Only the timestamps are compared to identify any differences.” Supabase, CLI reference: db push
Read the error first: if it names a table, column or lock, skip to the last item. Otherwise link the project with supabase link and list the migrations. Each one shows on two sides, your local files and the live database, and the rows where only one side has it are the problem. Each migration is identified by its timestamp, the long number at the start of its file name, not by the rest of the name. Back up the live database before you change anything.
supabase migration list02
Someone changed the live database in the dashboard
“Making schema changes directly on your remote database (via the SQL editor or Table Editor) bypasses the migration history and will cause db push to fail with sync errors.” Supabase, Deploy database migrations
A common cause. A table or column added in the SQL editor or Table Editor on the live project never went into a migration file, so the history no longer describes the database. Pull the live schema into a new migration file and let the CLI mark it as applied when it asks to update the remote migration history table. Run migration list again: both sides should now match before you push. Commit the file and make every later change through migrations.
supabase db pull03
The change is there, but the history says it isn’t
“migration repair updates the tracking table only” Supabase, Deploy database migrations
If a migration was run by hand, its change is already in the database but missing from the migration history table (Supabase’s list of what has run). Use applied for that case. If the list says a migration ran but its change is not in the database, use reverted. Check the real tables first: repair only edits the list.
# The change is in the database, but missing from the list supabase migration repair --status applied <timestamp> # The list says it ran, but the change is not in the database supabase migration repair --status reverted <timestamp>04
A migration file the live history has never seen
“Include all migrations not found on remote history table.” Supabase, CLI reference: db push
If a migration file is missing from the live history and db push won’t run it, the --include-all flag includes every migration not found there. Run it with --dry-run first to see exactly what would run. If that change is already in the database, repair the history instead, or the SQL runs twice.
supabase db push --dry-run --include-all05
Two people pushed at the same time
“Coordinate so only one person runs db push at a time.” Supabase, Deploy database migrations
Migrations run in timestamp order, so pushes from two machines at once can collide. Agree that one person, or one CI job on merge to main, runs db push.
06
The SQL itself failed
“If a lock timeout error occurs, in your migration file, consider increasing your lock_timeout setting.” Supabase, Deploy database migrations
If the error names a table, column or lock rather than the history, the migration’s SQL is the problem, and the fix goes in that file. For a lock timeout, Supabase suggests raising lock_timeout in the migration file.
Checked against the vendor’s docs on : Supabase docs: Deploy database migrations; Supabase CLI reference: db push, migration list and migration repair.
Rather hand it over?
Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.
- from $450App Fix TicketOne reproducible bug in an existing mobile or web app, diagnosed and fixed.See scope and start
- from $450AI-Built App RescueA Lovable, Bolt or Cursor app checked end to end in 3 days, then its worst problems fixed at a fixed price.No issues worth fixing, no charge. If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way.See scope and start
Related: Supabase staging environment · Supabase project paused · Supabase RLS fixes · Supabase security review before launch