#34926 closed Bug (invalid)

Missing model after squashing

Reported by: Sebastian Jekutsch Owned by: nobody
Component: Migrations Version: 4.2
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Sebastian Jekutsch)

Sorry for an unspecific subject and not searching for duplicates due to lack of knowledge, understanding and time.

As an excerpt from #34924 which has been correctly closed as duplicate for two of its issues, the third one remains unresolved, as far as I see. I reopen it with this new report.

Based on the attachments

  1. Zip of single migrations 0001 to 0116
  2. Resulting squashed migration file of "manage.py squashmigrations knowledgebase 0116"
  3. models.py at the end of 0116

within #34924,
I found that model Activity has errorneously disappeared completely in the squashed migration file. It has even not been detected by a new makemigrations run for cross-check.

Change History (5)

comment:1 by Sebastian Jekutsch, 14 months ago

Description: modified (diff)

comment:2 by Mariusz Felisiak, 14 months ago

Resolution: invalid
Status: newclosed

Activity is in the squashed migration.

comment:3 by Sebastian Jekutsch, 14 months ago

Resolution: invalid
Status: closednew

Right, but it's below its first reference in model Topic within the script, so an initial database migration will raise an "ValueError: Related model 'knowledgebase.activity' cannot be resolved".
(Apologize for not stating the problem more specific.)

in reply to:  3 comment:4 by Mariusz Felisiak, 14 months ago

Replying to Sebastian Jekutsch:

Right, but it's below its first reference in model Topic within the script, so an initial database migration will raise an "ValueError: Related model 'knowledgebase.activity' cannot be resolved".
(Apologize for not stating the problem more specific.)

That is also not true:

        migrations.CreateModel(
            name="Activity",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(max_length=50)),
                (
                    "members",
                    models.ManyToManyField(
                        blank=True,
                        related_name="memberships",
                        to="knowledgebase.activity",
                    ),
                ),
                ("alternative_names", models.CharField(blank=True, max_length=250)),
            ],
            options={
                "verbose_name": "Activity",
                "verbose_name_plural": "Activities",
                "ordering": [django.db.models.functions.text.Lower("name")],
            },
        ),
        migrations.AddField(
            model_name="topic",
            name="activities",
            field=models.ManyToManyField(
                blank=True, related_name="activities", to="knowledgebase.activity"
            ),
        ),

Please see TicketClosingReasons/UseSupportChannels for ways to get help and don't use Trac as a support channel.

comment:5 by Sebastian Jekutsch, 14 months ago

Resolution: invalid
Status: newclosed

Ok, seems I have differences locally.

Note: See TracTickets for help on using tickets.
Back to Top