Finished adding database foreign key support and removed temporary workaround.

This update should finish fixing the issue where the database was not enforcing foreign keys and ignoring the ON DELETE SET DEFAULT