[Closed] Can tables be named automatically based on region and entity name?

0 votes
asked Aug 21, 2014 in Solved by floeH (430 points)
recategorized May 22, 2015 by ludek.vodicka

We are using different database names in one model. We are always defining the table name (ORM Properties) to provide also the database name. Would be nice if this can be autofilled based on region and table name. We are also using a prefix in database names because of customer/brand names. To define a prefix would also be awesome.

Example:
Customer name: skipper -> prefix defined in settings: skipper_
Region: crm
Entity: customer
= tablename: skipper_crm.customer

Right now our table names are pretty long and to always write them down in table can evoke typing errors.

2 Answers

0 votes
answered Apr 23, 2015 by floeH (430 points)
selected Apr 24, 2015 by floeH
 
Best answer

Your suggestion is just defining a prefix for the entity name, or?
I want to add values in property "table" or "schema". Is that also possible? I have not found a example for that.

commented Apr 23, 2015 by ludek.vodicka Skipper developer (140,450 points)

Hi, it's not a problem to define also "table" property. You have to define complete template including "orm-attributes" elements. The easiest way is to check skipper project file and copy fragment from it.

You need something like this:

<template element='entity' use-case='create'>
  <entity name="skipper_{module}."/>
      <orm-attributes>
         <attribute name="table">{module}</attribute>
      </orm-attributes> 
   </entity>
</template>

You can find more information about templates including examples in our help site:

http://help.skipper18.com/expert-usage/customization/extending-templates
http://help.skipper18.com/expert-usage/customization/template-library

commented Apr 24, 2015 by floeH (430 points)

Works like a charm! Thanks!

0 votes
answered Aug 21, 2014 by Martin Freki Stradej Skipper developer (74,840 points)

This can be managed by adding custom templates. However only the prefix/region can be defined automatically - the templates are applied before the entity is created, so the name of the entity itself is unknown.

This template should look like this:

<template element='entity' use-case='create'>
  <entity name="skipper_{module}."/>
</template>

You can find more about the templates here:
http://help.skipper18.com/en/extending-templates

asked Apr 14, 2015 in Solved by floeH (430 points)
edited Oct 13, 2015 by ludek.vodicka
[Solved] Templates not used
commented Apr 14, 2015 by floeH (430 points)

Your suggestion is just defining a prefix for the entity name, or?

I want to add values in property "table" or "schema". Is that also possible? I have not found a example for that.

...