-- application_ports: which ports an application typically uses (many-to-many). -- port_number is not a strict FK to ports to allow registering an application -- before its port entry exists in the catalog. CREATE TABLE IF NOT EXISTS application_ports ( application_id INTEGER NOT NULL REFERENCES applications(id) ON DELETE CASCADE, port_number INTEGER NOT NULL, PRIMARY KEY (application_id, port_number) );