tenant: add member management APIs

This commit is contained in:
2025-12-18 17:29:17 +08:00
parent 5029234e47
commit de574bbd9d
11 changed files with 815 additions and 14 deletions

View File

@@ -0,0 +1,19 @@
-- +goose Up
-- +goose StatementBegin
-- tenant_users.status历史上默认值为 'active',但代码枚举使用 UserStatuspending_verify/verified/banned
-- 为避免新增成员落入未知状态,这里将默认值调整为 'verified',并修正存量 'active' -> 'verified'。
ALTER TABLE tenant_users
ALTER COLUMN status SET DEFAULT 'verified';
UPDATE tenant_users
SET status = 'verified'
WHERE status = 'active';
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
-- 回滚:恢复默认值为 'active'(不回滚数据修正)。
ALTER TABLE tenant_users
ALTER COLUMN status SET DEFAULT 'active';
-- +goose StatementEnd