How can I specify the names of Indexes, so that Primary Key, Foreign Key, etc., have specific names in erwin Data Modeler, after switching to the Physical side of the Model? Right now the Key Group name is used by default and I would like different naming convention. Is it doable?
Yes, it is doable by using macros in the following place. In Actions | Model Naming Options, under Naming Option tab, add the macros to convert the Logical names to the Physical format as coded.
An example could be as follows. To have different names for Indexes on the Physical side of the Model, use the %Switch command, in the Macro field, of the Name Mapping Tab as shown above. Change the ‘KeyGroup to Index’ macro field from %KeyName to something like the following %Switch syntax:
Note: This all needs to be in one line. Yes, it may not show fully in the editor, but as long as it is all there, it will expand as expected.
The above will create a Primary Key Index of TableName_PK, but Alternate Key Index will use Tablename_AK and then the Alternate Key number, like Tablename_AK1. Foreign Key Indexes will have the same name as Alternate Key Indexes, but will have Tablename_FK and Foreign Key number, like Tablename_FK1. The else clause covers the Inversion Entry Indexes and adds on IE and the Inversion Entry number, like Tablename_IE1.
The Substring command can be edited to include other names formats, but this syntax is the basic structure for its use and can be expanded as needed.