Database Model Help
Posted: Tue Jan 20, 2015 12:15 am
Hello,
I have not worked with databases a lot so I'm having difficulty modelling how to create the following database.
The requirement for my project is:-
Users (who have a name and email address).
Each user can have multiple files.
Each file can be shared with multiple other users
Files can be tagged with categories.
The way I was thinking was:-
This way whenever a file was added/shared it would be added to the file database with the id of the user who uploaded it/id of user who it got shared with.
This model would mean whenever a file is shared a new copy of the same file is made in the database with new id, is there a more efficient way to do this?
Also how do I implement the categories feature? Is there a way to dynamically create text fields in the database for each new category?
I'll be using a MySQLi database.
I have not worked with databases a lot so I'm having difficulty modelling how to create the following database.
The requirement for my project is:-
Users (who have a name and email address).
Each user can have multiple files.
Each file can be shared with multiple other users
Files can be tagged with categories.
The way I was thinking was:-
Code: Select all
User Database:-
1) id (Auto increment) 2) Name 3) Email
Code: Select all
File database:-
1) id(of user) 2)Name of file
This model would mean whenever a file is shared a new copy of the same file is made in the database with new id, is there a more efficient way to do this?
Also how do I implement the categories feature? Is there a way to dynamically create text fields in the database for each new category?
I'll be using a MySQLi database.