|
|
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 logicsNames 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 variable | Valid in | Description | <model> | all properties | The prefix of the RISE model. | <entity> | table | The model entity name. | <relation> | table | The model relation name. This is only applicable for relations that are mapped to tables (many-many or symmetric). | <view> | view | The model view name. | <attribute> | column | The model attribute name. | <pknode> | column | The model relation node name. Normally, the name of the entity being referred to. | <index> | index | The 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 alias | Valid in | Description | <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 column | Rule for column names based on attributes. | Column deleted prefix* | Prefix rule for deleted columns. | Column name | Rule for column naming; all types and states. | Column prefix | Prefix rule for non-deleted columns. | Foreign key column | Rule for column names based on relation nodes. | Id column | Primary key name |
* For code generators that rename rather than delete columns. Constraint properties
Check constraint | Rule for attribute constraint naming. | Default value | Rule for attribute default value constraint naming. | External foreign key | Rule for naming model external foreign key constraints.. | Foreign key constraint | Rule for naming foreign key constraints. | Unique constraint | Rule for naming unique constraints on attributes and foreign keys. |
Index properties
Index name | Rule for modeled indexes. |
Table properties
Entity table | Rule for naming tables based on entities. | Relation table | Rule for naming tables based on relations. | Table deleted prefix* | Prefix rule for deleted tables. | Table name | Rule for table naming; all types and states. | Table prefix | Prefix rule for non-deleted tables.
|
* For code generators that rename rather than delete (drop) tables.
View properties
View name | Rule for naming views.
|
|
|
|
|
|