wiki:RelationalDesign

Version 20 (modified by 211099, 13 days ago) ( diff )

--

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

  1. USER (user_ID, username, email, user_name, surname, password, user_created_at, user_updated_at)
  1. ADMIN (user_ID* (USER), assigned_at)
  1. REGULAR_USER (user_ID* (USER), joined_at)
  1. WRITER (user_ID* (USER), bio)
  1. STORY (story_ID, title, mature_content, short_description, image, story_content, status, user_ID* (WRITER), story_created_at, story_updated_at)
  1. CHAPTER (chapter_ID, chapter_number, chapter_name, title, chapter_content, word_count, rating, published_at, view_count, story_ID* (STORY), chapter_created_at, chapter_updated_at)
  1. GENRE (genre_ID, genre_name)
  1. READING_LIST (list_ID, list_name, list_content, is_public, user_ID* (USER), list_created_at, list_updated_at)
  1. NOTIFICATION (notification_ID, notification_content, content_type, is_read, link, user_ID* (USER), story_ID* (STORY), notification_created_at)
  1. AI_SUGGESTION (suggestion_ID, original_text, suggested_text, suggestion_type, accepted, suggestion_created_at, applied_at, story_ID* (STORY))
  1. LIKE (user_ID* (USER), story_ID* (STORY), liked_at)
  1. COMMENT (comment_ID, comment_content, user_ID* (USER), story_ID* (STORY), comment_created_at, comment_updated_at)
  1. COLLABORATION (user_ID* (USER), story_ID* (STORY), role, permission_level, collab_created_at)
  1. HAS_GENRE (story_ID* (STORY), genre_ID* (GENRE))
  1. READING_LIST_ITEMS (list_ID* (READING_LIST), story_ID* (STORY), added_at)
  1. NEED_APPROVAL (suggestion_ID* (AI_SUGGESTION), story_ID* (STORY), chapter_ID* (CHAPTER))

DDL script for creation and deletion of tables

DDL script

DML script for inserting data in the tables

DML script

Relational diagram made in DBeaver

Attachments (15)

Note: See TracWiki for help on using the wiki.