Wednesday, October 28, 2015

Running migrations on the non-default database fails

Hello,

I have an application which, due to low usage, used SQLite in production. Now the demand has risen for the app, and SQLite can't really keep up with with all the new users. We decided to move to PostgreSQL.

The DB is now up and running, but to cause as short downtime as possible, I added a new database to settings.py, and tried to run migrations on it:

python manage.py migrate --database postgre

The first few ran fine, but one of them tried to do a RunPython function which should have modified the value of a column that had been removed from the production database in a later migration. At this point migrations failed: it turned out that, despite the --database parameter, RunPython wanted to iterate through the rows of the production database.

Is this a problem/limitation in Django, or should I update my migration functions to use the correct database? If the latter, how do I know which database to use?

Best,
Gergely

--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACczBU%2BPX87MQcC6ewQfFJUvNNnAY0s8pKisy%3DB_Nhvcm6DvDg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment