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?