Coverage for src/couchers/models/static.py: 100%
18 statements
« prev ^ index » next coverage.py v7.11.0, created at 2025-12-25 10:58 +0000
« prev ^ index » next coverage.py v7.11.0, created at 2025-12-25 10:58 +0000
1from geoalchemy2 import Geometry
2from sqlalchemy import BigInteger, Index, String
3from sqlalchemy.orm import Mapped, mapped_column
5from couchers.models.base import Base, Geom
8class Language(Base):
9 """
10 Table of allowed languages (a subset of ISO639-3)
11 """
13 __tablename__ = "languages"
15 # ISO639-3 language code, in lowercase, e.g. fin, eng
16 code: Mapped[str] = mapped_column(String(3), primary_key=True)
18 # the english name
19 name: Mapped[str] = mapped_column(String, unique=True)
22class TimezoneArea(Base):
23 __tablename__ = "timezone_areas"
25 id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
26 tzid: Mapped[str | None] = mapped_column(String)
27 geom: Mapped[Geom] = mapped_column(Geometry(geometry_type="MULTIPOLYGON", srid=4326))
29 __table_args__ = (
30 Index(
31 "ix_timezone_areas_geom_tzid",
32 geom,
33 tzid,
34 postgresql_using="gist",
35 ),
36 )
39class Region(Base):
40 """
41 Table of regions
42 """
44 __tablename__ = "regions"
46 # iso 3166-1 alpha3 code in uppercase, e.g. FIN, USA
47 code: Mapped[str] = mapped_column(String(3), primary_key=True)
49 # the name, e.g. Finland, United States
50 # this is the display name in English, should be the "common name", not "Republic of Finland"
51 name: Mapped[str] = mapped_column(String, unique=True)