Hi,

I'm looking into the details of migrations a little, and I ran into this 
issue.

I have two migrations: The first creates a model, the second adds another 
model and a field to the first model. I'd expect squashmigrations to patch the 
AddField into the first CreateModel, but it finds "No optimizations possible". 
What am I missing?

Thanks,
        Shai.

===============
0001_initial.py
===============

# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Knight',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False,
                                        auto_created=True, primary_key=True)),
                ('name', models.CharField(max_length=100)),
                ('of_the_round_table', models.BooleanField(default=None)),
            ],
            options={
            },
            bases=(models.Model,),
        ),
    ]

==========================
0002_auto_20140920_1610.py
==========================

# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations
from django.conf import settings


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('tut', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Quest',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False,
                                        auto_created=True, primary_key=True)),
                ('name', models.CharField(max_length=100)),
                ('knights', models.ManyToManyField(to='tut.Knight')),
            ],
            options={
            },
            bases=(models.Model,),
        ),
        migrations.AddField(
            model_name='knight',
            name='owner',
            field=models.ForeignKey(to=settings.AUTH_USER_MODEL, null=True),
            preserve_default=True,
        ),
    ]

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/201409212059.47031.shai%40platonix.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to