2022-08-08 12:42:20 +02:00
|
|
|
DROP VIEW ipconfig;
|
|
|
|
|
2022-08-08 12:10:10 +02:00
|
|
|
ALTER TABLE packet
|
2022-08-08 12:42:20 +02:00
|
|
|
ALTER COLUMN packet_name TYPE VARCHAR(6) NOT NULL;
|
2022-08-08 12:10:10 +02:00
|
|
|
ALTER TABLE packet
|
|
|
|
ALTER COLUMN hive_id DROP NOT NULL;
|
2022-08-08 12:42:20 +02:00
|
|
|
|
|
|
|
CREATE VIEW ipconfig AS
|
|
|
|
SELECT DISTINCT ON (theunion.ipv4) theunion.ipv4,
|
|
|
|
theunion.name,
|
|
|
|
theunion.alias,
|
|
|
|
theunion.hivename
|
|
|
|
FROM ( SELECT h.hive_name AS hivename,
|
|
|
|
ip.inet_addr AS ipv4,
|
|
|
|
'eth0:'::text || p.packet_name::text AS alias,
|
|
|
|
p.packet_name AS name,
|
|
|
|
2 AS prio
|
|
|
|
FROM inet_addr ip
|
|
|
|
JOIN packet p ON p.cur_inet_addr_id = ip.inet_addr_id
|
|
|
|
JOIN hive h ON h.hive_id = p.hive_id
|
|
|
|
UNION
|
|
|
|
SELECT h.hive_name AS hivename,
|
|
|
|
ip.inet_addr AS ipv4,
|
|
|
|
'eth0'::text AS alias,
|
|
|
|
h.hive_name AS name,
|
|
|
|
1 AS prio
|
|
|
|
FROM inet_addr ip
|
|
|
|
JOIN hive h ON h.inet_addr_id = ip.inet_addr_id
|
|
|
|
ORDER BY 2, 5) theunion;
|