Jump to content

Structure of a database with shared items


Recommended Posts

I've got a database of files which is kept on a server and for which I use MySQL. Each entry includes a user ID, a unique reference, and file data. I would like to now allow users to share files, in a similar fashion to how it's done on Dropbox. I'm trying to figure out what the format of the amended database will be. I have a separate database with the details of all users. I think:

1. The user ID should be removed from the files database.

2. The users database should have extra columns listing, by ID, (a) all files created by the relevant user (who remains the "owner" of the files, and is the only person who can delete them or invite other people to access them), (b) all files which the relevant user can view, and (c) all files which the relevant user can view and edit. I think each file should only appear in one of a, b and c.

3. To populate the list of files which are available for the active user I need to loop through each of a, b and c. I will also have to display who else can use the relevant file, so to do that I will also have to loop through the whole user database, not just the active user's entry in it. It will be fairly complicated to display, but Dropbox is my guide.

I guess that's the thrust of it, but if anyone has any comments, I'd be pleased to hear them.


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...