yes it works after deletion because old records get deleted.

but better approach is to do changes in migration.py files

On Sat, Sep 12, 2020 at 8:14 PM Mislav Jurić <[email protected]>
wrote:

> Hey Danish,
>
> I was able to resolve the error by deleting the *db.sqlite3* file from my
> project root directory and all of the *migration* folders from all of my
> apps.
>
> Thank you for responding.
>
> Best,
> Mislav
>
> Dana subota, 12. rujna 2020. u 14:56:13 UTC+2 korisnik [email protected]
> napisao je:
>
>> you need to give default value in email. seems few records are already
>> exist.
>>
>> else delete sqllite file and try again.
>>
>> On Sat, Sep 12, 2020 at 6:22 PM Mislav Jurić <[email protected]>
>> wrote:
>>
>>> Hey guys,
>>>
>>> I added an EmailField
>>> <https://docs.djangoproject.com/en/3.1/ref/models/fields/#emailfield>
>>> to some of my already existing models. When I tried to run:
>>>
>>> *python manage.py makemigrations*
>>>
>>> I got the following prompt:
>>>
>>>
>>>
>>>
>>>
>>> *You are trying to add a non-nullable field 'email' to employee 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.pySelect an option: *
>>>
>>> I quit the prompt (option two). Then I went ahead and commented out the
>>> new EmailField in the models I added them and I dropped all of the database
>>> rows in my entire database (not just the rows related to the models where I
>>> added the new email field; I dropped every row from every table).
>>>
>>> Then I uncommented the new EmailField and tried to run:
>>>
>>> *python manage.py makemigrations*
>>>
>>> again, *but I still get the prompt above*! I selected option 1 a few
>>> times, but I'm not sure what I need to do. I tried to supply a value for
>>> that field, but the prompt is a Python shell, so I'm not sure what I need
>>> to do if I select option 1.
>>>
>>> *How do I fix this?*
>>>
>>> Best,
>>> Mislav
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CABTqP_HKzXHOAKC-y0AedjsxtBcgKLEk9Cj9J7nhgoD1EpNf%2BA%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CABTqP_HKzXHOAKC-y0AedjsxtBcgKLEk9Cj9J7nhgoD1EpNf%2BA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
>>
>> --
>> Thanks & Regards
>>
>> Regards,
>> Danish
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/ac5c4f4d-8b2f-469d-9e7a-260a415d4644n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/ac5c4f4d-8b2f-469d-9e7a-260a415d4644n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Thanks & Regards

Regards,
Danish

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPQdaF094eV_UnOOLg0N%3DktYb%3DpaBQa5nSRVbAyrxu4gNmMCAA%40mail.gmail.com.

Reply via email to