[v6r12] new ps and fk dfc

This PR contains a new sql schema with enforced Foreign Key, as well as stored procedure. The managers to call the various PS are also included. It also contains numerous bug fixes 
Shouldn't this be 2 lines above?