Changed foreign keys for objet and ressources, on delete set null. username can be null, this avoid problem if user deletion occurs by error