Fix edge gateway relay binding reactivation
Reactivate existing relay binding rows when a gateway/relay pair is re-added after soft deletion, avoiding duplicate uniq_edge_gateway_binding inserts. Add regression coverage for the reactivation path.
This commit is contained in:
@@ -799,7 +799,6 @@ class edge_gateway_manager
|
||||
$existing = (new edge_gateway_relay_bindings_o())->getFieldsWhere([
|
||||
'gateway_id' => $gatewayId,
|
||||
'relay_id' => $relayId,
|
||||
'deleted_at' => null,
|
||||
], ['id']);
|
||||
|
||||
if ($existing !== []) {
|
||||
@@ -818,6 +817,7 @@ class edge_gateway_manager
|
||||
$bindingObject->approved_by->set($userId);
|
||||
$bindingObject->approved_at->set($this->now());
|
||||
$bindingObject->metadata_json->set($bindingMetadata);
|
||||
$bindingObject->deleted_at->set(null);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user