-- host_applications: direct association between a host and an application. -- Allows explicitly tagging a host with an application regardless of ports. -- One application can only be linked once to a given host. CREATE TABLE IF NOT EXISTS host_applications ( host_id BIGINT NOT NULL REFERENCES hosts(id) ON DELETE CASCADE, application_id BIGINT NOT NULL REFERENCES applications(id) ON DELETE CASCADE, PRIMARY KEY (host_id, application_id) );