feat: add user_tenant associations
This commit is contained in:
@@ -20,3 +20,23 @@ field_type:
|
||||
role: types.Array[consts.TenantUserRole]
|
||||
status: consts.UserStatus
|
||||
field_relate:
|
||||
users:
|
||||
OwnedTenant:
|
||||
relation: belongs_to
|
||||
table: tenants
|
||||
json: owned
|
||||
Tenants:
|
||||
json: tenants
|
||||
relation: many_to_many
|
||||
table: tenants
|
||||
pivot: tenant_users
|
||||
# foreign_key: user_id # 当前表(users)用于关联的键(转为结构体字段名 user_id)
|
||||
join_foreign_key: user_id # 中间表中指向当前表的列(tenant_users.user_id)
|
||||
# references: id # 关联表(tenants)被引用的列(转为结构体字段名 ID)
|
||||
join_references: tenant_id # 中间表中指向关联表的列(tenant_users.tenant_id)
|
||||
tenants:
|
||||
Users:
|
||||
relation: many_to_many
|
||||
table: users
|
||||
pivot: tenant_users
|
||||
json: users
|
||||
|
||||
Reference in New Issue
Block a user