You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since Django 1.11 (current version 3.0), there's a new way of adding indexes to django tables, Meta.indexes (https://docs.djangoproject.com/en/3.0/ref/models/options/#django.db.models.Options.indexes). This package doesn't work with these, it only works with db_index on fields themselves and the Meta.index_together option (which currently has a warning in the docs that Meta.indexes should be used instead).
The text was updated successfully, but these errors were encountered:
from django.db import models
from postgres_copy import CopyManager
class Customer(models.Model):
first_name = models.CharField(max_length=100, db_index=True)
last_name = models.CharField(max_length=100, db_index=True)
objects = CopyManager()
class Meta:
indexes = [
models.Index(fields=['last_name', 'first_name']),
]
The indexes regularly look like this (for the two fields there's two indexes, one is for exact and one for %like% (I believe, doesn't really matter I guess).
If you run Customer.objects.drop_indexes() then the first_name/last_name indexes get dropped and the joined one remains:
Since Django 1.11 (current version 3.0), there's a new way of adding indexes to django tables, Meta.indexes (https://docs.djangoproject.com/en/3.0/ref/models/options/#django.db.models.Options.indexes). This package doesn't work with these, it only works with db_index on fields themselves and the Meta.index_together option (which currently has a warning in the docs that Meta.indexes should be used instead).
The text was updated successfully, but these errors were encountered: