Janne
Janne

Reputation: 1001

Postgresql changes in Heroku and Django combo with shared database

I've just started using Heroku with Django and it seems great. However, when I change my existing models I'm not sure how to run those changes to the Heroku environment. The syncdb works just fine when adding all new database tables, but how should I modify existing tables?

I found out that Heroku provides psql access only to a dedicated database so that's out of the question. I haven't tried South but it seems like a solution.

So I guess I'm asking how to make database changes with Django and Heroku?

Upvotes: 4

Views: 795

Answers (2)

thirteenpixels
thirteenpixels

Reputation: 11

South works great on Heroku.

Upvotes: 0

jpic
jpic

Reputation: 33410

What you are asking for is called "schema migration" or even "schema evolution". Django has some documentation about it on the wiki.

Django's syncdb command does not support that. As a matter of fact, the documentation for syncdb is clear:

Creates the database tables for all apps in INSTALLED_APPS whose tables have not already been created

Rather, django proposes to use drop the tables manually and then to run syncdb again in the documentation of the deprecated reset command:

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

But fear not, there are many reusable apps to help you with proper schema migrations and hopefully you can pick the one that suits you best. Rather than elaborate in my answer, please let me link an article I wrote about Django schema migration which compares all current solutions.

Upvotes: 3

Related Questions