Update sql scripts for creating and seeding db

This commit is contained in:
Esa Kataja
2025-02-24 20:47:46 +02:00
parent bfcfd9d1a4
commit a7cba19ed1
2 changed files with 83 additions and 86 deletions
+40 -43
View File
@@ -1,47 +1,44 @@
-- Insert test data into Groups Table
INSERT INTO groups (id, group_name, created_at, modified_at)
VALUES
('00000000-0000-0000-0000-000000000001', 'Admins', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
('00000000-0000-0000-0000-000000000002', 'Judges Group A', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
('00000000-0000-0000-0000-000000000003', 'Judges Group B', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
-- Seed UserGroup
INSERT INTO UserGroup (id, group_name) VALUES
('00000000-0000-0000-0000-000000000001', 'Admins'),
('00000000-0000-0000-0000-000000000002', 'Judges Group A'),
('00000000-0000-0000-0000-000000000003', 'Judges Group B');
-- Insert test data into Users Table
INSERT INTO users (id, name, username, email, group_id, password, last_login_time, is_admin, is_active, created_at, modified_at)
VALUES
('11111111-1111-1111-1111-111111111111', 'Alice Admin', 'alice_admin', 'alice.admin@example.com', '00000000-0000-0000-0000-000000000001', 'hashed_password_1', CURRENT_TIMESTAMP, TRUE, TRUE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
('22222222-2222-2222-2222-222222222222', 'Bob Judge', 'bob_judge', '[email protected]', '00000000-0000-0000-0000-000000000002', 'hashed_password_2', CURRENT_TIMESTAMP, FALSE, TRUE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
('33333333-3333-3333-3333-333333333333', 'Charlie Reviewer', 'charlie_reviewer', '[email protected]', '00000000-0000-0000-0000-000000000003', 'hashed_password_3', CURRENT_TIMESTAMP, FALSE, TRUE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
('44444444-4444-4444-4444-444444444444', 'Dana Inactive', 'dana_inactive', NULL, '00000000-0000-0000-0000-000000000003', 'hashed_password_4', NULL, FALSE, FALSE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
-- Seed Users
INSERT INTO User (id, username, email, group_id, hashed_password, is_active) VALUES
('11111111-1111-1111-1111-111111111111', 'harsh_critic', NULL, '00000000-0000-0000-0000-000000000001', '$2b$12$EixZaYVK1fsbw1ZfbX3OXePaWxn96p36WQoeG6Lruj3vjPGga31lW', true),
('22222222-2222-2222-2222-222222222222', 'positive_pat', 'pat@example.com', '00000000-0000-0000-0000-000000000002', '$2b$12$EixZaYVK1fsbw1ZfbX3OXePaWxn96p36WQoeG6Lruj3vjPGga31lW', true),
('33333333-3333-3333-3333-333333333333', 'neutral_nancy', NULL, '00000000-0000-0000-0000-000000000003', '$2b$12$EixZaYVK1fsbw1ZfbX3OXePaWxn96p36WQoeG6Lruj3vjPGga31lW', false);
-- Insert test data into Contests Table
INSERT INTO contests (id, city_name, date, round, is_active, created_at, modified_at)
VALUES
('55555555-5555-5555-5555-555555555555', 'Stockholm', '2023-05-14', 'Final', TRUE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
('66666666-6666-6666-6666-666666666666', 'Copenhagen', '2023-05-10', '1st semifinal', FALSE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
('77777777-7777-7777-7777-777777777777', 'Oslo', '2023-05-12', '2nd semifinal', FALSE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
-- Seed Contests
INSERT INTO Contest (id, city_name, date, round, is_active) VALUES
('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa', 'Rotterdam', '2024-05-10', 'Final', true),
('bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'Stockholm', '2025-03-15', '1st Semifinal', false);
-- Insert test data into Songs Table
INSERT INTO songs (id, artist_name, song_title, country, lyrics, song_meaning, created_at, modified_at)
VALUES
('88888888-8888-8888-8888-888888888888', 'Artist A', 'Song of Hope', 'Sweden', NULL, 'This song represents resilience and hope.', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
('99999999-9999-9999-9999-999999999999', 'Artist B', 'Ballad of Love', 'Denmark', 'Lyrics about love...', 'A romantic ballad.', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa', 'Artist C', 'Dance with Me', 'Norway', NULL, 'A fun and energetic dance track.', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
-- Seed Songs (6 entries across 2 contests)
INSERT INTO Song (id, contest_id, artist_name, song_title, country, tags) VALUES
-- Rotterdam Final
('cccccccc-cccc-cccc-cccc-cccccccccccc', 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa', 'Loreen', 'Tattoo', 'Sweden', ['obsession', 'eternity']),
('dddddddd-dddd-dddd-dddd-dddddddddddd', 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa', 'Måneskin', 'Zitti e buoni', 'Italy', ['rebellion', 'youth']),
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa', 'Kalush Orchestra', 'Stefania', 'Ukraine', ['family', 'war']),
-- Stockholm Semifinal
('ffffffff-ffff-ffff-ffff-ffffffffffff', 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'Käärijä', 'Cha Cha Cha', 'Finland', ['alcohol', 'social pressure']),
('gggggggg-gggg-gggg-gggg-gggggggggggg', 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'KEiiNO', 'Spirit in the Sky', 'Norway', ['nature', 'tradition']),
('hhhhhhhh-hhhh-hhhh-hhhh-hhhhhhhhhhhh', 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'Blanca Paloma', 'Eaea', 'Spain', ['mysticism', 'ritual']);
-- Insert test data into Reviews Table
-- Each user reviews each song with dramatic variations in scores
INSERT INTO reviews (id, contest_id, song_id, reviewer_id, song_score, wardrobe_score, stage_show_score, review_text, created_at, modified_at)
VALUES
-- Reviews by Alice Admin (Group: Admins)
('11111111-0000-0000-0000-000000000001', '55555555-5555-5555-5555-555555555555', '88888888-8888-8888-8888-888888888888', '11111111-1111-1111-1111-111111111111', 95, 10, 80, 'Amazing song, but the wardrobe choice was absolutely terrible.', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
('11111111-0000-0000-0000-000000000002', '55555555-5555-5555-5555-555555555555', '99999999-9999-9999-9999-999999999999', '11111111-1111-1111-1111-111111111111', 88, 95, 25, 'The song and wardrobe were great, but the stage show was far too chaotic.', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
('11111111-0000-0000-0000-000000000003', '55555555-5555-5555-5555-555555555555', 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa', '11111111-1111-1111-1111-111111111111', 40, 70, 15, 'I didnt connect with the song, and the show was awkward.', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
-- Reviews by Bob Judge (Group: Judges Group A)
('22222222-0000-0000-0000-000000000001', '55555555-5555-5555-5555-555555555555', '88888888-8888-8888-8888-888888888888', '22222222-2222-2222-2222-222222222222', 70, 65, 90, 'The stage show carried the performance, but the song was mediocre.', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
('22222222-0000-0000-0000-000000000002', '55555555-5555-5555-5555-555555555555', '99999999-9999-9999-9999-999999999999', '22222222-2222-2222-2222-222222222222', 20, 80, 85, 'I really disliked the song, but the wardrobe and show were solid.', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
('22222222-0000-0000-0000-000000000003', '55555555-5555-5555-5555-555555555555', 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa', '22222222-2222-2222-2222-222222222222', 85, 30, 75, 'The wardrobe was distracting, but the song and show were decent.', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
-- Reviews by Charlie Reviewer (Group: Judges Group B)
('33333333-0000-0000-0000-000000000001', '55555555-5555-5555-5555-555555555555', '88888888-8888-8888-8888-888888888888', '33333333-3333-3333-3333-333333333333', 15, 90, 20, 'The wardrobe was stunning, but I absolutely hated the song.', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
('33333333-0000-0000-0000-000000000002', '55555555-5555-5555-5555-555555555555', '99999999-9999-9999-9999-999999999999', '33333333-3333-3333-3333-333333333333', 65, 85, 10, 'Wardrobe and song were fine, but the show was offensive.', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
('33333333-0000-0000-0000-000000000003', '55555555-5555-5555-5555-555555555555', 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa', '33333333-3333-3333-3333-333333333333', 92, 25, 88, 'The song was fantastic, but the wardrobe looked cheap.', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
-- Seed Reviews (10 entries with wide score ranges)
INSERT INTO Reviews (song_id, reviewer_id, song_score, wardrobe_score, stage_show_score, review_text) VALUES
-- Rotterdam Reviews
('cccccccc-cccc-cccc-cccc-cccccccccccc', '11111111-1111-1111-1111-111111111111', 15, 20, 10, 'Overrated ballad, staging looked like a screensaver'),
('cccccccc-cccc-cccc-cccc-cccccccccccc', '22222222-2222-2222-2222-222222222222', 98, 95, 99, 'A masterpiece! Vocals gave me chills'),
('dddddddd-dddd-dddd-dddd-dddddddddddd', '33333333-3333-3333-3333-333333333333', 65, 70, 75, NULL),
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '22222222-2222-2222-2222-222222222222', 88, 82, 90, 'Powerful message, but staging needed more polish'),
-- Stockholm Reviews
('ffffffff-ffff-ffff-ffff-ffffffffffff', '11111111-1111-1111-1111-111111111111', 10, 95, 15, 'Vocally disastrous but fashion-forward'),
('ffffffff-ffff-ffff-ffff-ffffffffffff', '22222222-2222-2222-2222-222222222222', 85, 90, 88, 'Pure energy! Crowd loved it'),
('gggggggg-gggg-gggg-gggg-gggggggggggg', '33333333-3333-3333-3333-333333333333', 72, 68, 65, 'Cultural elements were interesting'),
('gggggggg-gggg-gggg-gggg-gggggggggggg', '11111111-1111-1111-1111-111111111111', 40, 35, 50, 'Joik section felt out of place'),
('hhhhhhhh-hhhh-hhhh-hhhh-hhhhhhhhhhhh', '22222222-2222-2222-2222-222222222222', 92, 85, 88, 'Haunting and unique - my dark horse favorite'),
('hhhhhhhh-hhhh-hhhh-hhhh-hhhhhhhhhhhh', '33333333-3333-3333-3333-333333333333', 78, 65, 70, NULL);