You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a failed migration leaves partial schema changes or table data in your database without recording the version in supabase_migrations.schema_migrations, this is usually caused by explicit transaction control commands inside the migration file.
Why this happens
When migration files include explicit BEGIN and COMMIT statements, they break the migration runner's built-in transaction wrapper. Any statements executed prior to an embedded COMMIT persist durably in your database, even if subsequent statements fail.
How to resolve and prevent partial migrations
Remove explicit transaction commands: Remove BEGIN, COMMIT, or other transaction-control statements from your migration SQL files so the migration runner can handle atomicity automatically.
Clean up partial objects: If a migration containing an embedded COMMIT has failed midway, inspect the database and manually roll back or drop any partially created objects before running the migration again.
Verify migration history: Check the recorded migration history against your actual schema by querying supabase_migrations.schema_migrations or running:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
If a failed migration leaves partial schema changes or table data in your database without recording the version in
supabase_migrations.schema_migrations, this is usually caused by explicit transaction control commands inside the migration file.Why this happens
When migration files include explicit
BEGINandCOMMITstatements, they break the migration runner's built-in transaction wrapper. Any statements executed prior to an embeddedCOMMITpersist durably in your database, even if subsequent statements fail.How to resolve and prevent partial migrations
BEGIN,COMMIT, or other transaction-control statements from your migration SQL files so the migration runner can handle atomicity automatically.COMMIThas failed midway, inspect the database and manually roll back or drop any partially created objects before running the migration again.supabase_migrations.schema_migrationsor running:Related topics
All reactions