Add POI and POIDistance data models with migration
Introduces PointOfInterest (per-user named locations with lat/lng) and POIDistance (travel time/distance per listing+POI+mode triple) SQLModel entities, plus an Alembic migration to create both tables with indexes and a composite unique constraint.
This commit is contained in:
parent
9ff381106b
commit
5783d8fae9
3 changed files with 106 additions and 0 deletions
13
models/poi.py
Normal file
13
models/poi.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
from datetime import datetime
|
||||
|
||||
from sqlmodel import SQLModel, Field
|
||||
|
||||
|
||||
class PointOfInterest(SQLModel, table=True):
|
||||
id: int | None = Field(default=None, primary_key=True)
|
||||
user_id: int = Field(foreign_key="user.id", index=True)
|
||||
name: str = Field(nullable=False)
|
||||
address: str = Field(nullable=False)
|
||||
latitude: float = Field(nullable=False)
|
||||
longitude: float = Field(nullable=False)
|
||||
created_at: datetime = Field(default_factory=datetime.utcnow)
|
||||
Loading…
Add table
Add a link
Reference in a new issue