add primaryKey attribute if not already defined
test for missing primaryKeys