Database & Tables

Busywork comes with a fully-managed database, which you can use within your Builds. This allows you to perform database operations such as: create, read, update and delete. You are ensured scalability, low response times and no DevOps.

Creating a Table

Once inside the Build editor, click the Database button, which will bring you to the database viewer.

Now, inside the database viewer, click the New Table button just below the header.

Lastly name your table and press enter.

Table names must be unique

Creating a Field

With Busywork you can go ahead and define the structure of your tables as you go, through insert and update queries or define it beforehand in the database view.

Field names must be unique

Field Schema

Inside the database view you can observe your database tables and also specify options for fields such as,

  • Required / optional

  • Unique

  • Data type

  • Relationship

In order to expose the settings dialog, click the column header of the table that you want to change the schema settings for.

Schema settings exposed for "personal"-field

If you define a schema for your database table this is enforced whenever making queries that alter the content of the table, such as insert or update. An error is returned if the query doesn't comply with the defined schema.

If your query doesn't comply with the schema the query will fail, and the insert or update will not be performed.

Linking Table Fields

With the database view you can define one-to-many relationships between a row in one table and another table. An example of this type of relationship could be,

One user has one or more projects

This relationship assumes having two tables: Users and Projects. Users contains data about the user, such as id, username, password, personal information and contact information. The Projects table would contain data related to projects, such as name, start date, duration and owner.

In order to relate a project to a specific user, the project object must contain a field that identifies the user. You can user either the users unique id or username.

"id": 1,
"start_date": "01/01-2019",
"name": "my first project",
"owner": "myusername"

When creating a new user project you would simply specify all of the fields related to that project and the users username, which identifies the owner of the project.

Creating the relationship between the user and the projects belonging to the user assumes this model for the user table.

"id": 1,
"username": "myusername",
"password": "***********",
"personal": {
"first_name": "jonh",
"last_name": "doe"

Now you have to create the relationship through the field schema dialog.

Embeds projects dynamically in the Users table

Lastly you can see that the projects have been embeded into the Users table as an array of projects, which is also visible when performing queries in a Build.