# django.db.migrations.exceptions.MigrationSchemaMissing: Unable to create the django_migrations table (already exists)

- **ID:** `python/django-migration-conflict`
- **Domain:** python
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

迁移表已存在但迁移历史不一致，通常由迁移冲突引起

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.2 | active | — | — |
| 4.0 | active | — | — |

## Workarounds

1. **使用 --fake 标记已应用的迁移** (90% success)
   ```
   python manage.py migrate --fake
   ```
2. **回滚并重新迁移** (85% success)
   ```
   python manage.py migrate app_name zero && python manage.py migrate app_name
   ```

## Dead Ends

- **删除 django_migrations 表** — 导致迁移历史丢失，无法追踪已应用的迁移 (90% fail)
- **手动修改迁移表记录** — 可能引入不一致，导致后续迁移失败 (80% fail)
