初步迁移数据库
This commit is contained in:
@@ -1,22 +1,23 @@
|
||||
# model/setting.py
|
||||
from typing import TYPE_CHECKING, Optional
|
||||
from sqlmodel import Field, SQLModel
|
||||
from .base import BaseModel
|
||||
from sqlmodel import Field
|
||||
from .base import TableBase
|
||||
|
||||
"""
|
||||
原建表语句:
|
||||
|
||||
原表:
|
||||
CREATE TABLE IF NOT EXISTS fr_settings (
|
||||
type TEXT,
|
||||
name TEXT PRIMARY KEY,
|
||||
value TEXT
|
||||
)
|
||||
"""
|
||||
|
||||
if TYPE_CHECKING:
|
||||
pass
|
||||
|
||||
class Setting(SQLModel, BaseModel, table=True):
|
||||
class Setting(TableBase, table=True):
|
||||
__tablename__ = 'fr_settings'
|
||||
|
||||
type: str = Field(index=True, nullable=False, description="设置类型")
|
||||
name: str = Field(index=True, primary_key=True, nullable=False, description="设置名称")
|
||||
value: Optional[str] = Field(description="设置值")
|
||||
name: str = Field(primary_key=True, nullable=False, description="设置名称") # name 为唯一主键
|
||||
value: Optional[str] = Field(description="设置值")
|
||||
|
||||
Reference in New Issue
Block a user