Chapter 2:
Create your database

We’ll use Data Tables to store feedback from our users. Data Tables are an out-of-the-box option for data storage in Anvil, and they’re backed by PostgreSQL.

Step 1: Add a Data Table to store your feedback

In the sidebar menu on the left, click the database icon Database Icon.

Opening the Data Tables service

Click on ‘+ Add Table’ and name it ‘feedback’.

Renaming the table

Renaming the table

Step 2: Set up your table

Now set up your “feedback” table, with the following columns:

  • name (Text column)
  • email (Text column)
  • feedback (Text column)
  • created (Date and Time column)

Here’s how to do that:

  1. Add a column for the name of the person submitting feedback, by clicking ‘+ New Column’. Call this column ’name’ and under Column Type select Text. Click ‘Ok’.
  2. Keep adding columns until your Data Table has the structure we described above. Column titles are case sensitive, so let’s stick to lower case.
Creating a Data Table

Your Data Table should look something like this:

The final Data Table

The finished table

In Chapter 3, we’ll write some server-side code to store data in the new Data Table.

Chapter complete

Nice work! Your Data Table is set up and ready to use.

In chapter 3, you’ll write some server-side code to store the feedback in it.