feat(weibo): 支持管理员强制转入工作台且不影响原使用人
This commit is contained in:
+10
-1
@@ -8,6 +8,7 @@ from sqlalchemy import (
|
||||
JSON,
|
||||
BigInteger,
|
||||
Boolean,
|
||||
CheckConstraint,
|
||||
Computed,
|
||||
ForeignKey,
|
||||
Index,
|
||||
@@ -989,6 +990,9 @@ class WeiboWorkbenchAccount(Base):
|
||||
nullable=False,
|
||||
index=True,
|
||||
)
|
||||
# 普通用户固定为 1;超级管理员的并行工作台映射为 NULL。
|
||||
# MySQL 唯一索引允许多个 NULL,因此管理员附加映射不会挤掉原使用人。
|
||||
exclusive_slot: Mapped[int | None] = mapped_column(Integer, nullable=True)
|
||||
created_at: Mapped[datetime] = mapped_column(UTCDateTime, default=_utcnow)
|
||||
|
||||
__table_args__ = (
|
||||
@@ -999,7 +1003,12 @@ class WeiboWorkbenchAccount(Base):
|
||||
),
|
||||
UniqueConstraint(
|
||||
"account_id",
|
||||
name="uq_weibo_workbench_account_owner",
|
||||
"exclusive_slot",
|
||||
name="uq_weibo_workbench_account_exclusive",
|
||||
),
|
||||
CheckConstraint(
|
||||
"exclusive_slot IS NULL OR exclusive_slot = 1",
|
||||
name="ck_weibo_workbench_exclusive_slot",
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user