Sascuash
Sascuash

Reputation: 3831

problems updating DB to heroku with south migrations

I have a Django proyect running in heroku for some time now, the thing is that, tree days ago, I've tryed to update my schema model but, every time I write

heroku run python manage.py migrate quizzer

heroku keeps telling me that everything's up to date, but I've changed my models.py folder and run schema migration as always.

If you know why this is happening or how can I force a schema migration to my heroku app please tell me how.

Ps: I cannot delete the hole database as the data stored in heroku and the data stored in my local server database are not the same, and I don't want to loose the data of my users

Upvotes: 2

Views: 1395

Answers (3)

Francis Potter
Francis Potter

Reputation: 1639

South might be missing from requirements.txt. Try:

pip freeze > requirements.txt

...followed by another git add/commit/push.

Also, according to the South installation instructions, syncdb must be run first, "to make the South migration-tracking tables". So try:

heroku run python manage.py syncdb

...then try the migrate command again.

Upvotes: 1

Vincent van Leeuwen
Vincent van Leeuwen

Reputation: 701

I had this problem too. I solved this by running heroku restart and running the migrate command again. Don't know why it works (suspect it has to do with initial), but at least it works.

Hope that helps!

Upvotes: 1

akhaku
akhaku

Reputation: 1157

Here is a workflow for running a schemamigration on quizzer after modifying your models.py

./manage.py schemamigration quizzer --auto # create migration
./manage.py migrate quizzer # apply migration locally
git add .
git commit -m "Changed quizzer models, added schemamigration"
git push heroku
heroku run python manage.py migrate quizzer # apply migration on heroku

It sounds like you might have forgotten to check your migration file (usually found in appname/migrations) into git, commit it and push it to heroku.

Upvotes: 5

Related Questions