27
Views
7
Comments
Data Model - send and receive

Hello, 


How should I build my database?

I have to record things I send and things I receive.

Should I create an entity for the things I send and another for what I receive?

Or should I create just one entity and put two attributes to send and receive?

What is the best solution?


(I have other entities for users)


Thanks

mvp_badge
MVP
Rank: #17

Hi,

If the things you sent and the things you receive share the same attributes than one entity makes sense and you can add an extra attribute being a foreign key to a static entity with two records: send and receive. 

If the things you sent and things you receive only share a few or no similar attributes then you better create two separate entities.

Regards,

Daniel

Rank: #329

Hi,

One entity should do and have user id as foreign key


Regards,

Swapnil







Champion
Rank: #40

Hi

You can try below also you can manage both in one entity only change from and to user when you saving data into the below entity

1.Send/Received-
ID PK
FromUser(FK user)
ToUser (FK user)
Message text
CreatedDate
CreatedBy
etc.