Question

I have thousands users, and one milion cards. Every user owns thousands cards, at first, users cannot see a card's number if they dont own the card , but one user can make any count of owned cards open to any other users.

So, I add a card privilege to detemine whether a user can see a card , if one user has privilege to see a card, I will insert the user id to the card privilege table.

It is obvious this scheme is stupid。 Fortunately the beginning, followed by getting worse. how can I optimize it ?

Was it helpful?

Solution

Card Master table with a unique card ID (primary key on card ID)

User Master table with unique user ID (Primary key on user ID)

Relationship table with card ID and user ID (primary on both)

Make sense?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top