Diving Deeper into Our Wishlist App: Understanding Database Schemas

Dmytro Shamenko
2 min readJul 25, 2023

--

In the previous articles, we worked with Golang, created a basic server with a health check endpoint, and explored some tools like Insomnia and Curl. Now, let’s put on our architect hats and start designing the data structure for our Wishlist app. This article focuses on how we can model the data for our application using SQL.

What makes a wish unique?

Before we delve into SQL, let’s understand what our application needs. We’re creating a Wishlist app, so naturally, the primary entity in our app is a “wish.” But what defines a wish? To uniquely identify a wish, we would need:

1. Wish target: This is what the wish is about. For example, a “Red Ferrari SF90.”
2. Description: More details about the wish.
3. Image (optional): A picture of the wish.
4. Owner: The person who made the wish.
5. Access Level: Who can see and act upon the wish.

In addition to the above, each wish can also have a benefactor or patron — a kind-hearted soul who commits to fulfilling the wish.

Understanding the Tables

If you’ve worked with spreadsheets like Excel, you would be familiar with the concept of tables. Databases work similarly but are much more powerful. In our case, we’ll need three main tables:

1. Users: This table will store information about the users of our app. It should have unique identifiers like phone number or email.
2. Wishes: The wishes table will contain all the wishes. Each row will represent a unique wish with details like description, owner (linked to the Users table), and access level.
3. Benefactors: This table will create a mapping between users and wishes. Essentially, it will record who has committed to fulfilling which wish.

Why SQL?

Structured Query Language (SQL) is a standard language for managing and manipulating relational databases. Since our data can be neatly organized into tables (or relations), SQL is a good choice for our application. With SQL, we can easily create, update, delete, and retrieve data from our tables.

Final Thoughts

In this article, we’ve outlined the data structure needed for our Wishlist app. The next step is to translate this structure into actual SQL tables, which we’ll do in the next article. Remember, understanding and defining the structure of your data is a critical part of building any application, so take the time to get this right! Stay tuned as we delve deeper into building our Wishlist app.

--

--

Dmytro Shamenko

Software Engineer with more than ten years of experience. Systems Architect expertise. DevOps methodology & Golang fan. www.linkedin.com/in/dmitriyshamenko