-- Add port mappings for apps CREATE TABLE app_ports ( id INTEGER PRIMARY KEY, app_id TEXT NOT NULL REFERENCES apps(id) ON DELETE CASCADE, host_port INTEGER NOT NULL, container_port INTEGER NOT NULL, protocol TEXT NOT NULL DEFAULT 'tcp' CHECK(protocol IN ('tcp', 'udp')), UNIQUE(host_port, protocol) ); CREATE INDEX idx_app_ports_app_id ON app_ports(app_id);