diff --git a/tasky/migrations/2024-10-29-191834_code_comments/down.sql b/tasky/migrations/2024-10-29-191834_code_comments/down.sql new file mode 100644 index 0000000..a432cde --- /dev/null +++ b/tasky/migrations/2024-10-29-191834_code_comments/down.sql @@ -0,0 +1 @@ +DROP TABLE code_comments; diff --git a/tasky/migrations/2024-10-29-191834_code_comments/up.sql b/tasky/migrations/2024-10-29-191834_code_comments/up.sql new file mode 100644 index 0000000..00f5354 --- /dev/null +++ b/tasky/migrations/2024-10-29-191834_code_comments/up.sql @@ -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) +); diff --git a/tasky/src/schema.rs b/tasky/src/schema.rs index c465ff1..6dfeade 100644 --- a/tasky/src/schema.rs +++ b/tasky/src/schema.rs @@ -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, @@ -75,6 +87,8 @@ 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)); @@ -82,6 +96,7 @@ diesel::joinable!(solutions -> groups (group_id)); diesel::allow_tables_to_appear_in_same_query!( assignment_wishes, assignments, + code_comments, group_join_requests, groups, solutions,