I’m creating a master server list. So basically any time one of my servers goes online, it gets posted to the master server list.
Every server has a unique IP address obviously, however there can be multiple servers per IP address (if the server on the same IP uses a different tcp port and udp port).
So the table has 3 columns: ip (TEXT), tcp_port (INT), udp_port (INT)
- 18.104.22.168 hosts a server using TCP port 500 and UDP port 600.
- 22.214.171.124 hosts another server using TCP port 501 and UDP port 601.
- 126.96.36.199 hosts yet another server using TCP port 502 and UDP port 602.
And so forth. How do I make it so the master server can add multiple servers to the list with the same IP but they must have different ports, having the tcp_port not exist in any other rows and the udp_port not exist in any other rows either.
Do I just need to add these columns: ip, tcp_port, udp_port to the unique_index and that should be it?
What’s the correct table creation and insert syntax for this?