Django migrate gets error "table already exists"

John Doe ·

2045 Views

1. Remove all migration files in <appname>/migrations

2. Remove all data in django_migrations table where app = <appname>

3. 

python manage.py makemigrations <appname>

4. 

python manage.py migrate --fake <appname>

5. If you have a field to alter, then alter the field <field> on <appname> and then again

python manage.py makemigrations <appname>

6.

python manage.py migrate <appname>

Child's play.

 

0003이 실제로 적용된 가장 최근의 마이그레이션이라 가정할 때에는?

--fake를 이용하여 현재 상태는 0003이다 라고 장고가 인식하게끔 해주어야 한다.

python manage.py migrate --fake <appname> 0003

그 후 평소 하던대로 진행.

 

I am trying to apply a migration but am getting the error: django.db.utils.OperationalError: (1050, "Table 'customers_customer' already exists") I get this by issuing the following command: ...
Something went wrong on my migrations, I added a new datetimefield to a model then I used makemigrations and migrate. python manage.py makemigrations python manage.py migrate But after this the m...

django migration