Toad World® Forums

Naming Convention

Is it possible to define the naming convention of primary key name based on the table name, such case PK[TableName]?

Thanks.

Hi:

I have the same question as this person. Where can I specify a template for primary key names to include the table name, i.e. PK_<%TableName%>?

I want to be able to name the unique indexes that are not PK with AK01_<%TableName%>, AK02_<%TableName%> etc. Is it possible?

What about the relationship names? I want the template for the name to be FK_<%ChildTable%>To<%ParentTable%>.

Thanks!

Hi,

such settings cannot be defined in naming conventions. Please define default values for new objects for defined target database.

Click Settings | Default values...
New dialog opens. Make changes (see screenshot) and restart TDM.

More can be found at:
http://blogs.inside.quest.com/modeling/2011/11/08/changing-default-relationship-names-in-tdm/

Regarding alternate keys. It is possible to define settings for both primary and alternate keys in one item (Keys). Currently there is no separate option just for primary and another for alternate keys. We will work on that.

Regards,

Vaclav

Thank you

Hi, related to this, I did set the default values as shown in the screen shot (I restarted TDM as well), however, I noticed the following behavior:

I add a new entity. Its name is set to Entity1 (it is the first one in the model). I change its name to something else, let’s say Table1. I click the Apply button to make the name change permanent. I go to the Keys tab and I click the Add button. The new PK has its name set to PK_Entity1. It doesn’t seem to take into account the new name. It should have been PK_Table1. I even saved the model before I added the PK it does the same thing.

Am I missing something? This is a physical model for sql server 2008.

Thanks

Hi,

you can use the Rename Primary Keys macro.

rename-keys-1.png

This macro is one of the in-built macros that should help you to automate various modeling tasks.

Another nice macro that you might find useful is accessible via menu Macros - Productivity.
This can be used for adding _ID attribute to all or selected tables:

add-attribute.png

Custom form:

new-attribute.png

Regards,

Vaclav