Automatic Reuse and Migration of Columns

When you create a reference, PowerDesigner can automatically reuse an appropriate existing column in the child table as the foreign key column and migrate the primary key column in the parent table to create a foreign key column in the child table.

  1. Select Tools > Model Options to open the Model Options dialog box and select the Reference sub-category in the left-hand Category pane.
  2. Specify your choices for column reuse and migration as follows:
    • Select Auto-reuse columns to automatically reuse existing columns in child tables as foreign key columns when creating references. The column in the child table must have the same code as the migrating primary key column, and cannot already be a foreign key column for it to be suitable for reuse. If you want to reuse a child table column that is already a foreign key column, you must do this manually from the Joins tab of the reference property sheet.

    • Select the Auto-migrate columns to automatically migrate primary key columns in parent tables for use as foreign key columns in child tables. This will also enable the column properties check boxes, allowing you to specify which of the parent column properties to migrate:
      • Domains

      • Check (check parameters)

      • Rules (business rules)

      • Last position - to add migrated columns at the end of the table column list. If this option is not selected, migrated columns are inserted between key columns and other columns which implies that a child table must be dropped and recreated each time you add a reference and modify an existing database.

      Note: During intermodel generation, whether or not this option is selected, any selected column property is migrated from the PK to the FK.
  3. Ensure that the Default link on creation option is set to Primary key.
  4. Click OK to close the Model Options dialog and return to your model.