Monday, July 19, 2021

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

What you can do is just change the name of the model then run the migration after that change it back to the original name and run the migration again.
This what I do when facing such problem

On Mon, 19 Jul 2021 at 08:41, Salima Begum <salima.b@rohteksolutions.com> wrote:
Hi Abhishek, What you suggested will work but I don't want to change my database without changing databases. I want to fix this issue. How can I achieve this? Please help me out.

Thank you very much for your quick response.

Thank you
~Salima

On Mon, Jul 19, 2021 at 11:45 AM Abhishek Choudhury <choudhuryabhishek76@gmail.com> wrote:
Hi Salima,

If you're in a hurry and trying it on development, I think you can create a new database and run the migrate command. This will recreate the schema and your issue will be resolved in no time. 

Thanks and regards, 
Abhishek Choudhury 

On Mon, 19 Jul 2021 at 10:37 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.
--
Thanks and regards,
Abhishek Choudhury
Mobile: +91 7903717967

--
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/CA%2B3kJUY6ZWPYtQtp_gVB9Ax8%3DK%3Dgh_hV%3D_OXfvt1iOv8QnvtHg%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/CAMSz6b%3DJROx2d1FWj%3DvB7_xZ%2Bwga2_RVPwL_xvfgfdY1%2BFcR-A%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/CAE0AZGKo1UhSexq64jGLXqsPUkiSq3WeSrQ%2BMn13x1Hhm8YrWA%40mail.gmail.com.

No comments:

Post a Comment