Add foreigner gem
Add foreign key constraints for much more efficient deleting of apps
Add the rest of the foreign key constraints
Fix up tests after adding foreign key constraints