insert or update on table violates foreign key constraint
The error message means you are attempting to add an entityType that does not have a corresponding Project entry. (I don’t know your domain or what you are trying to achieve, but that schema design looks wrong to me…)