Payments Table #1

Open
opened 2026-10-14 17:34:40 +01:00 by esilva · 0 comments
Owner

We need to analyze how the payments table work.
Lets say we create an expense with 2 users, when paid it full and the other has yet to pay 50%

expdbuser@127.0.0.1:expenses> select * from "expensesPayments" where "ExpID" = 673;
+-----------+-------+--------+--------+
| ExpPaymID | ExpID | UserID | Payed  |
|-----------+-------+--------+--------|
| 1048      | 673   | 2      | 0.00   |
| 1049      | 673   | 1      | 140.00 |
+-----------+-------+--------+--------+

After paying:

expdbuser@127.0.0.1:expenses> select * from "expensesPayments" where "ExpID" = 673;
+-----------+-------+--------+-------+
| ExpPaymID | ExpID | UserID | Payed |
|-----------+-------+--------+-------|
| 1048      | 673   | 2      | 0.00  |
| 1050      | 673   | 2      | 70.00 |
| 1049      | 673   | 1      | 70.00 |
+-----------+-------+--------+-------+

What I don't like is the entry that remains 0, but more importantly the previous entry is edited. I reckon I should change this in such a way I can create history. Maybe a new "history" table where transactions are marked. For example, a user pays its debt, and that history entry will reference the payment made by the creditor.

We need to analyze how the payments table work. Lets say we create an expense with 2 users, when paid it full and the other has yet to pay 50% ``` expdbuser@127.0.0.1:expenses> select * from "expensesPayments" where "ExpID" = 673; +-----------+-------+--------+--------+ | ExpPaymID | ExpID | UserID | Payed | |-----------+-------+--------+--------| | 1048 | 673 | 2 | 0.00 | | 1049 | 673 | 1 | 140.00 | +-----------+-------+--------+--------+ ``` After paying: ``` expdbuser@127.0.0.1:expenses> select * from "expensesPayments" where "ExpID" = 673; +-----------+-------+--------+-------+ | ExpPaymID | ExpID | UserID | Payed | |-----------+-------+--------+-------| | 1048 | 673 | 2 | 0.00 | | 1050 | 673 | 2 | 70.00 | | 1049 | 673 | 1 | 70.00 | +-----------+-------+--------+-------+ ``` What I don't like is the entry that remains 0, but more importantly the previous entry is edited. I reckon I should change this in such a way I can create history. Maybe a new "history" table where transactions are marked. For example, a user pays its debt, and that history entry will reference the payment made by the creditor.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: esilva/ExpSplitter#1