修复冻结积分BUG | 拆镜状态异常BUG

This commit is contained in:
2026-07-24 14:00:37 +08:00
parent 357657d7cd
commit 4685b475af
22 changed files with 2159 additions and 733 deletions
+8 -1
View File
@@ -1,4 +1,4 @@
from sqlalchemy import ForeignKey, Index, Integer, String
from sqlalchemy import ForeignKey, Index, Integer, String, text
from sqlalchemy.orm import Mapped, mapped_column
from app.models.base import Base, TimestampMixin
@@ -9,6 +9,13 @@ class TokenUsage(Base, TimestampMixin):
__table_args__ = (
Index("ix_token_usage_owner", "owner_type", "owner_id"),
Index("ix_token_usage_biz_key", "biz_key"),
Index(
"uq_token_usage_user_biz_key",
"user_id",
"biz_key",
unique=True,
postgresql_where=text("biz_key IS NOT NULL"),
),
)
id: Mapped[str] = mapped_column(String(32), primary_key=True)