#27297: Non-deterministic infinite AlterField migrations created for foreign key
--------------------------------+------------------------------------
Reporter: Daniel Musketa | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------
Comment (by Daniel Musketa):
Replying to [comment:3 Baptiste Mispelon]:
> Is it possible you changed the name of `Model1` in the same way?
Yes, you’re absolutely right. In the actual project there was first
{{{class adress(models.Model)}}} (sic!), then
{{{class address(models.Model)}}} and then finally
{{{class Address(models.Model)}}}.
In the migration files it looks like this:
{{{
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='adress',
fields=[
('id', models.AutoField(auto_created=True,
primary_key=True, serialize=False, verbose_name='ID')),
],
),
]
}}}
and then
{{{
class Migration(migrations.Migration):
dependencies = [
('app1', '0001_initial'),
]
operations = [
migrations.RenameModel(
old_name='adress',
new_name='address',
),
]
}}}
But then no new change is detected. I tested a rename from {{{adress}}} to
{{{Address}}} which results in a capitalized {{{new_name='Address',}}} and
everything should be fine.
So, the actual problem might be the rename from a lowercase to capfirst
model name. This is not detected by makemigrations which seems to compare
everything {{{.lower()}}}’d.
This doesn’t explain though why changes are detected in only some of my
for loop {{{makemigrations}}} runs. ;-)
Propably related to #22608?
--
Ticket URL: <https://code.djangoproject.com/ticket/27297#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" 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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/061.c6ba9538fcf1ec155913ae5f88f07c34%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.