fix database and add delete on cascade