Skip to content

Missing migration for ⁠SpecifyUser.spprincipals field alteration #8236

Description

@grantfitzsimmons

In main (7a06d41), there are changes in the specify app that are not currently reflected in a migration, leading to this warning in the logs:

Running migrations:
  No migrations to apply.
  Your models in app(s): 'specify' 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.

When running manage.py makemigrations specify, Django sees a discrepancy in how the spprincipals many-to-many field is configured on the SpecifyUser model and generates the following migration:

# Generated by Django 4.2.30 on 2026-06-29 21:20

from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('specify', '0044_alter_deletion_cascade'),
    ]

    operations = [
        migrations.AlterField(
            model_name='specifyuser',
            name='spprincipals',
            field=models.ManyToManyField(related_name='specifyusers', through='specify.Specifyuser_spprincipal', to='specify.spprincipal'),
        ),
    ]

Recent updates to cascade behaviors or dependency paths in the codebase altered the metadata configuration of the spprincipals relationship on the SpecifyUser model. Specifically, the relationship metadata now explicitly expects related_name='specifyusers' to point back from the SPPrincipal model to the intermediate Specifyuser_spprincipal table.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions