Models describe the data that your app uses. Example models include:
You can create the models yourself or import (share) models from other apps. For example, importing the user model from System allows you to bind app-specific data like schedules to users (binding models together is done using Relations).
Models consist of attributes. Each attribute describes some important property (for instance, a customer’s address or phone number or an article’s price) and has a data type that defines how the attribute looks and behaves.
|Data Type||Description||Example use cases|
|Integer||A number. Allows arithmetic operations, cannot have any decimals||1, 2, 3, …|
|Float||A number. Allows arithmetic operations, can have decimals.||Prices|
|String||Plain text.||Use for storing text of all kinds. Also for numbers you do not want to perform arithmetic operations on (such as phone numbers).|
|Boolean||A value that can only be true or false.||Completion of tasks, calendar bookings, etc.|
|Date, Time, Date & Time||Stores date and/or time in various formats.||Start times, completion times, durations, etc.|
|State||Has a finite number of values, defined by you.||Order status (placed, in progress, done) and similar|
All Appivo-models will have a set of system attributes, they cannot be considered read only and are completely managed by the system. They are:
|id||ID||The primary key – a globally unique identifier|
|created_at||Date & Time||Date & Time for when the record was created|
|updated_at||Date & Time||Date & Time for when the record was last updated|
|ver||Integer||The records version-number, increments by one every time the record is updated|
Also note that your models may get other automatically generated attributes for representing foreign keys.
Lets say you have a model Order that is related to another Model called Article and lets also assume an Order is always related to exactly one Article then the system will add an attribute to the Order model for storing the identity of the related Article. The name of the attribute depends on how you have named the relationship (the system uses the model names for naming the relationship ends by default, so if you do nothing the relationship-end name will be the same as the models name).
In our example above an attribute called Article_id would be added to the Order-model and its data type would be ID.