mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-05-31 18:24:10 +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:
parent
b1c141a515
commit
c20ee00fa3
1 changed files with 4 additions and 0 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue