Reputation: 27
I want to make a database for a plugin I am making for Minecraft. I've been trying to figure the best way to structure this but I have failed many times, could anyone give me some tips?
The idea is:
There will be a active_shops
table => this represents individual shops, saving the information about each shop.
I need a table called player_shops
=> this table will have an AI ID and store things like, members and the name of the shop.
Here is where the problem is,
when adding the active shop
I would need to include the ID from the player_shops
as a secondary key.
But a player without a player shop
can also make an active shop
so instead of that ID I would need to store the player's UUID, which is a string of characters.
Please help to figure this out.
Upvotes: 0
Views: 64
Reputation: 8621
The information provided is scarce so it might not apply to your context, but...
Your original DB structure looks like:
Besides the problem you stated, you will not be able to normalize this structure.
I propose something like this:
The other possibility is if you need a shop to be 1) player 2) active 3) both. Then the shop table should be modified like so:
This is obviously a work in progress, hopefully it helps enough to get you started thinking of your solution another way.
Upvotes: 1