devgraphy / airsm-django-restapi

AIRSM 프로젝트의 REST API 기반 Back-end
0 stars 0 forks source link

django.db.utils.OperationalError: (1067, "Invalid default value for 'name'") #3

Open devgraphy opened 3 years ago

devgraphy commented 3 years ago

기존 model에 새로운 field를 추가하고 makemigrations와 migrate를 하면서 다음과 같은 문제가 발생하였다. 어떻게 이 문제를 해결하고 새로운 field를 추가할 땐 어떻게 해야하는가?

python manage.py makemigrations ->

You are trying to add a non-nullable field 'name' to member without a default; we can't do that (the database 
needs something to populate existing rows).
Please select a fix:
 1) Provide a one-off default now (will be set on all existing rows with a null value for this column)        
 2) Quit, and let me add a default in models.py
Select an option:1 

python manage.py migrate ->

django.db.utils.OperationalError: (1067, "Invalid defagrateult value for 'name'")
devgraphy commented 3 years ago

파이썬 쉘에 접속해서 직접 값을 부여해주면 되나??