Skip to content

[JITERA] Implement Comments Table and Model

Quy requested to merge feat/create-comments-table-1737541437 into main

Created by: akuita

Overview

This pull request introduces a new comments table and the corresponding Comment model to enhance the application's functionality by allowing users to leave comments on notes.

Changes

  1. Migration for comments Table:

    • Created a migration file /db/migrate/1737541409355_create_comments_table.rb that defines the structure of the comments table.
    • The table includes the following columns:
      • content: Text of the comment.
      • user_id: Foreign key referencing the users table.
      • note_id: Foreign key referencing the notes table.
      • created_at: Timestamp for when the comment was created.
      • updated_at: Timestamp for when the comment was last updated.
  2. Comment Model:

    • Created the Comment model in /app/models/comment.rb.
    • The model includes associations:
      • belongs_to :user: Establishes a relationship with the User model.
      • belongs_to :note: Establishes a relationship with the Note model.
    • Validations can be added in the future to ensure data integrity.

These changes will allow for the storage and management of comments within the application, facilitating user interaction with notes.

Merge request reports