Problem: I have some questions about the check constraint, default constraint, alternate key constraint and foreign key constraint naming. We are able to use macros to control the naming of our primary keys and some other objects. We would like to be able to do that with the objects listed above.
Solution:
Applies to the more recent versions of erwin dm such as r9.64 and above.
Please go to the menu Actions | Model Naming Options, Name Mapping tab.
- The macro for the field Relationships will alter the names of the foreign key constraints.
Here is an example macro that may be used for the relationships: FK_%Parent_%Child_%RelName Gives the foreign key constraint name as FK_[Parent Table Name]_[Child Table Name]_[Relationship Name]
- The macro for the field Key Group to Index will alter the names of the primary key constraints and the alternate key constraints.
Here is an example macro that may be used for the Key Group to Index:
%Switch(%Substr(%KeyType,1,2)){ %Choose(PK){PK_%TableName} %Choose(IF) {%Substr(%KeyType,2,1)K%Substr(%KeyType,3,1)_%TableName} %Choose(AK){%Substr(%KeyType,2,1)K%Substr(%KeyType,3,1)_%TableName}%Choose(IE){%Substr(%KeyType,2,1)K%Substr(%KeyType,3,1)_%TableName}}
- Using the bulk editor you can change the default constraint names, but not the default constraints.
- Using the bulk editor you can change the check constraint names, but not the check constraints.
Comments
0 comments
Please sign in to leave a comment.