[JITERA] Implement Comments Table and Model
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
-
Migration for
commentsTable:- Created a migration file
/db/migrate/1737541409355_create_comments_table.rbthat defines the structure of thecommentstable. - The table includes the following columns:
-
content: Text of the comment. -
user_id: Foreign key referencing theuserstable. -
note_id: Foreign key referencing thenotestable. -
created_at: Timestamp for when the comment was created. -
updated_at: Timestamp for when the comment was last updated.
-
- Created a migration file
-
Comment Model:
- Created the
Commentmodel in/app/models/comment.rb. - The model includes associations:
-
belongs_to :user: Establishes a relationship with theUsermodel. -
belongs_to :note: Establishes a relationship with theNotemodel.
-
- Validations can be added in the future to ensure data integrity.
- Created the
These changes will allow for the storage and management of comments within the application, facilitating user interaction with notes.