Skip to content

simple-history 2.6.0 generates a migration while 2.5.1 doesn't #512

Closed
@atodorov

Description

@atodorov

Describe the bug
Kiwi TCMS uses simple-history as dependency. Until recently we had version 2.5.1 and we've upgraded to 2.6.0. The problem is that with 2.5.1 ./manage.py migrate/makemigrations doesn't detect any new changes but with 2.6.0 it does.

Here's how the initial migration looks like:

from django.db import migrations, models

        migrations.AddField(
            model_name='testplan',
            name='parent',
            field=models.ForeignKey(blank=True, null=True, on_delete=models.deletion.CASCADE,
                                    related_name='child_set', to='testplans.TestPlan'),
        ),

        migrations.CreateModel(
            name='HistoricalTestPlan',
            fields=[
                ('parent', models.ForeignKey(blank=True, db_constraint=False, null=True,
                                             on_delete=models.deletion.DO_NOTHING, related_name='+',
                                             to='testplans.TestPlan')),
            ]
        )

Here's what makemigrations produces with 2.6.0:

import django.db.models.deletion

        migrations.AlterField(
            model_name='historicaltestplan',
            name='parent',
            field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='testplans.HistoricalTestPlan'),
        ),

The only difference I see is how we reference the on_delete constraint.

To Reproduce
Steps to reproduce the behavior:

  1. git clone https://github.com/kiwitcms/Kiwi/
  2. pip install -r requirements/devel.txt
  3. ./manage.py migrate
  4. ./manage.py makemigrations <--- produces a new migration

Repeat the above with 2.5.1 instead and the last step tells you there are no changes detected

Environment (please complete the following information):

  • OS: Linux, RHEL 7
  • Django Simple History Version: 2.5.1 and 2.6
  • Django Version: 2.1.5
  • Database Version: SQLite

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedIssue accepted for completionbugIssues related to confirmed bugs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions