38 lines
1.6 KiB
Python
38 lines
1.6 KiB
Python
"""星座码表:12 星座的展示信息与日期区间。
|
||
|
||
黄经 0° 起算顺序就是 sort_order 的顺序(白羊=0 … 双鱼=11),
|
||
星盘算出来的黄经按 ``int(lon // 30)`` 直接对到这张表,所以
|
||
**顺序不能乱改**;名字、符号、元素、起止日期、释义都可以在管理端改。
|
||
"""
|
||
|
||
from __future__ import annotations
|
||
|
||
from datetime import datetime
|
||
|
||
from sqlalchemy import Boolean, DateTime, Integer, String, Text, func
|
||
from sqlalchemy.orm import Mapped, mapped_column
|
||
|
||
from app.db.session import Base
|
||
|
||
|
||
class ZodiacSign(Base):
|
||
__tablename__ = "zodiac_signs"
|
||
|
||
code: Mapped[str] = mapped_column(String(16), primary_key=True) # aries / taurus ...
|
||
name_cn: Mapped[str] = mapped_column(String(16))
|
||
name_en: Mapped[str] = mapped_column(String(32), default="")
|
||
symbol: Mapped[str] = mapped_column(String(8), default="") # ♈
|
||
element: Mapped[str] = mapped_column(String(8), default="") # 火 / 土 / 风 / 水
|
||
start_month: Mapped[int] = mapped_column(Integer, default=1)
|
||
start_day: Mapped[int] = mapped_column(Integer, default=1)
|
||
end_month: Mapped[int] = mapped_column(Integer, default=1)
|
||
end_day: Mapped[int] = mapped_column(Integer, default=1)
|
||
intro: Mapped[str] = mapped_column(Text, default="")
|
||
|
||
sort_order: Mapped[int] = mapped_column(Integer, default=0) # = 黄经序号,0..11
|
||
enabled: Mapped[bool] = mapped_column(Boolean, default=True)
|
||
|
||
updated_at: Mapped[datetime] = mapped_column(
|
||
DateTime(timezone=True), server_default=func.now(), onupdate=func.now()
|
||
)
|