﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
26488	migrate crashes when renaming a multi-table inheritance base model	Christopher Neugebauer	nobody	"I needed to rename the base class that several models depend on due to a change in naming conventions in my product. It appears as though this is not possible.

I was able to reproduce this in Django 1.9.2 with the following simple case:

Steps to reproduce:

Create a fresh django project, and populate models.py like so:
{{{
from django.db import models


class Base(models.Model):
    foo = models.BooleanField()


class SubA(Base):
    bar = models.BooleanField()
}}}

Run makemigrations to get an initial migration file.

Replace the contents of models.py with the following:
{{{
from django.db import models


class BrokenBase(models.Model):
    foo = models.BooleanField()


class SubA(BrokenBase):
    bar = models.BooleanField()
}}}

Run makemigrations, and accept all of the y/N questions. It correctly detects the renames, like so:

{{{
Did you rename the oops.Base model to BrokenBase? [y/N] y
Did you rename suba.base_ptr to suba.brokenbase_ptr (a OneToOneField)? [y/N] y
}}}

Now run migrate:

{{{
django.db.migrations.exceptions.InvalidBasesError: Cannot resolve bases for [<ModelState: 'oops.SubA'>]
This can happen if you are inheriting models from an app with migrations (e.g. contrib.auth)
 in an app with no migrations; see https://docs.djangoproject.com/en/1.9/topics/migrations/#dependencies for more
}}}"	Bug	closed	Migrations	dev	Normal	duplicate		Matthijs Kooijman Aaron Riedener	Accepted	0	0	0	0	0	0
