Hi,
I have created a particular model in django that looks like this:
Class Document(models.Model):
doc_id = models.AutoField(primary_key=True)
doc_name = models.CharField(max_length=255, help_text=_('The name of
the document'),
verbose_name=_('doc_name'))
created_on = models.DateTimeField(verbose_name=_('Added'),
auto_now_add=True)
created_by = models.ForeignKey(User, verbose_name=_('Created by'),
related_name='documents',
db_column='created_by', db_index=False)
updated_on = models.DateTimeField(verbose_name=_('Updated'),
auto_now_add=True)
updated_by = models.ForeignKey(User, verbose_name=_('Updated by'),
db_column='updated_by', db_index=False)
Columns 'created_by' and 'updated_by' are foreign keys to the 'User' table.
Django automatically creates indexes for any foreign key to the table.
However, I do not want the indexes on both these columns. I tried doing
'db_index=False' for both these columns.
After migration, when I did this in mysql: "show index from document"
the indexes on 'created_by' and 'updated_by' are still there.
Could anyone please tell me how to remove indexes from foreign keys? What
is wrong in this approach?
--
You received this message because you are subscribed to the Google Groups
"Django users" 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].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/0cd594b7-a061-4935-beea-e87e934a2604%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.