import peter
This commit is contained in:
25
database/tnews/model.py
Normal file
25
database/tnews/model.py
Normal file
@ -0,0 +1,25 @@
|
||||
from dataclasses import dataclass
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
|
||||
from sqlalchemy import Column, String, Boolean, DateTime, BigInteger, text, INT
|
||||
from database.database import Base
|
||||
|
||||
@dataclass
|
||||
class TNews(Base):
|
||||
__tablename__ = 't_news'
|
||||
|
||||
id: int = Column(BigInteger, primary_key=True, autoincrement=True, comment='编号')
|
||||
title: Optional[str] = Column(String, nullable=True, comment='标题')
|
||||
summary: Optional[str] = Column(String, nullable=True, comment='摘要')
|
||||
url: Optional[str] = Column(String, nullable=True, comment='链接')
|
||||
content: Optional[str] = Column(String, nullable=True, comment='内容/正文')
|
||||
occurrence_date: Optional[datetime] = Column(DateTime(timezone=True), nullable=True, comment='发布日期')
|
||||
source: Optional[str] = Column(String, nullable=True, comment='来源')
|
||||
primary_category: str = Column(String, nullable=True, comment='一级类别')
|
||||
secondary_category: str = Column(String, nullable=True, comment='二级类别')
|
||||
tertiary_category: str = Column(String, nullable=True, comment='三级类别')
|
||||
label: str = Column(String, nullable=True, comment='标签')
|
||||
lang: str = Column(String, nullable=False, default='zh', comment='语言')
|
||||
is_usage: bool = Column(Boolean, nullable=False, default=False, server_default=text('false'), comment='是否已用')
|
||||
create_time: datetime = Column(DateTime(timezone=True), nullable=False, server_default=text('now()'), comment='创建日期')
|
||||
Reference in New Issue
Block a user