change logic when add primary key