Postgresql changes in combining Heroku and Django with a common database

I just started using Heroku with Django, and it seems wonderful. However, when I change my existing models, I’m not sure how to launch these changes in the Heroku environment. Syncdb works great when adding all new database tables, but how do I modify existing tables?

I found out that Heroku only provides psql access to a dedicated database, so there is no question. I have not tried South, but this seems like a solution.

So, I think I'm asking how to make changes to the database with Django and Heroku?

+4
source share
2 answers

What you request is called ā€œ schema migration ā€ or even ā€œ schema evolution ā€. Django has documentation on this on the wiki .

Django syncdb command does not support this. In fact, the documentation for syncdb is clear :

Creates database tables for all applications in INSTALLED_APPS whose tables have not yet been created

Rather, django suggests using manually drop tables , and then run syncdb again in the documentation of the deprecated reset command :

You can also manually use the ALTER TABLE or DROP TABLE statements.

But fear is not , there are many reusable applications that will help you with the correct migrations of the schemes, and I hope you can choose the one that suits you. Instead of explaining my answer in detail, let me link an article I wrote about migrating a Django schema that compares all current solutions.

+3
source

South works great on Heroku.

0
source

Source: https://habr.com/ru/post/1396573/


All Articles