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
8391d480
Commit
8391d480
authored
Jan 18, 2026
by
yangjianbo
Browse files
fix(数据库): 补充分组列回填前置保护
parent
d17f853a
Changes
1
Hide whitespace changes
Inline
Side-by-side
backend/migrations/006b_guard_users_allowed_groups.sql
0 → 100644
View file @
8391d480
-- 兼容缺失 users.allowed_groups 的老库,确保 007 回填可执行。
DO
$$
BEGIN
IF
EXISTS
(
SELECT
1
FROM
information_schema
.
tables
WHERE
table_schema
=
'public'
AND
table_name
=
'users'
)
THEN
IF
NOT
EXISTS
(
SELECT
1
FROM
information_schema
.
columns
WHERE
table_schema
=
'public'
AND
table_name
=
'users'
AND
column_name
=
'allowed_groups'
)
THEN
IF
NOT
EXISTS
(
SELECT
1
FROM
schema_migrations
WHERE
filename
=
'014_drop_legacy_allowed_groups.sql'
)
THEN
ALTER
TABLE
users
ADD
COLUMN
IF
NOT
EXISTS
allowed_groups
BIGINT
[]
DEFAULT
NULL
;
END
IF
;
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