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:
MHSanaei 2026-05-31 19:48:19 +02:00
parent b1c141a515
commit c20ee00fa3
No known key found for this signature in database
GPG key ID: 7E4060F2FBE5AB7A

View file

@ -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
}