修复冻结积分BUG | 拆镜状态异常BUG
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user