Friday, December 28, 2018

db_index=True not working, and indexes in class Meta yes

I have a model like this (simplified code):

class Agreement(modes.Model):
    job
= models.ForeignKey(...)
   
class Meta:
         indexes
= (                        
             models
.Index(fields=['job']),
       
)

And when run migrations, the index is created.
BUT, after doing this:

class Agreement(modes.Model):
    job
= models.ForeignKey(..., db_index=True)

And running makemigrations, I have this on my console output:

- Remove index agreements__job_id_eb7df0_idx from agreement

Why db_index, is not working like it is supposed to work? 


--
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/84ada8ad-70f2-43bb-bbbc-c12750a58c3e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment