You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2021/01/12 23:03:02 UTC

[GitHub] [trafficcontrol] srijeet0406 commented on a change in pull request #5415: Adding check to make sure that you cannot add two servers with identical content

srijeet0406 commented on a change in pull request #5415:
URL: https://github.com/apache/trafficcontrol/pull/5415#discussion_r556154376



##########
File path: traffic_ops/app/db/migrations/2021010900000000_server_ip_profile_trigger_update.sql
##########
@@ -0,0 +1,73 @@
+/*
+	Licensed under the Apache License, Version 2.0 (the "License");
+	you may not use this file except in compliance with the License.
+	You may obtain a copy of the License at
+
+		http://www.apache.org/licenses/LICENSE-2.0
+
+	Unless required by applicable law or agreed to in writing, software
+	distributed under the License is distributed on an "AS IS" BASIS,
+	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	See the License for the specific language governing permissions and
+	limitations under the License.
+*/
+
+-- +goose Up
+-- +goose StatementBegin
+CREATE OR REPLACE FUNCTION after_ip_address_table()
+    RETURNS TRIGGER
+AS
+$$
+DECLARE
+    server_count   BIGINT;
+    server_id      BIGINT;
+    server_profile BIGINT;
+    new_profile    BIGINT;
+BEGIN
+    SELECT profile INTO new_profile from server s WHERE s.id = NEW.server;
+    WITH server_ips AS (
+        SELECT s.id as sid, ip.interface, i.name, ip.address, s.profile, ip.server
+        FROM server s
+                 JOIN interface i
+                      on i.server = s.ID
+                 JOIN ip_address ip
+                      on ip.Server = s.ID and ip.interface = i.name
+        WHERE i.monitor = true AND ip.service_address = true

Review comment:
       Talked with the team and turns out we dont need the `monitor = true` condition anymore.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org