View
[Django] django.db.migrations.exceptions.InconsistentMigrationHistory
soooeun 2023. 7. 28. 19:31django.db.migrations.exceptions.InconsistentMigrationHistory: Migration account.0001_initial is applied before its dependency user.0001_initial on database 'default'.
User 모델을 수정하다가 다음과 같은 에러가 발생했다.DB를 아예 지우고 다시 migrate 하니 잘 작동했다.
1. user의 migrations 폴더를 삭제한다.
2. user의 상위 폴더에 있는 db.sqlite3를 삭제한다
3. python manage.py makemigrations user
4. python manage.py migrate user
이와 같이 DB를 삭제하고 다시 migrate하니 에러가 해결되었다.
+ 사실 이렇게 migrations 폴더 자체를 지우는 건 좋은 방법이 아니다. 문제가 되는 특정 파일만 없애고 다시 migrate하는게 좋을 것 같다!
'Develop > Error' 카테고리의 다른 글
[Spring] Cannot snapshot index.html: not a regular file 에러 해결 (0) | 2023.08.24 |
---|---|
[Ubuntu] mysqlclient 설치 오류: Exception: Can not find valid pkg-config name. (0) | 2023.07.30 |
[Linux] tmp is full/No space left on device 해결 (0) | 2023.05.15 |
[VSC] 업데이트 에러 해결 (1) | 2023.03.20 |
[IntelliJ] java: cannot find symbol (0) | 2023.02.27 |
reply