Foreign key constraints

Foreign keys should support constraints to avoid deleting a referenced object or to set the reference to null.