mirror of
https://github.com/davidhalter/django-stubs.git
synced 2026-03-04 22:31:26 +08:00
Adjust Postgres indexes for Django 3.2 (#616)
This commit is contained in:
18
tests/typecheck/contrib/postgres/test_indexes.yml
Normal file
18
tests/typecheck/contrib/postgres/test_indexes.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
- case: can_instantiate_index
|
||||
main: |
|
||||
from django.db import models
|
||||
from django.db.models.functions import Lower
|
||||
from django.contrib.postgres.indexes import {{ index }}
|
||||
{{ index }}(fields=["foo"])
|
||||
{{ index }}(models.F("bar"), name="test")
|
||||
{{ index }}("foo", models.F("bar"), Lower("baz"), name="test")
|
||||
{{ index }}("foo", name="test", opclasses=["bar"])
|
||||
{{ index }}("foo", name="test", condition=models.Q(foo=1))
|
||||
{{ index }}("foo", name="test", include=["bar"])
|
||||
parametrized:
|
||||
- index: BrinIndex
|
||||
- index: BTreeIndex
|
||||
- index: GinIndex
|
||||
- index: GistIndex
|
||||
- index: HashIndex
|
||||
- index: SpGistIndex
|
||||
@@ -3,6 +3,7 @@
|
||||
from django.db import models
|
||||
from django.db.models.functions import Lower
|
||||
models.Index(fields=["foo"])
|
||||
models.Index(models.F("bar"), name="test")
|
||||
models.Index("foo", models.F("bar"), Lower("baz"), name="test")
|
||||
models.Index("foo", name="test", opclasses=["bar"])
|
||||
models.Index("foo", name="test", condition=models.Q(foo=1))
|
||||
|
||||
Reference in New Issue
Block a user