refactor(schema): 重构数据库模型和 schema,清理废弃表

This commit is contained in:
qzl
2026-04-07 18:43:34 +08:00
parent a65d041436
commit b18a205bf3
19 changed files with 101 additions and 426 deletions
+2
View File
@@ -3,6 +3,7 @@ from __future__ import annotations
from .agent_chat_message import AgentChatMessage
from .agent_chat_session import AgentChatSession
from .auth_user import AuthUser
from .invite_code import InviteCode
from .llm import Llm
from .llm_factory import LlmFactory
from .points_ledger import PointsLedger
@@ -14,6 +15,7 @@ __all__ = [
"AgentChatMessage",
"AgentChatSession",
"AuthUser",
"InviteCode",
"Llm",
"LlmFactory",
"PointsLedger",
+1 -3
View File
@@ -21,6 +21,4 @@ class Llm(TimestampMixin, SoftDeleteMixin, Base):
nullable=False,
index=True,
)
model_code: Mapped[str] = mapped_column(
String(50), nullable=False, unique=True, index=True
)
model_code: Mapped[str] = mapped_column(String(50), nullable=False, unique=True)
+1 -3
View File
@@ -15,8 +15,6 @@ class LlmFactory(TimestampMixin, SoftDeleteMixin, Base):
id: Mapped[uuid.UUID] = mapped_column(
UUID(as_uuid=True), primary_key=True, default=uuid.uuid4
)
name: Mapped[str] = mapped_column(
String(50), nullable=False, unique=True, index=True
)
name: Mapped[str] = mapped_column(String(50), nullable=False, unique=True)
request_url: Mapped[str] = mapped_column(String(255), nullable=False)
avatar: Mapped[str | None] = mapped_column(Text, nullable=True)
+5
View File
@@ -34,3 +34,8 @@ class Profile(TimestampMixin, SoftDeleteMixin, Base):
server_default=text("'{}'::jsonb"),
default=dict,
)
referred_by: Mapped[uuid.UUID | None] = mapped_column(
UUID(as_uuid=True),
ForeignKey("profiles.id", ondelete="SET NULL"),
nullable=True,
)