Skip to content

Commit

Permalink
feat: Added code comments migration and updated schema
Browse files Browse the repository at this point in the history
  • Loading branch information
MathisBurger committed Oct 29, 2024
1 parent 51f2d28 commit 82be5d0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions tasky/migrations/2024-10-29-191834_code_comments/down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DROP TABLE code_comments;
8 changes: 8 additions & 0 deletions tasky/migrations/2024-10-29-191834_code_comments/up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CREATE TABLE code_comments (
id SERIAL PRIMARY KEY,
title VARCHAR(255) NOT NULL,
content TEXT NOT NULL,
commentor INTEGER NOT NULL,
group_id INTEGER NOT NULL REFERENCES groups(id),
solution_id INTEGER NOT NULL REFERENCES solutions(id)
);
15 changes: 15 additions & 0 deletions tasky/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ diesel::table! {
}
}

diesel::table! {
code_comments (id) {
id -> Int4,
#[max_length = 255]
title -> Varchar,
content -> Text,
commentor -> Int4,
group_id -> Int4,
solution_id -> Int4,
}
}

diesel::table! {
group_join_requests (id) {
id -> Int4,
Expand Down Expand Up @@ -75,13 +87,16 @@ diesel::table! {

diesel::joinable!(assignment_wishes -> groups (group_id));
diesel::joinable!(assignments -> groups (group_id));
diesel::joinable!(code_comments -> groups (group_id));
diesel::joinable!(code_comments -> solutions (solution_id));
diesel::joinable!(group_join_requests -> groups (group_id));
diesel::joinable!(solutions -> assignments (assignment_id));
diesel::joinable!(solutions -> groups (group_id));

diesel::allow_tables_to_appear_in_same_query!(
assignment_wishes,
assignments,
code_comments,
group_join_requests,
groups,
solutions,
Expand Down

0 comments on commit 82be5d0

Please sign in to comment.