From c4b8bef7f8e9fa58716d21a47d2ef73c565a50d9 Mon Sep 17 00:00:00 2001 From: al8763be Date: Wed, 20 Mar 2024 22:37:15 +0100 Subject: [PATCH] fix database --- backend/internal/database/migrations/0035_weekly_report.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/internal/database/migrations/0035_weekly_report.sql b/backend/internal/database/migrations/0035_weekly_report.sql index be2a2d3..b0cbe82 100644 --- a/backend/internal/database/migrations/0035_weekly_report.sql +++ b/backend/internal/database/migrations/0035_weekly_report.sql @@ -1,5 +1,5 @@ CREATE TABLE IF NOT EXISTS weekly_reports ( - report_id INTEGER AUTO_INCREMENT UNIQUE, + report_id INTEGER PRIMARY KEY AUTOINCREMENT, user_id INTEGER NOT NULL, project_id INTEGER NOT NULL, week INTEGER NOT NULL, @@ -10,8 +10,8 @@ CREATE TABLE IF NOT EXISTS weekly_reports ( study_time INTEGER, testing_time INTEGER, signed_by INTEGER, + UNIQUE(user_id, project_id, week), FOREIGN KEY (user_id) REFERENCES users(id), FOREIGN KEY (project_id) REFERENCES projects(id), - FOREIGN KEY (signed_by) REFERENCES users(id), - PRIMARY KEY (user_id, project_id, week) + FOREIGN KEY (signed_by) REFERENCES users(id) ); \ No newline at end of file