Skip to main content
Version: Previous

Quick start - define the data model

Now you are ready to define the fields and tables that make up your data model. This model structures information in a simple way that can be viewed by users and processed by the application.

Add a table

Let's define a table in the file alpha-tables-dictionary.kts. You can find this file in the folder server/alpha-app/src/main/genesis/cfg.

In the following example, we define the table TRADE with five fields. Of these fields, TRADE_ID is the primary key, and the value for that field is auto-generated.

alpha-tables-dictionary.kts
tables {

table (name = "TRADE", id = 2000) {
field("TRADE_ID",STRING).sequence("TR").primaryKey()
field("QUANTITY",INT)
field("PRICE",DOUBLE).notNull()
field("SYMBOL",STRING)
field("DIRECTION", type = ENUM("BUY", "SELL", default = "BUY"))
}

}

You can find more information on tables here.

Once you have defined your tables, you can create the key modules that surround the database.