RISE to Bloome Software
Log In    
Home
RISE
Marshal
Download
 
 
Site Map Site Map
Link to Us Link to Us
r2bsoftware.se r2bsoftware.se
 
 
RISE Version 4.5RISE Version 4.5
RISE Visual ModelingRISE Visual Modeling
AJAX Code GeneratorAJAX Code Generator
 
 
Bookmark and Share
 
Click to hide navigation tree

Database customization

A RISE Editor code generator uses a set of rules when generating a database model (a.k.a. SQL/DDL script) from a RISE model. The database part of a convention allows you to control the naming of database object such as tables, views, column, indexes et c.

The example below shows a database naming convention created to explicitly preserve all names in the RISE model. This means that all prefixes added by the RISE Editor default convention are been removed. Not to discourage anyone but this calls for an explanation and a warning! The default RISE name convention assures that database objects of different types exists in different namespaces, i.e. that there can be no cross-type name collisions. It also makes sure that you can generate multiple RISE models in to the same logical database, something which, by the way, may prove extremely convenient in larger systems. Should you implement a convention like the one below you need to, manually, assure the integrity of names between different object types. One safe idea is to supply all entities, view, attributes et c with "type prefixes" directly in the RISE model. Finally, if you change the database conventions for a model that's already been used to render a database RISE will no longer be able manage (update) the existing database.


Expression logics

Names are assembled using the rules specified in database tab property grid. These rules are executed in sequences, e.g. a table name is function of the type of table to name and the rule for that particular type. The rule syntax includes a way to tie a rule to model data or to the output of other rules. This is done by using a marker, <name>, that is replaced with the appropriate value during execution.

The following set of variables are available to extract information from the RISE model.

Model variableValid inDescription
<model>all propertiesThe prefix of the RISE model.
<entity>tableThe model entity name.
<relation>tableThe model relation name.
This is only applicable for relations that are mapped to tables (many-many or symmetric).
<view>viewThe model view name.
<attribute>columnThe model attribute name.
<pknode>columnThe model relation node name.
Normally, the name of the entity being referred to.
<index>indexThe model index name.
  
The following markers are available to refer to the output of other rules. These markers selects the appropriate rule and returns its value.

Rule aliasValid inDescription
<tableprefix>table, 
index, 
constraint
Determined by the state of the table to name. It's either equal to the "Table prefix" or to the "Table deleted prefix" property.
<typedtable>table, 
index, 
constraint
Determined by the type of table to name. It's either equal to the "Entity table" property or to the "Relation table" property.
<columnprefix>column,
constraint
Determined by the state of the column to name. It's either equal to the "Column prefix" or to the "Column deleted prefix" property.
<typedcolumn>column,
constraint
Determined by the type of column to name. It's equal to on of the properties "Attribute column", "Foreign key column" or "Id column".

Here's a small, but colorful, example illustrating how RISE evaluates the naming conventions.

Suppose we've modeled an entity, Banana, having an attribute, Brand, in a model with prefix Fruit.

The naming conventions in the snapshot above would then result in following sequences:
Table.Table name = <tableprefix><typedtable> = Table.Entity table = <entity> = Banana
Column.Column name = <columnprefix><typedcolumn> = Column.Id column = PK
Column.Column name = <columnprefix><typedcolumn> = Column.Attribute column
   <attribute>Brand
Thus, the result is the table Banana having the columns PK and Brand.

If, instead, we applied the RISE default convention it would result in the following sequences:
Table.Table name<tableprefix>_<model>_<typedtable>t_Fruit_Table.Entity table =
   t_Fruit_u_<entity> = t_Fruit_u_Banana
Column.Column name = <columnprefix>_<typedcolumn> = c_Column.Id column = c_id
Column.Column name<columnprefix>_<typedcolumn> = c_Column.Attribute column
   c_u_<attribute> = c_u_Brand
In this case, the result is the table t_Fruit_u_Banana having the columns c_id and c_u_Brand.

Column properties

Attribute columnRule for column names based on attributes.
Column deleted prefix*Prefix rule for deleted columns.
Column nameRule for column naming; all types and states.
Column prefixPrefix rule for non-deleted columns.
Foreign key columnRule for column names based on relation nodes.
Id columnPrimary key name
* For code generators that rename rather than delete columns.

Constraint properties

Check constraintRule for attribute constraint naming.
Default valueRule for attribute default value constraint naming.
External foreign keyRule for naming model external foreign key constraints..
Foreign key constraintRule for naming foreign key constraints.
Unique constraintRule for naming unique constraints on attributes and foreign keys.

Index properties

Index nameRule for modeled indexes.

Table properties

Entity tableRule for naming tables based on entities.
Relation tableRule for naming tables based on relations.
Table deleted prefix*Prefix rule for deleted tables.
Table nameRule for table naming; all types and states.
Table prefixPrefix rule for non-deleted tables.
* For code generators that rename rather than delete (drop) tables.

View properties

View nameRule for naming views.