mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-04 15:06:37 +08:00
fix: 修复 WAF 规则组保存/绑定网站时报 of_waf_rule_group_bindings_pkey 冲突
This commit is contained in:
@@ -102,7 +102,8 @@ func up202606200006(ctx context.Context, tx *sql.Tx) error {
|
||||
if _, err := tx.ExecContext(ctx, `
|
||||
SELECT setval(
|
||||
pg_get_serial_sequence('of_waf_rule_group_bindings', 'id'),
|
||||
COALESCE((SELECT MAX(id) FROM of_waf_rule_group_bindings), 0)
|
||||
GREATEST(COALESCE((SELECT MAX(id) FROM of_waf_rule_group_bindings), 0), 1),
|
||||
COALESCE((SELECT MAX(id) FROM of_waf_rule_group_bindings), 0) > 0
|
||||
)
|
||||
`); err != nil {
|
||||
return fmt.Errorf("sync of_waf_rule_group_bindings sequence failed: %w", err)
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
-- +goose Up
|
||||
SELECT setval(
|
||||
pg_get_serial_sequence('of_waf_rule_group_bindings', 'id'),
|
||||
COALESCE((SELECT MAX(id) FROM of_waf_rule_group_bindings), 0)
|
||||
GREATEST(COALESCE((SELECT MAX(id) FROM of_waf_rule_group_bindings), 0), 1),
|
||||
COALESCE((SELECT MAX(id) FROM of_waf_rule_group_bindings), 0) > 0
|
||||
);
|
||||
|
||||
-- +goose Down
|
||||
|
||||
Reference in New Issue
Block a user