Coverage for src/couchers/models/static.py: 100%
17 statements
« prev ^ index » next coverage.py v7.11.0, created at 2025-11-08 00:20 +0000
« prev ^ index » next coverage.py v7.11.0, created at 2025-11-08 00:20 +0000
1from geoalchemy2 import Geometry
2from sqlalchemy import BigInteger, Column, Index, String
4from couchers.models.base import Base
7class Language(Base):
8 """
9 Table of allowed languages (a subset of ISO639-3)
10 """
12 __tablename__ = "languages"
14 # ISO639-3 language code, in lowercase, e.g. fin, eng
15 code = Column(String(3), primary_key=True)
17 # the english name
18 name = Column(String, nullable=False, unique=True)
21class TimezoneArea(Base):
22 __tablename__ = "timezone_areas"
23 id = Column(BigInteger, primary_key=True)
25 tzid = Column(String)
26 geom = Column(Geometry(geometry_type="MULTIPOLYGON", srid=4326), nullable=False)
28 __table_args__ = (
29 Index(
30 "ix_timezone_areas_geom_tzid",
31 geom,
32 tzid,
33 postgresql_using="gist",
34 ),
35 )
38class Region(Base):
39 """
40 Table of regions
41 """
43 __tablename__ = "regions"
45 # iso 3166-1 alpha3 code in uppercase, e.g. FIN, USA
46 code = Column(String(3), primary_key=True)
48 # the name, e.g. Finland, United States
49 # this is the display name in English, should be the "common name", not "Republic of Finland"
50 name = Column(String, nullable=False, unique=True)