Welcome to ModelRight Sign in | Join | Help
in

Ability to generate meaningful and consistent index and constraint names

Last post 10-01-2008, 6:30 PM by modelright. 6 replies.
Sort Posts: Previous Next
  •  06-19-2008, 5:30 PM 668

    Ability to generate meaningful and consistent index and constraint names

    I am wondering if there is a way to tell ModelRight that every time I create a new index or foreign constraint, it will automatically create a meaningful name based on a pattern.  In some other modeling tools, they provide you a way to specify how this name is generated.  For example, if you have the FK constraint name filled in as "%parent%_%child%', when a new foreign key constraint is added, the name will automatically be generated based on this pattern (e.g. a foreign key from the Customer table to the Order table will be generated as CUSTOMER_ORDER).

    This feature saves a lot of typing and you don't need to remember to change it to a meaningful every time, not to mention keeping everything consistent.

    BTW, this tool is look pretty good - except for the library models feature that is forthcoming...

    Ben

     

     

  •  06-20-2008, 8:00 AM 669 in reply to 668

    Re: Ability to generate meaningful and consistent index and constraint names

    Hi Ben,

    Thank you for the appreciative words.

    At this point, ModelRight doesn’t completely support what you want. Furthermore, it is not in our plans to support any kind of home-grown macro language. As you probably know, ModelRight provides a built-in scripting engine that gives you access to all the details of a model; therefore using scripting one can manipulate nearly any object or property in a model. Furthermore, scripts are written established languages like VBScript or JScript.

    Now, the good news is that we intended to provide support for automatic name generation (using scripting) soon. The way is going to work is very simple…. For every object type (Table, Index, Key Constraint, Column, etc) there will be a script name property which can be used to define how the names of any object of that type is defined (much like a macro, except I is VBScript or JScript). If there is no script name property defined then an object name is defined as usual.

    In fact, we do have something along these lines in the current release. One can attach a script to define how the FK columns are named, when they’re automatically created & migrated.

    Please take a look at this:

    https://www.modelright.com/files/folders/scripts/entry102.aspx

    Now, just imagine the same kind of mechanism that will be extended model wide for every kind of object.

    Furthermore, using scripting one can enforce naming conventions just by periodically running various “rename/update name” scripts… it turns out that it is a very easy to use and effective approach that our existing clients use quite a bit. (BTW, if ModelRight support is contacted, they will help creating these kinds d of scripts, when specifications are provided)

    The way it works is like this: one just creates indexes, constraints etc without giving any names (i.e. they’ll generated names – or at least some of them) and then (after all indexes, constraints, etc are added) a script is run to give them proper names. Later on, if more indexes, constraints are added, then the script is run again, etc.

    For instance, please take a look at this:

    https://www.modelright.com/files/folders/scripts/entry74.aspx

    or this:

    https://www.modelright.com/files/folders/scripts/entry110.aspx

     Best Regards.


    ModelRight Evangelist
  •  09-26-2008, 10:25 AM 908 in reply to 669

    Re: Ability to generate meaningful and consistent index and constraint names

    Any news on this feature?
  •  09-26-2008, 10:34 AM 909 in reply to 908

    Re: Ability to generate meaningful and consistent index and constraint names

    Yes. Auto-naming using macros will probably be part of our next build, planned for Monday. Stay tunned.
    ModelRight Evangelist
  •  10-01-2008, 2:17 PM 924 in reply to 909

    Re: Ability to generate meaningful and consistent index and constraint names

    Build 3055, available now, provides a new auto-naming (using macros) feature; auto-names can be defined in the Model's Naming Property Page. Please let us know how it works....
    ModelRight Evangelist
  •  10-01-2008, 3:29 PM 926 in reply to 924

    Re: Ability to generate meaningful and consistent index and constraint names

    Where can I get the build? The check for updates feature in the application isn't finding the new build. Thanks.
  •  10-01-2008, 6:30 PM 928 in reply to 926

    Re: Ability to generate meaningful and consistent index and constraint names

    Please check again. Or go to our Downloads page.
    ModelRight Evangelist