Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
d17f853a
Commit
d17f853a
authored
Jan 18, 2026
by
yangjianbo
Browse files
fix(数据库): 补充允许分组列兼容迁移
parent
ef5a4105
Changes
1
Show whitespace changes
Inline
Side-by-side
backend/migrations/006_add_users_allowed_groups_compat.sql
0 → 100644
View file @
d17f853a
-- 兼容旧库:若尚未创建 user_allowed_groups,则确保 users.allowed_groups 存在,避免 007 迁移回填失败。
DO
$$
BEGIN
IF
to_regclass
(
'public.user_allowed_groups'
)
IS
NULL
THEN
IF
EXISTS
(
SELECT
1
FROM
information_schema
.
tables
WHERE
table_schema
=
'public'
AND
table_name
=
'users'
)
THEN
ALTER
TABLE
users
ADD
COLUMN
IF
NOT
EXISTS
allowed_groups
BIGINT
[]
DEFAULT
NULL
;
END
IF
;
END
IF
;
END
$$
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment