본문 바로가기
카테고리 없음

It is impossible to change a nullable field 'address' on machinesite to non-

by jennyiscoding 2024. 6. 17.

장고 null=True를 제거하고 에러가 뜬다

 

nullable without providing a default. This is because 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) Ignore for now. Existing rows that contain NULL values will have to be handled manually, for example with a RunPython or RunSQL operation.
 3) Quit and manually define a default value in models.py.
Select an option: 1
Please enter the default value as valid Python.
The datetime and django.utils.timezone modules are available, so it is possible to provide e.g. timezone.now as a value.
Type 'exit' to exit this prompt
>>> exit

 

해결방법: __init__.py파일 빼고 다 지우고나서 makemigrations 다시 돌리기!!