How to Fix Supabase Migration Conflict in AI-Built Apps
Supabase migrations fail due to conflicts between local and remote states. AI-generated migration files often conflict with changes made through the Supabase Dashboard or by other team members.
Error messages you might see
Error: supabase migration repair: migration has already been appliedERROR: relation "users" already existsWhy this happens in AI-generated code
Dashboard changes conflict with migrations
Schema changes made through the Supabase Dashboard aren't captured in local migration files.
Duplicate migration timestamps
AI generates migration files with timestamps that collide with existing migrations.
Divergent migration history
Different environments have applied different subsets of migrations, creating inconsistent states.
How to fix it
Use supabase db diff to sync
Run `supabase db diff` to capture Dashboard changes as a migration file, keeping local and remote in sync.
Repair migration history
Use `supabase migration repair` to mark migrations as applied or reverted in the migration history table.
Get professional help
Our code audit identifies this issue and provides a fix. Start at springcode.co/products for $19.
Related technologies
Can't fix it yourself?
Our code audit identifies this issue and dozens more. Get a prioritized fix list.
Security Scan
Black-box review of your public-facing app. No code access needed.
- OWASP Top 10 checks
- SSL/TLS analysis
- Security headers
- Expert review within 24h
Code Audit
In-depth review of your source code for security, quality, and best practices.
- Security vulnerabilities
- Code quality review
- Dependency audit
- AI pattern analysis
Complete Bundle
Both scans in one package with cross-referenced findings.
- Everything in both products
- Cross-referenced findings
- Unified action plan
100% credited toward any paid service. Start with an audit, then let us fix what we find.
Frequently asked questions
Should I make schema changes through the Dashboard or migrations?
Always use migrations for reproducibility. If you use the Dashboard, immediately run `supabase db diff` to capture the changes.
How do I reset my local Supabase database?
Run `supabase db reset` to drop and recreate the local database, applying all migrations from scratch.
Related resources
Related Technologies
Still stuck? We can fix it for you.
Send us your repo. We'll diagnose the issue and give you a fixed quote within 24 hours.