Migrate Property Page

Top  Previous  Next

The Migrate Property Page allows you to specify what Columns in the parent Table you want to "migrate" to be "foreign key" Columns in the child Table.  ModelRight automatically creates foreign key Columns in a Relation's child Table for certain Columns in the parent Table.  This is referred to as Migration.   By default, ModelRight migrates the Columns in the parent Table's primary key to be foreign key Columns in the child Table.  This ensures that you can use a foreign key constraint (i.e. the CREATE FOREIGN KEY statement) to enforce referential integrity declaratively (vs programmatically with a Trigger).

The Migrate Property Page of a Relation when Key-Based migration is selected

The Migrate Property Page of a Relation when Key-Based migration is selected

 

The Migrate Property Page of a Relation when the User-Defined migration option is selection

The Migrate Property Page of a Relation when the User-Defined migration option is selection

Migrate Columns From Parent Table

Lets you specify how you want to migrate parent Columns.  You have the following three options:

Key-Based - the default option.  Migrates Primary or Unique Key columns from the parent Table to the child Table.  If a Column is added/removed from the migrated Key, then a foreign key Column will automatically be added/removed from the Child table.  This option will be enforced in the database by using declarative referential integrity (i.e. the CREATE FOREIGN KEY statement).

User-Defined - lets you manually specify which parent Columns you want to migrate.  This option can not be enforced declaratively, but could be enforced with a Trigger.

None - indicates that you don't want the Relation to migrate any Columns.

Migrate Key

If doing Key-Based migration, this control will let you select which key you would like to migrate.  ModelRight lets you migrate either a Unique key or a Primary key.

Parent Column/Child Column

If you want the foreign key Column to have a different name than the parent Column, you can "rolename" it using this control.  Once the child Column has a different name than the parent column, changes to the name of the parent column will no longer automatically propagate to the child.

Index

This combo box displays the index, if any, that is associated with the Relation.  Often you will want to associate an Index with a Relation to speed joins between the parent and child Tables.  If no Index exists for the Relation, you can easily create one by selecting the <Create Join Index> option.  If an Index already exists, but has not been associated with the Relation, you can select it to make the association.  ModelRight automatically keeps the Columns in the Index in sync with the foreign key Columns contributed by the Relation.  If the relation is deleted (or the Index set to <None>), the associated Index will be deleted as well.

See Also

Migration, Unification, and Rolenaming