]> de.git.xonotic.org Git - xonotic/xonstatdb.git/blobdiff - functions/merge_servers.sql
Insert a logging record to the merged_server table after the merge is done.
[xonotic/xonstatdb.git] / functions / merge_servers.sql
index f929064fe58ed21809488d0ec99f433b14d88e3f..551d7cfed9d5dff136b3cba5a38a5e9b2fab0320 100644 (file)
@@ -17,19 +17,11 @@ begin
         raise exception 'Both servers have hashkeys and they are different! Not merging.';
     end if;
 
-    -- fill in the "important" missing attributes
-    if w_server.ip_addr is null and l_server.ip_addr is not null then
-        w_server.ip_addr := l_server.ip_addr;
-    end if;
-
+    -- fill in the hashkey (everything else will be handled by xonstat)
     if w_server.hashkey is null and l_server.hashkey is not null then
         w_server.hashkey := l_server.hashkey;
     end if;
 
-    if w_server.revision is null and l_server.revision is not null then
-        w_server.revision := l_server.revsion;
-    end if;
-
     -- games get moved to the new server
     update games set server_id = p_winner_server_id where server_id = p_loser_server_id;
 
@@ -47,6 +39,8 @@ begin
     update servers set active_ind = false where server_id = p_loser_server_id;
 
     raise notice 'Server #% deactivated.', p_loser_server_id;
+
+    insert into merged_servers(winning_server_id, losing_server_id) values(p_winner_server_id, p_loser_server_id);
 end;
 $$
 language plpgsql;