Add constraints or indexes

The Business Application Modeler requires that tables are defined with primary keys. Constraints and indexes that are part of the database structure are displayed as part of the table, but additional constraints (such as primary keys) can be added.

Right-click the table in the meta-schema diagram and select Add Constraint or Index.

Figure: Add Constraint or Index dialog


This figure is a screenshot of the Add Index or Constraint dialog.

Specify the index type.

Primary Key
A Primary Key is a column or set of columns that uniquely identifies a row of data. The Not Null property must be set on the columns used in a Primary Key. The Not Null property indicates the column does not allow NULL values. It is used by the generation and update scripts when generating the SQL statements used to manage the database.
Secondary Key
Also known as a Unique Constraint. Like Primary Key, the Secondary Key ensure uniqueness on the columns it is defined, but also allows NULL values.
Index

An index improves the speed of looking up data in tables. Indexes can be defined on one or more table column.

Unique Index
Unique Index behaves the same as an Unique Constraint. It ensures the data in the column is unique. The difference between a Unique Constraint and a Unique Index depends on the database engine.

The index can be viewed in the Structure view.

Figure: Database Structure view


This figure is a screenshot of the Database Structure view. The added index is displayed in the treeview as a index node.

Select the index to display its properties in the Properties view.

Figure: Properties view


This figure is a screenshot of the properties of an index: Name, Columns, Type.

If an index contains more than one column, the order of the columns is indicated.