20 lines
672 B
Python
20 lines
672 B
Python
from sqlalchemy import Column, Integer, String, Text, ForeignKey
|
|
from sqlalchemy.orm import relationship
|
|
from geoalchemy2 import Geometry
|
|
from app.models.base import Base
|
|
|
|
class Camp(Base):
|
|
__tablename__ = "camps"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
route_id = Column(Integer, ForeignKey("routes.id", ondelete="CASCADE"))
|
|
name = Column(String(50), nullable=False)
|
|
elevation_m = Column(Integer)
|
|
# PostGIS Point
|
|
location = Column(Geometry("POINT", srid=4326))
|
|
camp_type = Column(String(20)) # BaseCamp, Camp, Summit
|
|
description = Column(Text)
|
|
|
|
# Relationships
|
|
route = relationship("Route", back_populates="camps")
|