﻿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
23256	"Changes in Meta class are not detected after ""makemigrations"""	Manuel Kaufmann	nobody	"I found that adding ""permissions"" to the Meta class into a model and then removing these Meta class makes django migration system to be confused and it tries to create a new migrations with an empty ""options"" dictionary each time that ""makemigrations"" is ran.

Steps to reproduce:

 1. Create a new project
 1. Create a new app
 1. Install the app in the project
 1. Run ""migrate""
 1. Create a new model
{{{
class MyModel(models.Model):
    name = models.CharField(max_length=32)
}}}
 1. Run ""makemigrations""
 1. Run ""migrate""
 1. Add Meta class to MyModel
{{{
class MyModel(models.Model):
    name = models.CharField(max_length=32)

    class Meta:
        permissions = (
            ('use_mymodel', 'Use this model'),
        )
}}}
 1. Run ""makemigrations"" and you will get the ""options"" attribute in the migration file
{{{
operations = [
        migrations.AlterModelOptions(
            name='mymodel',
            options={'permissions': ((b'use_mymodel', b'Use this model'),)},
        ),
    ]
}}}
 1. Run ""migrate""
 1. Remove Meta class from MyModel
{{{
class MyModel(models.Model):
    name = models.CharField(max_length=32)
}}}
 1. Run ""makemigratios"" and you will get an empty ""options"" dictionary
{{{
operations = [
        migrations.AlterModelOptions(
            name='mymodel',
            options={},
        ),
    ]
}}}
 1. Run ""migrate""
 1. Run again ""migrate"" and you will get this message:
{{{
Your models have changes that are not yet reflected in a migration, and so won't be applied.
Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
}}}
 1. Run ""makemigrations"" again and the same migration file is created with empty ""options"" dictionary
{{{
class Migration(migrations.Migration):

    dependencies = [
        ('myapp', '0002_auto_20140807_1242'),
    ]

    operations = [
        migrations.AlterModelOptions(
            name='mymodel',
            options={},
        ),
    ]
}}}

Now, every time you run ""migrate"" it will tells you that ""your models have changes that are not yet reflected in a migration"" and after running ""makemigrations"" you will get the same migrations every time. So, you never get to a state valid for Django Migration System.

I'm attaching a project with all the steps already done, from where you just simply can run ""migrate"" and ""makemigrations"" many times to see what I described here."	Bug	closed	Migrations	1.7-rc-2	Release blocker	duplicate		Manuel Kaufmann Areski Belaid	Accepted	0	0	0	0	0	0
