Add PK based on prefix+"_"+entity name+"_"+attribute name in the macro

Hi

I have a model I reversed engineered from MS SQL. Each table/entity has an ID field/attribute as well as PublicID. I would like to write a macro( or use one from an example if exist) for either selected or all entities to create a PK for ID fields and BK for PublicID fields.

Thanks