set primary key to code in school model