Fix bug 1,1 -- 1,n --> attribute type when creating foreign key