umldiagram

How to indicate insert into DB in a diagram?


My situation is that I need to make a diagram that will show an endpoint and which tables the endpoint inserts data into, but i'm not sure how to do it.

My exact use cases will be the following:

  1. Insert one row into one table
  2. Insert multiple rows into one table
  3. Insert different rows into different tables (e.g. one row into users and one row into companies
  4. Insert multiple rows into multiple tables (e.g. two rows into users and two rows into companies

How would I show this in a diagram?

What am I trying to achieve?

To make a long story short (and spare you from some boring details), I've been building a table and an endpoint to store some data in that table. After some back and forth with the designer, the frontender and some more people, I've had to change both the table layout, the logic and output of my endpoint. This has all been due to (as I see it) bad planning of the task and missing clearity on which data is needed and where is saved (e.g. which data goes into which tables).

This has been a huge waste of time, so now I want to be better prepared for future tasks, by building a diagram that will show exactly which data goes to which tables. To do that I need to know how to show database CRUD actions in a diagram.


Solution

  • Before looking at UML

    The problem that you describe is very frequent. And even with a perfect diagram, you will not be able to completely avoid it. In fact, it is not a problem but a fact of life:

    This approach will allow everyone to understand what the other mean, and result in a solid ground before starting the real effort. People can still change their mind, but at least it will not be because they misunderstood.

    Can a diagram help?

    Yes a diagram can help. But diagrams, like any language, may mislead or may be misunderstood. So, the diagram will help only if you take the time to explain it and discuss it.

    What UML diagram to use?

    It will probably be two diagrams: