a -admin
u –authenticated users
v -non-authenticated visitors
C | R | U | D | |
---|---|---|---|---|
Posts | a u | a u v | a u | a u |
Comments | a u | a u v | a u | a u |
Users | a u | a u | a u | a |
- Posts table:
- id (auto increment primary key to uniquely identify the post)
- title (a title for the content)
- content (the actual content)
- file_name, file_type, file_size (optional resources)
- user_id (foreign key, a post belongsTo an identified admin user responsible for the post, an admin user potentially hasMany posts)
- Comments table:
- id (auto increment primary key to uniquely identify the comment)
- post_id (foreign key, a comment belongsTo a post and a post potentially hasMany comments)
- user_id (foreign key, a comment belongsTo an identified user responsible for the comment and a user potentially hasMany comments)
- comment (the text or the comment or query added by the user)
- created (timestamp)
- modified (timestamp)
- Users table:
- id (auto increment primary key to uniquely identify the user)
- name (eg”real” name)
- username (for login)
- Password (encrypted)
- role (user type information)
A user potentially hasMany posts and potentially hasMany comments.