Relational Design for ChapterX
Notation
- Primary keys are bolded and underlined.
- Foreign keys are marked with
*at the end of their name and the referenced entity is written in parentheses. - Complex attributes are bolded, and their containing attributes are following them, made italic.
- Multivalued attributes have their own table
Tables
- USER (
user_ID,username,email,name,surname,password,created_at,updated_at)
- ADMIN (
user_ID*(USER))
- REGULAR_USER (
user_ID*(USER))
- WRITER (
user_ID*(USER))
- STORY (
story_ID,mature_content,short_description,image,content,user_ID*(WRITER),created_at,updated_at)- status (multi-valued attribute, see table STATUS)
- STATUS (
story_ID*(STORY),status)
- CHAPTER (
chapter_ID,chapter_number,chapter_name,title,content,word_count,rating,published_at,view_count,story_ID*(STORY),created_at,updated_at)
- GENRE (
genre_ID,name)
- READING_LIST (
list_ID,name,content,is_public,user_ID*(USER),created_at,updated_at)
- NOTIFICATION (
notification_ID,content,is_read,created_at)- content_type (multi-valued attribute, see table CONTENT_TYPE)
- CONTENT_TYPE (
notification_ID*(NOTIFICATION),content_type)
- AI_SUGGESTION (
suggestion_ID,original_text,suggested_text,accepted,created_at,applied_at,story_ID*(STORY))
- SUGGESTION_TYPE (
suggestion_ID*(AI_SUGGESTION),suggestion_type)
- LIKE (
user_ID*(USER),story_ID*(STORY),created_at)
- COMMENT (
comment_ID,content,user_ID*(USER),story_ID*(STORY),created_at,updated_at)
- COLLABORATION (
user_ID*(USER),story_ID*(STORY),created_at)- role (multi-valued attribute, see table ROLE)
- permission_level (multi-valued attribute, see table PERMISSION_LEVEL)
- ROLE (
user_ID*(COLLABORATION),story_ID*(COLLABORATION),role)
- PERMISSION_LEVEL (
user_ID*(COLLABORATION),story_ID*(COLLABORATION),permission_level)
- HAS_GENRE (
story_ID*(STORY),genre_ID*(GENRE))
- READING_LIST_ITEMS (
list_ID*(READING_LIST),story_ID*(STORY),added_at)
- NOTIFY (
user_ID*(USER),story_ID*(STORY),notification_ID*(NOTIFICATION))
- NEED_APPROVAL (
suggestion_ID*(AI_SUGGESTION),story_ID*(STORY),chapter_ID*(CHAPTER))
DDL script for creation and deletion of tables
DML script for inserting data in the tables
Relational diagram made in DBeaver
Last modified
3 weeks ago
Last modified on 03/03/26 23:55:24
Attachments (5)
-
relational_schema.png
(109.3 KB
) - added by 5 weeks ago.
Added relational schema
-
schema_creation.sql
(8.5 KB
) - added by 4 weeks ago.
Added schema creation script.
- relational_schema.2.png (119.5 KB ) - added by 4 weeks ago.
-
data_load.sql
(24.2 KB
) - added by 4 weeks ago.
Added data load script.
- relational_schema.3.png (122.7 KB ) - added by 3 weeks ago.
Download all attachments as: .zip
Note:
See TracWiki
for help on using the wiki.

