#25317: Altering a field to ForeignKey does not create index
-------------------------------+--------------------
Reporter: synotna | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
Changing a OneToOneField to a ForeignKey does not trigger an index to be
created by the migration
{{{
migrations.AlterField(
model_name='contracttwitchchannelrevenueadsbycountry',
name='revenue_data',
field=models.ForeignKey(to='twitchrevenue.TwitchRevenueDataAdsByCountry'),
preserve_default=True,
),
}}}
SQL for the migration:
{{{
./manage.py sqlmigrate partners 0021
BEGIN;
ALTER TABLE "partners_contracttwitchchannelrevenueadsbycountry" DROP
CONSTRAINT "a45496b32304e658c2a94795584a1889";
ALTER TABLE "partners_contracttwitchchannelrevenueadsbycountry" ADD
CONSTRAINT "D321aaa5509069df3ee6b51c0eb97103" FOREIGN KEY
("revenue_data_id") REFERENCES
"twitchrevenue_twitchrevenuedataadsbycountry" ("id") DEFERRABLE INITIALLY
DEFERRED;
COMMIT;
}}}
Also, explicitly stating db_index=True does not cause a new migration to
be created
--
Ticket URL: <https://code.djangoproject.com/ticket/25317>
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/050.d98cc528731200efc8b4d4501da6c5b1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.