-
-
Notifications
You must be signed in to change notification settings - Fork 7
Class
Rainer Sulzbach edited this page Sep 17, 2021
·
14 revisions
In the Clownfish backend you can define your datamodel by creating classes (do not mismatch with classes of OOP). For example you can model a datamodel called User. Go to the class page and enter the name User in the input field, check the Search engine relevant
checkbox (if content of this class should be indexed by Lucene) and click the New button. A new entry in the class list will appear. Select this entry and define the fields for the new class.
Add the fields like this:
- Fill the field name
- Select the type of the field
- Check the identity flag (only when the class should save unique values for this field)
- Check the autoinc flag (only when the field is an integer and a new content entry should automatically increment this value)
- Click the New button
Assuming you want to create a similar class like this:
attribute | description |
---|---|
id | unique id with autoincrement |
name | user name |
user email | |
password | user password encrypted |
birthday | user birthday |
- Create a field named id with type integer and identity flag and autoinc flag both checked.
- Create a field named name with type string and leave the flags unchecked.
- Create a field named email with type string and identity flag checked (email must be unique in this case).
- Create a field named password with type hashstring and leave the flags unchecked. The password will be encrypted in the database.
- Create a field named birthday with type datetime and leave the flags unchecked.
You can use the following datatypes for fields:
type | description |
---|---|
boolean | true or false |
datetime | timestamp |
hashstring | encrypted string for storing passwords |
htmltext | text for HTML content |
integer | integer values |
media | special link to internal assets |
real | floatingpoint values |
string | string values 255 chars |
text | text not HTML interpreted |
markdown | text Markdown interpreted |
classref | reference to another class |
assetref | reference to an assetlibrary |