Proper table layout for shared item

Posted 2 years ago by TheNephilim

When an item is created and owned by a user, but can be shared with other users; what would be the best way to do that?

I was thinking:

- id
- owner_id
- etc.

- id
- post_id
- user_id

The owner_id on posts to save the owner of the post, and users the post is shared with are stored in the post_user pivot table.

I think storing a record for the owner in post_user too, would be helpful in keeping querying easier.

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