Toad Data Modeler supports macros. You can use sample macros available in the Macros menu or create your own macros. You can create a macro in Package Explorer or Script Explorer and modify its properties to display the macro either in the main menu or pop-up menu (of specific object or on the Workspace etc.). Visual components for creation of macros are also available (User Forms).
Macros menu contains:
You want to create a macro Add Attribute to PK and add this macro to pop-up menu of attributes in Model Explorer.
To create your own macro
Productivity pack contains three macros.
Select Macros | Productivity | Add Entities to run the macro.
The same macro can be executed from Workspace.
New dialog opens. Specify entity captions, one per line.
Click Execute to create the new tables.
The tables will be added to your model.
In case your workspace option Autocomplete is activated the entities will appear also on our workspace.
Select Macros | Productivity | Add Attribute to Selected or All Entities to run the macro.
New dialog opens. Specify caption, name, data type and other options.
Tip: If you want to use table caption/name as prefix, type a "space" as the first character in Attribute Caption field and an underscore as the first character to Attribute Name field.
Note that if you select the Add to Key checkbox, the Not Null checkbox disappears.
In case you selected an entity, the attribute will be added to the selected entity. Otherwise the following dialog opens.
Click Yes to add attribute to all entities.
Verification: There is some basic verification of the required items.
Select an attribute in physical Model Explorer, right-click and select Macros | Copy Attribute to All Entities.
It is possible to run the macro also from Object Viewer.
Note: The attribute will be added only to the entities which don't have an identically named attribute.
You can find them in Package Explorer in section Productivity Pack | Macros.
Rename Objects Pack contains the following macros:
This macro renames primary keys to PK_<tablename>.
When you create a new entity, its primary key is named Key1.
When you execute the macro, the key name and caption changes.
This macro renames relationship captions and names and modifies them to:
New caption: <parenttablecaption> - <childtablecaption>
New name: <parenttablename>_<childtablename>
By default, relationships are named as Relationship1, Relationship2 etc. When you execute the macro, the following result is achieved:
This macro renames Table and Column check constraint names and captions.
By default, Toad Data Modeler names check constraints as CheckConstraint1,2,3 etc.
After you execute the macro, check constraints will be renamed to CHK_<tablename>_<index> and CHK_<columnname>_<index>.
This macro works similarly to the Rename Relationships macro.
New caption: <object1caption> - <object2caption>
New name: <object1name>_<object2name>
The macro renames existing View relationships.