Budibase DB

Budibase DB is our native datasource. Any data you add here is stored directly on your Budibase instance.

Creating a table

You can create a table when you are in the Data section of the application builder.

Click Add source and then click the Create new table button.

260

Create a new table using this button

All auto columns selected by default

Creating a new Budibase DB table

Adding columns

To add new columns to an existing Budibase DB table, navigate to the table you want to edit, then click the + button along the top-right of the grid view. This will display a popover where you can configure the column you want to add.

Adding a required text column

Adding a long form 'Address' field

Editing columns

  1. Step into the table through the sidebar
  2. Hover over the column name you want to edit
  3. Click the three dots and select Edit column
Click the pencil icon to edit column

Click the pencil icon to edit column

Selecting the display column

The display column is an important aspect when you're setting up relationships in tables. The column you select as a display column will be the one visually displayed inside a relationship column in another table.

Selecting a column during the table creation is only possible if you import data using a CSV file. To select a display column in any other situation, you can set it from the edit column dropdown.

Use as display column

Use as display column

Auto-columns

After creating a new Budibase DB table you can add any number of built-in (auto types) columns you want to have. Each of these will be automatically updated whenever rows are added or updated in your table.

When adding a column, select Auto Column, and then the specific sub-type.

Selecting the 'Auto Column' data type

Selecting the 'Auto Column' data type

Selecting the 'Created By' auto column sub-type

Selecting the 'Created By' auto column sub-type

NameDescription
Auto IDAn automatically generated ID
Created byThe user who created the row
Created atWhen this row was created
Updated byThe user who updated the row last
Updated atThe time when the row was updated last

👍

Create table from CSV

You can Import a CSV/JSON file as a new Budibase table.


Data types

Within Budibase DB there are several data types to choose.

NameDescription
TextStorage of (relatively) short text
Long Form TextAllows you to store large amounts of texts, also supports markdown
OptionsPredefined list of options of which one can be selected
Multi-selectPredefined list of options of which multiple can be selected
NumberStorage of number
Boolean (True/False)Storage of true/false
Date/timeStorage of a date with a time
AttachmentsStorage of a file. Limited to 20MB per file
RelationshipsCreates a link between this table and another table
FormulaAllows you to set a formulated column, which will be calculated based on what you define. You can use handlebars or JavaScript
JSONAllows you to store JSON within a row, with the option to define a schema
Barcode/QRA text representation of a barcode or QR code
Auto ColumnAuto columns can be added post-creation of the database by selecting data type.

If using an external SQL Datasource, the native SQL data types will be mapped to one of these Budibase types for use in your apps. For more detail, look here for how the mappings are handled.

Column definitions

Common column options:

Property NameDescription
NameThe name of the column, used for querying and displaying
TypeThe type of data you want to store.
Use as table display columnEnabling this will make the newly created column the display column. This will also automatically make the field required
Primary indexEnabling this allows you to search in this field
Secondary indexWhen primary index is in use, you can enable a second index for searching

Data type specific column options:
Property NameDescriptionData Types
Enable Rich Text Format SupportEnabling this will allow you to store markdownLong Form Text
OptionsThe select-able options available for this column, one per line.Options, Multi-select
TableAllow a relationship to the specified tableRelationship
Column name in other tableThe relationship created will also be visible in the related table, this will set the new column name on the related tableRelationship
FormulaAllows you to set a formulated column, which will be calculated based on what you define. Allows you to define handlebars and JavaScriptFormula

Constraints

The following column constraints are available:

Constraint NameDescriptionData Types
RequiredWhen enabled, a value must be set for this fieldAll
Maximum LengthThe maximum length that can be stored in this columnText
Min ValueWhen set, any value entered in the database lower than this number will be rejectedNumber
Max ValueWhen set, any value entered in the database higher than this number will be rejectedNumber
EarliestWhen set, any date before the specified date is rejected for new rowsDate/Time
LatestWhen set, any date after the specified date is rejected for new rowsDate/Time

📘

External datasource constraints

You can add Budibase constraints to external table columns, however this is entirely for form validation and will not restrict the data that is saved.
Instead, you must add data constraints yourself to any external table schemas.


Data sync between environments

When using the Budibase DB, there are two environments to consider.

The Development environment represents the data that you see and interact with when using the app builder, which includes the Data and Design sections, and the App preview.

If in doubt, you can see if you are in the dev environment from the URL, which will show /app/app_dev_abc... in the path. In production, the URL will appear without the _dev part.

Production represents your live environment. This is the data that your End Users will interact with. When in the app builder, production data will continuously sync and update your development data, although a page refresh may be needed to see the new changes.

Whenever you Publish your app, any edits, inserts or deletes made in your dev data will be pushed into production, which may overwrite existing data.

📘

External datasources

Things are a little different when using an external database such as SQL.
In this case the data in either environment will read and write to the database that you connected to.

You can use Environment variables 🔒 to make use of development and production databases.