﻿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
27297	infinite AlterField migrations created for foreign key after case-only model name change	Daniel Musketa	nobody	"Tested and affected Django versions:
- 1.7
- 1.8
- 1.9
- 1.9.6
- 1.10.1


A ''case-only'' rename of a model is not detected. This leads to infinite migrations on a foreign key field that refers to the renamed model.

I created a minimal working example to reproduce this 
behaviour: https://github.com/vlt/django_ticket_27297_capitalization

When you run {{{./manage.py makemigrations}}} it will create
the following migration over and over again:

{{{
Migrations for 'app1':
  app1/migrations/0003_auto_20161001_2136.py:
    - Alter field fk_to_model1 on model2
}}}

The new file {{{0003_auto_20161001_2136.py}}}:

{{{
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-01 21:36
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    dependencies = [
        ('app1', '0002_model2'),
    ]

    operations = [
        migrations.AlterField(
            model_name='model2',
            name='fk_to_model1',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='app1.moDEl1'),
        ),
    ]
}}}

I have no idea why the Autodetector in migrations uses lower() in the first place."	Bug	closed	Migrations	dev	Normal	duplicate		daniel.musketa@… desecho@…	Accepted	0	0	0	0	0	0
