mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-03 19:09:36 +00:00
fix(postgres): clear client_traffics before deleting inbound
DelInbound removed the client_inbounds join rows but never deleted the inbound's client_traffics, so Postgres rejected the inbound delete with fk_inbounds_client_stats (SQLSTATE 23503). SQLite never enforced the FK so this went unnoticed. Delete client_traffics first, matching the order already used in the sync path.
This commit is contained in:
@@ -610,6 +610,10 @@ func (s *InboundService) DelInbound(id int) (bool, error) {
|
||||
logger.Debug("DelInbound: inbound not found, id:", id)
|
||||
}
|
||||
|
||||
if err := db.Where("inbound_id = ?", id).Delete(&xray.ClientTraffic{}).Error; err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
if err := s.clientService.DetachInbound(db, id); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user