auto id length in bi ref: workspace
This commit is contained in:
+15
-4
@@ -1,7 +1,11 @@
|
||||
from typing import TYPE_CHECKING
|
||||
from sqlalchemy import Column, DateTime, String, ForeignKey, BigInteger, UniqueConstraint
|
||||
from sqlalchemy.sql import func
|
||||
from .base import AutoID, Base
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .user import User
|
||||
|
||||
class Workspace(Base, AutoID):
|
||||
"""工作区表"""
|
||||
__tablename__ = "workspaces"
|
||||
@@ -24,11 +28,18 @@ class WorkspaceMember(Base, AutoID):
|
||||
"""工作区成员及权限表"""
|
||||
__tablename__ = "workspace_members"
|
||||
|
||||
workspace_id = Column(String(32), ForeignKey("workspaces.id", ondelete="CASCADE"), index=True)
|
||||
user_id = Column(String(32), ForeignKey("users.id", ondelete="CASCADE"), index=True)
|
||||
|
||||
workspace_id = Column(
|
||||
String(Workspace.id_length()),
|
||||
ForeignKey("workspaces.id", ondelete="CASCADE"),
|
||||
index=True,
|
||||
)
|
||||
# 允许 user_id 为空,因为被邀请的人可能还没注册系统,我们先记录他的邮箱
|
||||
user_id = Column(String(32), ForeignKey("users.id", ondelete="CASCADE"), nullable=True, index=True)
|
||||
user_id = Column(
|
||||
String(User.id_length()),
|
||||
ForeignKey("users.id", ondelete="CASCADE"),
|
||||
nullable=True,
|
||||
index=True,
|
||||
)
|
||||
invite_email = Column(String, nullable=True) # 收到邀请的邮箱
|
||||
|
||||
# 状态:'pending' (等待加入), 'active' (已加入), 'disabled' (已禁用)
|
||||
|
||||
Reference in New Issue
Block a user