[PowerDesigner] ConsTRAINT Name Uniqueness Problem and Processing

Using PowerDesigner to generate a database script, a Constraint name uniqueness error is reported:

ConstraintNameUniquenessProblem-01

Double click each Line error, found that the foreign key quoted names are duplicated:

ConstraintNameUniquenessProblem-02

Inertia go online to find solutions , I found two main methods:

1. Use Automatic Correction

Right-click the error line and select Automatic Correction in the menu to automatically correct the error.

ConstraintNameUniquenessProblem-03

In this way, the Constraint name will be automatically numbered.

ConstraintNameUniquenessProblem-04

2. Manually modify the Constraint name

On the foreign key reference editing page, click the avatar at the far right of the Constraint name, and then modify the Constraint name.

ConstraintNameUniquenessProblem-05

Although it can solve the problem, I feel that it is not a cure for the symptoms. Look carefully at the automatically generated Constraint name, there should be a template, which is automatically generated based on the name template. Just find the name template and modify it according to your own rules. So a third method is given.

3. Modify reference name template

Menu item Database->Edit Current DBMS…
Find Scipt->Objects->Reference ->ConstName node, you can see that Value is the automatically generated reference name template. The specific meaning will not be explained. Compare the actual generated reference name to understand. I changed it to FK%REFR% and let it be automatically generated. The name is the custom Code name in the foreign key edit window plus an FK prefix.

ConstraintNameUniquenessProblem-06

Original address http://c-xuan.com/2016/09/12/ConstraintNameUniquenessProblem/

Leave a Comment

Your email address will not be published.