CHANGE sql schema

This commit is contained in:
Esa Kataja
2025-05-05 18:30:22 +03:00
parent 6706abfc97
commit bf7c969629
+2 -2
View File
@@ -91,7 +91,7 @@ CREATE TABLE Review (
song_id INTEGER NOT NULL, -- Foreign Key -> Song.id song_id INTEGER NOT NULL, -- Foreign Key -> Song.id
score_song INTEGER NOT NULL, -- Score (1-100) for song quality score_song INTEGER NOT NULL, -- Score (1-100) for song quality
score_show INTEGER NOT NULL, -- Score (1-100) for the stage show score_show INTEGER NOT NULL, -- Score (1-100) for the stage show
score_wardrobe INTEGER NOT NULL, -- Score (1-100) for wardrobe/costumes score_costume INTEGER NOT NULL, -- Score (1-100) for wardrobe/costumes
text_review VARCHAR, -- Optional textual comments (nullable) text_review VARCHAR, -- Optional textual comments (nullable)
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, -- Timestamp when the review was created created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, -- Timestamp when the review was created
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, -- Timestamp when the review was last modified updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, -- Timestamp when the review was last modified
@@ -102,7 +102,7 @@ CREATE TABLE Review (
-- Ensure scores are within the valid range (1-100) -- Ensure scores are within the valid range (1-100)
CHECK (score_song >= 1 AND score_song <= 100), CHECK (score_song >= 1 AND score_song <= 100),
CHECK (score_show >= 1 AND score_show <= 100), CHECK (score_show >= 1 AND score_show <= 100),
CHECK (score_wardrobe >= 1 AND score_wardrobe <= 100), CHECK (score_costume >= 1 AND score_costume <= 100),
-- Ensure each user can only submit one review per song -- Ensure each user can only submit one review per song
UNIQUE (user_id, song_id) UNIQUE (user_id, song_id)