added foreign keys for deleting application