Henosia

Database

Your product will most likely need data to run properly. For a web-shop you'll need all the information about your product, for a movie database, it will need all the data about the movies, for a CRM on your customers, it will need names and addresses, etc.

A database consists of a number of data tables which holds rows of data, one row per element. For our shoe shop example our database consists of three data tables:

  1. A product table with name, brand, price and image
  2. A color table with color and availability
  3. a size table with size and availability

Besides the data listed are also various IDs and timestamps.

You can see how the three tables are connected here:

A screenshot from Supabase showing the database schema consisting of three tables named product_colors, product_sizes and products. Each table consists of 6-7 columns.

Supabase also offers database functionality for your product, and in this section we will give you some pointers of ways to best integrate a database into your product.

Advice

Working with databases is a non-trivial task and this goes for AIs too. For the greatest chance of success, it is a good idea to understand the basics about how Supabase's databases work, so you can write the most accurate prompts for the AI. Please visit Supabase's documentation on databases to learn more.

When to add a database

If you are still not entirely sure about the data you will need in your product, adding a database now will be a bit early as you will likely need to make changes to it later. If you have a reasonable idea about the data set you will need, then add the database as soon as possible, because adding a database to a huge product with loads of details can be difficult for the AI. In short, as early as possible without being too early.

How to add a database

The more accurate and detailed you can be when adding a database the better. It will help you to have a mental model of the data tables needed. Envision a table and think about the following: If each row is an element (e.g. a shoe, a movie or a customer), what will the header of each column be?

For our shoe shop example, each row will be a shoe, and for each shoe there will be a name, a brand, a price and an image. However, each shoe will come in multiple colors and multiple sizes, but we don't want a shoe shown six times just because it comes in six sizes. That is why color and size are separate tables, where the colors and sizes then only show up as rows of color badges and size badges on each shoe.

Below you can see the product table for our webshop with name, brand, size and image, along with some IDs and timestamps that the AI created:

Screenshot from Supabase showing the products table. It consists of two ID columns, columns for imgae source, name, brand, price and two time stamps. The table is filled with data.

If you are making a CRM, each row will be a customer with a company name and address. But maybe you have multiple contacts within that company and each of them have a different phone number and email. Then that is a different table, because those contacts all belong to the same company.

Then a prompt for adding a database to your CRM could look like this:

Please add a database for my customer data. Each customer has a company name and address, and for each company there can be multiple contacts with individual names, email addresses and phone numbers.

Editing the database structure

If you later on realise that your database is missing data, you can add extra columns with this data. For instance, you may want the website of your customers in the database too. Then you can prompt as follows:

For each company in the database, please add a column for the company website

Editing the data in the database

Editing the data itself (the specific shoes, customers or movies) is most easily done in Supabase directly. On https://supabase.com/dashboard, simply pick your project, go to the table editor in the left side menu, pick the table with the data you want to edit, and edit the content like you would edit a normal spreadsheet. Once the data is edited, the changes will appear in Henosia.

Caution

Be careful changing the content of columns created by the AI, such as IDs, timestamps or columns containing json content, as this may cause your product to stop working correctly with the database.

On this page