refactor(schema): 重构数据库模型和 schema,清理废弃表
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user