mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
Fixed #35075 -- Added deduplicate_items parameter to BTreeIndex.
This commit is contained in:
committed by
Mariusz Felisiak
parent
f412add786
commit
45f778eded
@@ -117,20 +117,27 @@ class BrinIndex(PostgresIndex):
|
||||
class BTreeIndex(PostgresIndex):
|
||||
suffix = "btree"
|
||||
|
||||
def __init__(self, *expressions, fillfactor=None, **kwargs):
|
||||
def __init__(self, *expressions, fillfactor=None, deduplicate_items=None, **kwargs):
|
||||
self.fillfactor = fillfactor
|
||||
self.deduplicate_items = deduplicate_items
|
||||
super().__init__(*expressions, **kwargs)
|
||||
|
||||
def deconstruct(self):
|
||||
path, args, kwargs = super().deconstruct()
|
||||
if self.fillfactor is not None:
|
||||
kwargs["fillfactor"] = self.fillfactor
|
||||
if self.deduplicate_items is not None:
|
||||
kwargs["deduplicate_items"] = self.deduplicate_items
|
||||
return path, args, kwargs
|
||||
|
||||
def get_with_params(self):
|
||||
with_params = []
|
||||
if self.fillfactor is not None:
|
||||
with_params.append("fillfactor = %d" % self.fillfactor)
|
||||
if self.deduplicate_items is not None:
|
||||
with_params.append(
|
||||
"deduplicate_items = %s" % ("on" if self.deduplicate_items else "off")
|
||||
)
|
||||
return with_params
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user