Friday, March 31, 2023

regarding databases and models.py relation

when we create a table in database , we create through models.py . 
we migrate and apply the changes .
Issue arises as after creation of table -> i tried to add a coloum manually to the db , and wrote the col name in models.py and in views.py as it was a time field added, so
data was getting inserted in the database correctly as desired .

Note -> NO MIGRATIONS WERE APPLIED YET .

now I wanted to create a new col named say x , i wrote in models , views nd then applied migrations -> it started throwing error -> i stopped the creation of new colm .

i applied migrations again for checking if there is any issue -> it showed ypu have a unapplied migration that was related to the manuall chnage i had done .

so i tried migrating but it failed -> colm name already exists .

MY REQUEST -> ADD A FEAUTURE THAT CAN SYNCHRONISE THE MANUALL CHNAGES IN DATABASE WITH DJANGO ORM .
SO we dont fall in the migration error -> it by default migrates when we make manuall chnages in the database .


if my request is valid , let me know for any solutions, if it not valid ,please still let me know why ?

Thank you in advance
 
  

--
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/6b047463-f3fb-4362-b105-821a224e3d31n%40googlegroups.com.

No comments:

Post a Comment