Skip to content

Commit 502fb09

Browse files
committed
chore: update index class type hint and docs
1 parent 0801880 commit 502fb09

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

docs/classes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ Indexes are stored in the `indexes` attribute of a `Table` object.
158158
* **table** (`Table`) — link to table, for which this index is defined.
159159
* **name** (str) — index name, if defined.
160160
* **unique** (bool) — indicates whether the index is unique.
161-
* **type** (str) — index type, if defined. Can be either `hash` or `btree`.
161+
* **type** (str) — index type, if defined. Accepted values: `brin`, `btree`, `gin`, `gist`, `hash`, `spgist`.
162162
* **pk** (bool) — indicates whether this a primary key index.
163163
* **note** (note) — index note, if defined.
164164
* **comment** (str) — comment, if it was added just before index definition.

pydbml/_classes/index.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,17 @@ def __init__(self,
2222
subjects: List[Union[str, Column, Expression]],
2323
name: Optional[str] = None,
2424
unique: bool = False,
25-
type: Optional[Literal['hash', 'btree']] = None,
25+
type: Optional[
26+
Literal[
27+
# https://www.postgresql.org/docs/current/indexes-types.html
28+
"brin",
29+
"btree",
30+
"gin",
31+
"gist",
32+
"hash",
33+
"spgist",
34+
]
35+
] = None,
2636
pk: bool = False,
2737
note: Optional[Union[Note, str]] = None,
2838
comment: Optional[str] = None):

0 commit comments

Comments
 (0)