Users table
ID | COLUMN_1 | COLUMN_2 | COLUMN_3 | ETC... |
---|---|---|---|---|
348 | ... | ... | ... | ... |
Ads table
ID | USER_ID | COLUMN_1 | COLUMN_2 | COLUMN_3 | ETC... |
---|---|---|---|---|---|
91 | 348 | ... | ... | ... | ... |
Transactions table
COST | NUMBER_OF_DAYS | TRANSACTION_DATE | TYPE | AD_ID | USER_ID |
---|---|---|---|---|---|
3000 | NULL | ... | 1 | NULL | 348 |
-800 | 30 | ... | 2 | NULL | 348 |
-50 | NULL | ... | 3 | 91 | 348 |
-300 | 19 | ... | 4 | 91 | 348 |
There are 4 types of transactions
- 1 = When the user adds money to his wallet.
- 2 = When the user buys a gold membership.
- 3 = When the user reposts his ad. (The ad will appear again on the top of the list)
- 4 = When the user makes his ad a featured ad. (The ad will appear top of the non-featured ads)
I don't like designing the transactions table in this way because there are columns not required according to type value, Is there any better way to design the transactions table?