New Features
Enhanced Features
O/R Mapping
Tips and Tricks
UML Diagrams
VP Suite

Foreign Key Name Mapping

The Foreign Key Name Mapping feature can help you to update the foreign key column name according to Foreign Key Pattern, it include Relationship name and referenced table information (foreign table and foreign primary key column name) in the Entity Relationship Diagram.

Configure the Foreign Key Pattern

You can define the Foreign Key Pattern. When you create the relationship between tables, the Foreign Key column creates and follows the Foreign Key pattern to name.

  1. Select Tools > Options… to open the Options Dialog.
    select_options.jpg

  2. Select the Diagramming option on the right hand side area and then select ERD & ORM tab
    options_dialog.jpg

  3. Modify the format of the Foreign Key Pattern with the predefine variables and It provide the Example to preview the result of the Foreign Key Pattern Format.
    original_format.jpg

  4. Click Add variables… button to open the Add Foreign Key Pattern Variable Dialog. You can select all or individual variable add to the Foreign Key Pattern’s Format field.
    add_fk_pattern_variable_dialog.jpg

    For example, you draw a following ER Diagram. The Student table contains a foreign key column call Collegeid.
    orginal_erd.jpg

    variablevalue
    {fk_name}CSRelationship(Relationship name)
    {foreign_table_name}College
    {foreign_pk_columns}cid

Update the Foreign Key Column Name

{foreign_table_name}{foreign_pk_columns} is the default of the Foreign Key Pattern Format, so the ER Diagram creates the Foreign Key column call Collegecid in Student table.

  • Add the Customize String/variables for the Foreign Key Pattern.
    1. Add the customize String such as “FK” for prefix of the Foreign Key Pattern and {fk_name} variable (FK{foreign_table_name}{foreign_pk_columns}{fk_name}) and Click OK to close the Options Dialog. The Collegecid column will rename according to the Foreign Key Pattern immediately(When your Foreign Key column never modify before) .
      modified_fk_pattern_format.jpg

    2. Modify the foreign table name (College), foreign primary key column name (cid) or foreign key name (CSRelationship) then the foreign key column name (Collegecid) also follows the new Foreign Key Pattern to update.
      Change the foreign primary key column name from cid to id then the foreign Key column name allow the Foreign Key Pattern update from Collegeid to CollegeidCSRelationship.
      update_fk_name.jpg

  • Edit the foreign key column name
    You can change the foreign key column name by yourself but the modified column name will not obey the Foreign Key Pattern to update when information change.
    1. Change the FKCollegeidCSRelationship to CollegeidCSRelationship_FK.
      update_self_fk_name.jpg
    2. When you modify the table name (College), foreign primary key name (cid) or foreign key name (CSRelationship). The altered foreign key column name will not update to follow Foreign Key Pattern.
      not_update_fk_column_name.jpg

Downloads



Resources

 
 
Last modified: 2006/06/19 14:50
 
 
Home | Recent Topics | Highlights | UML Diagrams | Tips and Tricks | Object-Relational Mapping
visual-paradigm.com Home | Training Center | UML Center | VP Gallery | Discussion Forum | UML Open Directory