Toad World® Forums

Removing a relation leaving its fields in the child table

Hi,

I'm trying to remove a relation from my ERD, but I want to leave its carried fields in the child table.

In particular, I want to remove the relationship M20_PCL_F01 between parent M20_PCL_IDX and child M20_PCL, but maintaining the field PCL_ID in the child (highlighted in the image).

Whenever I remove the relation, Toad automatically removes the field too.

Is there any solution? (besides re-adding the field manually... it is inherited by a number of descendant tables)

Hi,

standard behavior is that attribute, which has been created by relationship(by migrating form parent entity) will be delete, when relationship is delete.

Is there way how to change this by Macro. Each attribute has internal property "KeepForeignKey". When this property is true, attribute preserve after delete relationship.

I wrote simple macro for you, it set "KeepForeignKey" for selected attributes. Package is created for version Toad Data Modeler 6.1.

Please copy this package to location "Path to Packages" (To show this tab in settings you need switch on Expert mode from Options-General) and start TDM. (You can use function "Import Custom Package" from Main Menu - Expert Mode - Customization).

Now when you right click on attribute in Model Explorer you will see new popup item "Keep Attribute"

KeepForeignAttributeMacro.png

Code of Macro is very simple, you can see it. If you want you can create easy macro to modify all attributes in model.

Regards

Daril
KeepForeignKeyMacro.zip (1.14 KB)

Thanks, it worked.

I modified the Attribute Properties form to easily show and change the field:

Visualizzazione di image.png

It would be nice to have it as a native option in Toad.

Hi,

I created post on Idea Pond

http://www.toadworld.com/products/toad-data-modeler/i/modeling/keep_attribute_migrated_by_relationship

Daril

Thanks.

I’m trying to accept your answer but when I click on Yes (Did this answer your question?) the page is simply reloaded and the question remain marked as not answered .