Database Fields and Tables

Last updated on March 29, 2023.

This document explains how databases are built and structured on Insites.

Database Fields

A 'Database Field' or 'Column' is an element of a database table that holds a specific type of data, such as dates, integers, strings, and files. A field is defined by its and data . Fields are defined in the YAML configuration files whenever a Database Table is created. For example:

The above configuration adds three database fields:

  • name of type string
  • enabled of type boolean
  • age of type integer

Note that at the YAML code level, Database Fields are declared using the keyword .

Important

The codes and configuration files displayed in this article demonstrates how Insites work at the technical level. However, the Insites Instance Administration provides a user interface for a smoother and more intuitive user experience. Visit our Insites Database Manager documentation to learn more.

Database Field Types

The table below lists available data types for Database Field configurations that are used to create fields on the database. In addition, the database fields' corresponding user interface elements are also outlined:

Field Type UI Element
Array
  • Checkbox
  • File (Multiple)
  • Input (Multiple)
  • Select (Multiple)
Boolean Toggle
Date Date
DateTime DateTime
Data Source Select (with infinite scroll and dynamic search)
Data Source (Multiple) Select (Multiple) (with infinite scroll and dynamic search)
GeoJSON Code Editor
Float Decimal
Media
  • Media (Image)
  • Media (File)
Integer Number
String
  • Color
  • Code
  • Checkbox
  • Select
  • HTML
  • Link
  • Radio
  • Markdown
  • Multi-line
  • Phone
  • Input
Time Time

Database Tables

A Table is an object that describes and contains all Database Item objects that belong to it.

Tables define object types that will exist in your application and describe the properties each object can have. For example, if your application manages data labelled as 'books', you can create a Table with the name 'book' that will have the properties 'title' and 'author' (both having the type 'string'). The main function of a Table is to allow you to define the structure of your data.

Tip

The codes and configurations discussed in the following sections are automatically generated when you use the Insites Database Manager user interface to build your Database Tables.

Defining Tables

Tables are placed in the directory.

The example below shows the BookList Table :

A basic visual representation of such a table is displayed below. The table contains records (or Database Items) with mock (sample) data.

id Author Title
0001 The Hunt for Red October Tom Clancy
0002 Jane Austen Pride and Prejudice
0003 C.S. Lewis The Lion, The Witch, and the Wardrobe
0004 George Orwell 1984
0005 Hamilton, A., Madison, J., Rossiter, C., Jay, J., & Kesler, C. R. (2005). The Federalist Papers

Note that the column (or property) labeled is automatically created by Insites; no need to create it either on the YAML file or the Database Manager user interface.

Database Configuration Properties

Property Description Required
name Name of your Table. Best practice is to keep it lower case. Example: Yes
properties Array of properties you want to contain within your records. Equivalent to a column or database field in a database table. No
Have a suggestion for this page?

Didn't quite find what you are looking for or have feedback on how we can make the content better then we would love to hear from you. Please provide us feedback and we will get back to you shortly.