temporarily remove view ipconfig

This commit is contained in:
Peter Hormanns 2022-08-08 12:42:20 +02:00
parent 6c940d6bc7
commit d026203c91

View File

@ -1,4 +1,29 @@
DROP VIEW ipconfig;
ALTER TABLE packet
ALTER COLUMN packet_name character varying(6) NOT NULL;
ALTER COLUMN packet_name TYPE VARCHAR(6) NOT NULL;
ALTER TABLE packet
ALTER COLUMN hive_id DROP NOT NULL;
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;