Tuesday, July 20, 2021

Re: Added new column to model and run migrations but not applied to database table

Hi ,
Thank you for your responses.
 I have tried all the ways Which you people suggested I am not getting any error while running makemigrations or migrate and 
python manage.py migrate --fake-initial. But those migrations are not applying to the database. How can I fix this issue without deleting the database? 

Thank you
~Salima
 

On Mon, Jul 19, 2021 at 7:02 PM Aman Vyas <amanvyas200@gmail.com> wrote:
if it is saying no changes detected while running makemigrations and you are sure that you changed models.py  then these things you can try:

1: python manage.py makemigrations appname

if this will not work then do that

2: delete migrations folder from your app and delete database then run again python manage.py makemigrations




On Mon, Jul 19, 2021 at 6:07 AM Salima Begum <salima.b@rohteksolutions.com> wrote:
Hi all,

I have added a new column to the existing model while developing. Then I run makemigrations and migrate. It is not applied to the database table which is created based on that model. How can I fix this issue? Please help me to complete this issue.

The below issue I am facing in deployment server after adding new field and deployed into server.

```
psycopg2.errors.UndefinedColumn: column shopping_ls_product_search.quality_prdct does not exist
LINE 1: ... Col1 FROM "shopping_ls_product_search" WHERE ("shopping_...
```
Thank you
~Salima

--
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 django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMSz6bnLkeN001UnxO3PdCg06Jc%3Dcr22kZXc71KL4w5CbYq_Cw%40mail.gmail.com.

--
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 django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAKZY6%3DAgrWzCmrBHpouSJG_Vfy7i6LQu81Q7EWBRq44Yf3053A%40mail.gmail.com.

--
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 django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMSz6bmQ5KAQ2SFHCMbf8UHkg34itZPFZ1OksP-2C3t5wAwTJQ%40mail.gmail.com.

No comments:

Post a Comment