Files
deepdata/backend/api-gateway/migration/001_user_groups.sql
T

19 lines
986 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- =============================================================
-- 001_user_groups.sql — M2: users 表新增 user_groups 列
--
-- 背景:Casdoor 账权接入后,本地用户需保存 Casdoor 组列表
-- (users.user_groups JSON),用于组驱动目录菜单体系的角色解析
-- (见 RoleResolver / CasdoorUserService)。
--
-- 说明:
-- * api-gateway 未引入 Flyway/Liquibase,本迁移需手工执行:
-- psql -h <host> -p 5433 -U <user> -d <db> -f 001_user_groups.sql
-- * 幂等:ALTER TABLE ... ADD COLUMN IF NOT EXISTS,可重复执行。
-- * 与 scripts/db/data-management-init.sql 的 users 表定义保持同步
-- (新库直接建表即可,无需跑本迁移)。
-- =============================================================
ALTER TABLE users ADD COLUMN IF NOT EXISTS user_groups JSON;
COMMENT ON COLUMN users.user_groups IS 'Casdoor 组列表(JSON),如 ["deepdata-admin","deepdata-dev"];组驱动角色解析源(M2)';