Category: Supabase and databases

Supabase CLI: migration history does not match

Read this guide in Polish

The migration command refuses further changes by the divergence of local and remote history.

How to identify the source of the problem

Compare the migration files in repo with entries in the remote project migration history table.

Compare the result for the authorized and unauthorised user, project name and exact error code.

Repair steps

Agree the true status of the scheme before repair history by making a backup.

How to Test Solution

After alignment of history, new migrations are applied exactly once.

Security and restrictions

Change permissions and scheme first on test data with backup. Do not put service role in your browser.