1

The initial state disappears when the username or surname was changed.

Time #1

users table

| id                                   | firstName | lastName |
|--------------------------------------|-----------|----------|
| 4d4d1d28-7bb8-4081-ad46-19821d656643 | John      | Doe      |

history table

| id | version | type | firstName | lastName |
|----|---------|------|-----------|----------|
|    |         |      |           |          |

Time #2

I update the user by REST call and its initial state disappears

curl --location --request PUT 'http://localhost:8080/users/{userId}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "firstName": "Angela",
    "lastName": "Clarkson"
}'

users table

| id                                   | firstName | lastName |
|--------------------------------------|-----------|----------|
| 4d4d1d28-7bb8-4081-ad46-19821d656643 | Angela    | Clarkson |

history table

| id                                   | version | type | firstName | lastName |
|--------------------------------------|---------|------|-----------|----------|
| 4d4d1d28-7bb8-4081-ad46-19821d656643 | 1       | 1    | Angela    | Clarkson |

So we lost the initial state.

How can I solve that?

0 Answers0