I was wondering how the database schema of Dropbox would be designed? I am thinking about three tables: User, File, Folder with following constraints.
Constraints:
How would you create a relationship between them?
A relational schema is a set of relational tables and associated items that are related to one another. All of the base tables, views, indexes, domains, user roles, stored modules, and other items that a user creates to fulfill the data needs of a particular enterprise or set of applications belong to one schema.
Schema is of three types: Logical Schema, Physical Schema and view Schema.
This ERD fits the rules you've described:
Note that in this schema, every user has their own individualized view of folders. Files, on the other hand, are represented only once but can be assigned to one or more folders, even for different users.
EDIT: (slightly) expanded model:
With the addition of a single table to track physical folders and their contents, my proposed schema also addresses all of the additional functionality suggested by Branko Dimitrijevic:
The Joel Brown's model is a good start, but let me tickle your imagination with another possibility:
This model has the following properties:
The question, of course, is whether the increased flexibility you get with this model is worth the extra complexity, but this is something only you can answer...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With