mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-09-17 07:37:15 +00:00
fix(inbounds): allow negative subSortIndex for subscription order (#6465)
* fix(inbounds): allow negative subSortIndex for subscription order Preserve explicitly set negative indices so primary inbounds can sort ahead of the default without renumbering peers; keep 0/omitted → 1. * fix(inbounds): gofumpt model.go and trim subSortIndex comments --------- Co-authored-by: mrchatam <287639636+mrchatam@users.noreply.github.com>
This commit is contained in:
@@ -1031,11 +1031,10 @@ func migrateTgIDIndex() error {
|
||||
return db.Migrator().CreateIndex(&model.ClientRecord{}, "TgID")
|
||||
}
|
||||
|
||||
// normalizeInboundSubSortIndex lifts sub_sort_index values below the 1-based
|
||||
// minimum (rows written by builds that defaulted the column to 0, or by nodes
|
||||
// predating the field) so they cannot sort ahead of explicitly ranked inbounds.
|
||||
// normalizeInboundSubSortIndex lifts legacy zero defaults to 1.
|
||||
// Explicit negatives are left alone so primary inbounds can sort first.
|
||||
func normalizeInboundSubSortIndex() error {
|
||||
res := db.Exec("UPDATE inbounds SET sub_sort_index = 1 WHERE sub_sort_index < 1")
|
||||
res := db.Exec("UPDATE inbounds SET sub_sort_index = 1 WHERE sub_sort_index = 0")
|
||||
if res.Error != nil {
|
||||
log.Printf("Error normalizing inbound sub_sort_index: %v", res.Error)
|
||||
return res.Error
|
||||
|
||||
Reference in New Issue
Block a user