22 行
854 B
Python
22 行
854 B
Python
from __future__ import annotations
|
|
from sqlalchemy import Column, Integer, String, Text, Boolean, DateTime, JSON, UniqueConstraint
|
|
from sqlalchemy.sql import func
|
|
|
|
from app.database import Base
|
|
|
|
|
|
class CalendarMonth(Base):
|
|
__tablename__ = "calendar_months"
|
|
__table_args__ = (UniqueConstraint("year", "month", name="uq_calendar_year_month"),)
|
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
year = Column(Integer, nullable=False)
|
|
month = Column(Integer, nullable=False) # 1-12
|
|
title = Column(String(100))
|
|
description = Column(Text)
|
|
weather = Column(String(200))
|
|
highlights = Column(JSON) # list of strings
|
|
events = Column(JSON) # list of {date, title, description}
|
|
is_available = Column(Boolean, default=True)
|
|
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now())
|