22 lines
953 B
Python
22 lines
953 B
Python
from datetime import datetime
|
|
|
|
from sqlalchemy import DateTime, Integer, String, Text, UniqueConstraint, func
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.database import Base
|
|
|
|
|
|
class DesktopConfig(Base):
|
|
__tablename__ = "desktop_configs"
|
|
__table_args__ = (
|
|
UniqueConstraint("name", "oem_id", name="uq_desktop_configs_name_oem_id"),
|
|
)
|
|
|
|
id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)
|
|
name: Mapped[str] = mapped_column(String(64), index=True)
|
|
value: Mapped[str] = mapped_column(Text)
|
|
mark: Mapped[str | None] = mapped_column(String(255), nullable=True, default=None)
|
|
oem_id: Mapped[int] = mapped_column(Integer, default=1, server_default="1", index=True)
|
|
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
|
|
updated_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now(), onupdate=func.now())
|