How To Update MySQL Database To Reflect The Changes In Django Model

Do you like this?

Summary:
This is just my personal experience as to how to change the database according to the changes in Django models. Hence, it is absolutely not the best solution but you can use this as a reference or to gain some more knowledge regarding how Django generates database tables based on the models.


Content:

Basically, I had a model called Image used to store image links. Later all, I wanted to use the model for other types of downloadable objects such as zipped files or PDF. Instead of creating another model for the same purpose, I decided to change my existing model Image to File plus adding one more extra column to the model called type so that they can be distinguished as to what kind of files they are and how they should be handled accordingly.

 
comments powered by Disqus