优化数据库模型与关系
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# my_project/models/source_link.py
|
||||
|
||||
from typing import TYPE_CHECKING, Optional
|
||||
from sqlmodel import Field, Relationship, Column, func, DateTime
|
||||
from sqlmodel import Field, Relationship, Index
|
||||
from .base import TableBase
|
||||
from datetime import datetime
|
||||
|
||||
@@ -10,6 +10,9 @@ if TYPE_CHECKING:
|
||||
|
||||
class SourceLink(TableBase, table=True):
|
||||
__tablename__ = 'source_links'
|
||||
__table_args__ = (
|
||||
Index("ix_sourcelink_file_name", "file_id", "name"),
|
||||
)
|
||||
|
||||
name: str = Field(max_length=255, description="链接名称")
|
||||
downloads: int = Field(default=0, sa_column_kwargs={"server_default": "0"}, description="通过此链接的下载次数")
|
||||
|
||||
Reference in New Issue
Block a user