Charrua
2 weeks ago

Database table design, add new column for a new feature?

Posted 2 weeks ago by Charrua

Hello, I'm struggling with a problem on where to add some data on a database and how to relate it.

I have a Members and Transactions tables for money transactions associated with members. Each transaction has one transaction_type, easy for now.

The problem is that I need to relate other entities to those transactions, for example an Event could be related to a transaction or maybe a Concert.

My approach will be to add an extra column to the Transactions table with event_id and concert_id. But this design doesn't seem to be good enough, because in the future if new entities will be created, I can't add columns and columns to the table. Another issue is that I need to add some extra columns related with the event or the concert, maybe a concert will have a number of tickets bought and an event may have any other related info.

It seems to me that is wrong to add those columns to the database, because if I have 1000 records and only 5 records are for an event, the 995 will have a column unused... I think my problem is self explanatory.

Any ideas? What would you do to solve this?

Please sign in or create an account to participate in this conversation.