mirror of
https://github.com/fastapi/sqlmodel.git
synced 2025-11-02 04:06:49 +08:00
✨ Document indexes and make them opt-in (#205)
This commit is contained in:
committed by
GitHub
parent
3d7b74746c
commit
155c6178cd
@ -18,7 +18,7 @@ class HeroTeamLink(SQLModel, table=True):
|
||||
|
||||
class Team(SQLModel, table=True):
|
||||
id: Optional[int] = Field(default=None, primary_key=True)
|
||||
name: str
|
||||
name: str = Field(index=True)
|
||||
headquarters: str
|
||||
|
||||
hero_links: List[HeroTeamLink] = Relationship(back_populates="team")
|
||||
@ -26,9 +26,9 @@ class Team(SQLModel, table=True):
|
||||
|
||||
class Hero(SQLModel, table=True):
|
||||
id: Optional[int] = Field(default=None, primary_key=True)
|
||||
name: str
|
||||
name: str = Field(index=True)
|
||||
secret_name: str
|
||||
age: Optional[int] = None
|
||||
age: Optional[int] = Field(default=None, index=True)
|
||||
|
||||
team_links: List[HeroTeamLink] = Relationship(back_populates="hero")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user