-- host_ports: which ports are open on which host (many-to-many). CREATE TABLE IF NOT EXISTS host_ports ( host_id BIGINT NOT NULL REFERENCES hosts(id) ON DELETE CASCADE, port_number INTEGER NOT NULL REFERENCES ports(number) ON DELETE CASCADE, PRIMARY KEY (host_id, port_number) );