Forums

Django Migrations not working after adding new tables

Hello People,

I recently decided to add a couple of apps to my django site, namely a blog and a to do list. I was messing with the migrations to get them into the database, and I have everything up at running in development now. However, when I go to migrate on the PythonAnywhere server, I get this error:

CommandError: Conflicting migrations detected; multiple leaf nodes in the migration graph: (0019_auto_20160302_0320, 0001_squashed_0006_auto_20160228_0007 in blog).
To fix them run 'python manage.py makemigrations --merge'

I run the command that they suggest and get this error:

ValueError: Could not find common ancestor of {'0019_auto_20160302_0320', '0001_squashed_0006_auto_20160228_0007'}

So, my question is this:

How can I delete all records of my migrations and start over from scratch? It is worth noting that I have deleted the MySQL database that this runs on, which works in development. This solution did not work in PythonAnywhere. There still somehow exists a record of past migrations not on the database. Someone please help me find it.

Thanks, Rob

Specs: Python 3.4, Django 1.9

I think that means the conflict is in the migrations files on disk, not in the migration history that's in the database.

You could confirm this by backing up and deleting your database locally, and trying to re-migrate it?

If that does work, then maybe you have an extra migration file that somehow got added on PythonAnywhere? check with your version control system to see if there are any unexpected files?

Harry,

Thanks I looked on the VCS and realized that I was neglecting the migrations folders in my apps.

  • Rob

That'll do it.