Skip to content
Snippets Groups Projects
Commit 0b9ed9b8 authored by Dominika Zemanovičová's avatar Dominika Zemanovičová
Browse files

Add base data initialization

parent 7f46a9f6
No related branches found
No related tags found
1 merge request!34M3 data initialization
Pipeline #
drop table if exists certificate cascade
\ No newline at end of file
INSERT INTO certificate (id_certificate, certificate_file, certificate_file_name, id_course, generated_at, id_user) VALUES (1, 'certificate_file_1.pdf', 'Certificate for Course English A1', 2, '2023-04-29 10:30:00', 7);
INSERT INTO certificate (id_certificate, certificate_file, certificate_file_name, id_course, generated_at, id_user) VALUES (2, 'certificate_file_2.pdf', 'Certificate for Course English A2', 3, '2023-04-28 14:15:00', 7);
INSERT INTO certificate (id_certificate, certificate_file, certificate_file_name, id_course, generated_at, id_user) VALUES (3, 'certificate_file_2.pdf', 'Certificate for Course English A2', 3, '2023-04-28 14:15:00', 9);
INSERT INTO certificate (id_certificate, certificate_file, certificate_file_name, id_course, generated_at, id_user) VALUES (4, 'certificate_file_2.pdf', 'Certificate for Course English B1', 4, '2023-04-28 14:15:00', 7);
INSERT INTO certificate (id_certificate, certificate_file, certificate_file_name, id_course, generated_at, id_user) VALUES (5, 'certificate_file_2.pdf', 'Certificate for Course English B1', 4, '2023-04-28 14:15:00', 9);
ALTER TABLE certificate ALTER COLUMN id_certificate RESTART WITH 6;
\ No newline at end of file
drop table if exists answer cascade
drop table if exists exercise cascade
drop table if exists question cascade
\ No newline at end of file
-- exercise
-- insert into exercise (id, lecture_id, description, difficulty, name) values (default, ?, ?, ?, ?)
INSERT INTO exercise (id, lecture_id, description, difficulty, name) VALUES (1, 7, 'Practice using the present continuous tense.', 3, 'Present Continuous Exercise 1');
INSERT INTO exercise (id, lecture_id, description, difficulty, name) VALUES (2, 7, 'Use the past simple to describe past events.', 6, 'Past Simple Exercise 1');
INSERT INTO exercise (id, lecture_id, description, difficulty, name) VALUES (3, 8, 'Learn vocabulary related to food.', 2, 'Food Vocabulary Exercise 1');
INSERT INTO exercise (id, lecture_id, description, difficulty, name) VALUES (4, 10, 'Practice answering common job interview questions.', 7, 'Job Interview Exercise 1');
INSERT INTO exercise (id, lecture_id, description, difficulty, name) VALUES (5, 2, 'Übung zum Begrüßen und Vorstellen', 2, 'Begrüßung und Vorstellung Übung');
ALTER TABLE exercise ALTER COLUMN id RESTART WITH 6;
-- question
-- insert into question (id, exercise_id, text) values (default, ?, ?)
INSERT INTO question (id, exercise_id, text) VALUES (1, 1, 'What is the correct form of the present continuous tense of "run"?');
INSERT INTO question (id, exercise_id, text) VALUES (2, 1, 'Which verbs are not usually used in the present continuous tense?');
INSERT INTO question (id, exercise_id, text) VALUES (3, 2, 'What did you do last weekend?');
INSERT INTO question (id, exercise_id, text) VALUES (4, 2, 'What did you eat for breakfast this morning?');
INSERT INTO question (id, exercise_id, text) VALUES (5, 2, 'Where did you go on vacation last year?');
INSERT INTO question (id, exercise_id, text) VALUES (6, 3, 'What is the English word for "la comida"?');
INSERT INTO question (id, exercise_id, text) VALUES (7, 4, 'Tell me about yourself.');
INSERT INTO question (id, exercise_id, text) VALUES (8, 4, 'Why are you interested in this job?');
INSERT INTO question (id, exercise_id, text) VALUES (9, 4, 'What are your greatest strengths and weaknesses?');
INSERT INTO question (id, exercise_id, text) VALUES (10, 4, 'Can you give an example of a time when you overcame a challenge?');
INSERT INTO question (id, exercise_id, text) VALUES (11, 4, 'Where do you see yourself in five years?');
INSERT INTO question (id, exercise_id, text) VALUES (12, 5, 'Was ist eine höfliche Begrüßung im Deutschen?');
INSERT INTO question (id, exercise_id, text) VALUES (13, 5, 'Wie antwortet man auf die Frage "Wie geht es Ihnen?"');
INSERT INTO question (id, exercise_id, text) VALUES (14, 5, 'Wie stellt man sich auf Deutsch vor?');
ALTER TABLE question ALTER COLUMN id RESTART WITH 15;
-- answer
-- INSERT INTO answer (is_correct, question_id, text) VALUES (1, 1, 'is running')
INSERT INTO answer (id, question_id, is_correct, text) VALUES (1, 1, true, 'is running');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (2, 1, false, 'are running');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (3, 1, false, 'am running');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (4, 2, true, 'think');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (5, 2, true, 'want');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (6, 2, false, 'love');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (7, 3, true, 'I visited my family.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (8, 3, false, 'I''m visiting my family.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (9, 3, false, 'I will visit my family.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (10, 4, true, 'the food');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (11, 4, false, 'the drink');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (12, 4, false, 'the music');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (13, 5, true, 'I ate cereal for breakfast.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (14, 5, false, 'I eat cereal for breakfast.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (15, 5, false, 'I will eat cereal for breakfast.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (16, 6, true, 'I went to Hawaii on vacation last year.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (17, 6, false, 'I''m going to Hawaii on vacation next year.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (18, 6, false, 'I will go to Hawaii on vacation next year.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (19, 7, false, 'I was born in a small town in the midwest.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (20, 7, false, 'I graduated from XYZ University with a degree in computer science.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (21, 7, true, 'I have over five years of experience in software development.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (22, 8, false, 'I just need a job.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (23, 8, true, 'I am excited about the company culture and the opportunities for growth.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (24, 8, false, 'I heard the salary is good.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (25, 9, true, 'My greatest strength is my attention to detail. My greatest weakness is public speaking.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (26, 9, false, 'My greatest strength is my ability to multitask. My greatest weakness is that I am a perfectionist.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (27, 9, false, 'My greatest strength is my leadership skills. My greatest weakness is that I work too hard.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (28, 10, true, 'When I was working on a project for a client, the client requested changes that were outside the scope of the project. I had to work with the client to manage their expectations and negotiate a compromise.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (29, 10, false, 'When I was in college, I had a difficult time balancing my coursework and my social life. I had to learn how to manage my time better.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (30, 10, false, 'I have never faced a significant challenge in my professional life.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (31, 11, false, 'I see myself in a management position, leading a team of developers.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (32, 11, true, 'I see myself as a valuable contributor to the company, continuing to develop my skills and taking on new challenges.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (33, 12, true, 'Guten Tag!');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (34, 12, false, 'Hallo!');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (35, 12, false, 'Moin!');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (36, 13, true, 'Mir geht es gut, danke!');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (37, 13, false, 'Mir geht es schlecht, danke!');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (38, 13, false, 'Mir geht es so lala.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (39, 14, true, 'Ich heiße [Name].');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (40, 14, false, 'Ich bin [Name].');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (41, 14, false, 'Ich komme aus [Land].');
ALTER TABLE answer ALTER COLUMN id RESTART WITH 42;
\ No newline at end of file
server.port=5000 server.port=5000
spring.jpa.open-in-view=false spring.jpa.open-in-view=false
spring.datasource.url=jdbc:h2:mem:social-network;MODE=PostgreSQL spring.h2.console.enabled=true
spring.datasource.url=jdbc:h2:mem:school
spring.datasource.driverClassName=org.h2.Driver spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=SedaQ-app spring.datasource.username=sa
spring.datasource.password=$argon2id$v=19$m=16,t=2,p=1$YmF0bWFuYmF0bWFu$MdHYB359HdivAb9J6CaILw
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
# showing SQL is generally good practice for running project locally to check whether there is not an issue with implementation of JPA methods. # showing SQL is generally good practice for running project locally to check whether there is not an issue with implementation of JPA methods.
spring.jpa.show-sql=true spring.jpa.show-sql=true
......
drop table if exists course cascade
drop table if exists course_students cascade
drop table if exists domain_user cascade
drop table if exists lecture cascade
drop table if exists lecture_students cascade
drop table if exists user_course cascade
drop table if exists user_language_proficiency cascade
\ No newline at end of file
-- I add ids manually, so I can better see what data are related
-- LANGUAGE
-- 0 - english
-- 1 - german
-- 2 - spanish
-- 3 - czech
-- PROFICIENCY
-- 0 - A1
-- 1 - A2
-- 2 - B1
-- 3 - B2
-- 4 - C1
-- 5 - C2
-- 6 - C1N
-- 7 - C2N
-- USER
-- admin
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (1, 'New York', 'USA', 123, 'Main Street', '10001', 'john.doe@example.com', 'John', 'Doe', 'password123', 'ADMIN', 'johndoe');
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (2, 'Los Angeles', 'USA', 456, 'Broadway', '90012', 'jane.smith@example.com', 'Jane', 'Smith', 'password123', 'ADMIN', 'janesmith');
-- lecturer
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (3, 'Los Angeles', 'USA', 456, 'Hollywood Blvd', '90028', 'jane.smith@example.com', 'Jane', 'Smith', 'password123', 'LECTURER', 'janesmith');
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (4, 'London', 'UK', 789, 'Baker St', 'NW1 6XE', 'michael.jones@example.com', 'Michael', 'Jones', 'password123', 'LECTURER', 'michaeljones');
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (5, 'Paris', 'France', 456, 'Champs-Élysées', '75008', 'claire.dupont@example.com', 'Claire', 'Dupont', 'password123', 'LECTURER', 'clairedupont');
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (6, 'Berlin', 'Germany', 123, 'Friedrichstrasse', '10117', 'max.mustermann@example.com', 'Max', 'Mustermann', 'password123', 'LECTURER', 'maxmustermann');
-- student
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (7, 'New York', 'USA', 100, 'Fifth Ave', '10019', 'samuel.smith@example.com', 'Samuel', 'Smith', 'password123', 'STUDENT', 'samuelsmith');
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (8, 'Los Angeles', 'USA', 789, 'Sunset Blvd', '90046', 'jessica.nguyen@example.com', 'Jessica', 'Nguyen', 'password123', 'STUDENT', 'jessicanguyen');
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (9, 'London', 'UK', 234, 'Oxford St', 'W1C 1JG', 'peter.hansen@example.com', 'Peter', 'Hansen', 'password123', 'STUDENT', 'peterhansen');
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (10, 'Paris', 'France', 15, 'Rue de Rivoli', '75001', 'lucie.dupont@example.com', 'Lucie', 'Dupont', 'password123', 'STUDENT', 'luciedupont');
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (11, 'Berlin', 'Germany', 45, 'Unter den Linden', '10117', 'hans.schmidt@example.com', 'Hans', 'Schmidt', 'password123', 'STUDENT', 'hansschmidt');
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (12, 'New York', 'USA', 456, 'Broadway', '10003', 'emma.jones@example.com', 'Emma', 'Jones', 'password123', 'STUDENT', 'emmajones');
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (13, 'London', 'UK', 22, 'Baker Street', 'W1U 3BW', 'oliver.smith@example.com', 'Oliver', 'Smith', 'password123', 'STUDENT', 'oliversmith');
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (14, 'Madrid', 'Spain', 18, 'Calle Mayor', '28013', 'laura.garcia@example.com', 'Laura', 'Garcia', 'password123', 'STUDENT', 'lauragarcia');
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (15, 'Berlin', 'Germany', 32, 'Torstrasse', '10119', 'felix.mueller@example.com', 'Felix', 'Mueller', 'password123', 'STUDENT', 'felixmueller');
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (16, 'Paris', 'France', 5, 'Rue de Rivoli', '75001', 'emilie.dupont@example.com', 'Emilie', 'Dupont', 'password123', 'STUDENT', 'emiliedupont');
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (17, 'Bratislava', 'Slovakia', 123, 'Main Street', '12345', 'pkovac@example.com', 'Peter', 'Kovac', 'password123', 'STUDENT', 'peterkovac');
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (18, 'Brno', 'Czechia', 123, 'Main Street', '12345', 'prachar@example.com', 'David', 'Prachar', 'password123', 'STUDENT', 'davidprachar');
ALTER TABLE domain_user ALTER COLUMN id RESTART WITH 19;
-- language_proficiency
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (3, 0, 6);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (4, 0, 7);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (4, 2, 4);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (5, 2, 5);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (5, 3, 6);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (6, 1, 7);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (7, 0, 4);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (8, 1, 3);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (9, 0, 2);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (10, 3, 4);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (11, 3, 3);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (12, 2, 1);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (13, 2, 1);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (14, 2, 1);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (15, 1, 1);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (16, 1, 1);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (17, 1, 1);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (18, 1, 1);
-- COURSE
INSERT INTO course (id, capacity, finished, language, name, proficiency) VALUES (1, 25, false, 'GERMAN', 'German for Beginners', 'A1');
INSERT INTO course (id, capacity, finished, language, name, proficiency) VALUES (2, 25, false, 'ENGLISH', 'English A1', 'A1');
INSERT INTO course (id, capacity, finished, language, name, proficiency) VALUES (3, 25, false, 'ENGLISH', 'English A2', 'A2');
INSERT INTO course (id, capacity, finished, language, name, proficiency) VALUES (4, 25, false, 'ENGLISH', 'English B1', 'B1');
INSERT INTO course (id, capacity, finished, language, name, proficiency) VALUES (5, 25, false, 'ENGLISH', 'English B2', 'B2');
INSERT INTO course (id, capacity, finished, language, name, proficiency) VALUES (6, 25, false, 'SPANISH', 'Spanish B1', 'B1');
ALTER TABLE course ALTER COLUMN id RESTART WITH 4;
-- COURSE-USER
INSERT INTO user_course (student_id, course_id) VALUES (8, 1);
INSERT INTO user_course (student_id, course_id) VALUES (15, 1);
INSERT INTO user_course (student_id, course_id) VALUES (16, 1);
INSERT INTO user_course (student_id, course_id) VALUES (17, 1);
INSERT INTO user_course (student_id, course_id) VALUES (18, 1);
INSERT INTO user_course (student_id, course_id) VALUES (7, 2);
INSERT INTO user_course (student_id, course_id) VALUES (7, 3);
INSERT INTO user_course (student_id, course_id) VALUES (9, 3);
INSERT INTO user_course (student_id, course_id) VALUES (7, 4);
INSERT INTO user_course (student_id, course_id) VALUES (9, 4);
INSERT INTO user_course (student_id, course_id) VALUES (7, 5);
INSERT INTO user_course (student_id, course_id) VALUES (9, 5);
-- LECTURE
insert into lecture (id, capacity, course_id, lecture_from, lecture_to, lecturer_id, topic) values (1, 25, 1, '2023-05-02 10:00:00', '2023-05-02 12:00:00', 6, 'Introduction to course')
insert into lecture (id, capacity, course_id, lecture_from, lecture_to, lecturer_id, topic) values (2, 25, 1, '2023-05-04 10:00:00', '2023-05-04 12:00:00', 6, 'Begrüßung und Vorstellung')
insert into lecture (id, capacity, course_id, lecture_from, lecture_to, lecturer_id, topic) values (3, 25, 1, '2023-05-09 10:00:00', '2023-05-09 12:00:00', 6, 'Mein Wohnort und meine Wohnung')
insert into lecture (id, capacity, course_id, lecture_from, lecture_to, lecturer_id, topic) values (4, 25, 1, '2023-05-11 10:00:00', '2023-05-11 12:00:00', 6, 'Essen und Trinken')
insert into lecture (id, capacity, course_id, lecture_from, lecture_to, lecturer_id, topic) values (5, 25, 1, '2023-05-16 10:00:00', '2023-05-16 12:00:00', 6, 'Meine Familie und Freunde')
insert into lecture (id, capacity, course_id, lecture_from, lecture_to, lecturer_id, topic) values (6, 25, 5, '2023-05-01 10:00:00', '2023-05-01 12:00:00', 3, 'Introduction to course')
insert into lecture (id, capacity, course_id, lecture_from, lecture_to, lecturer_id, topic) values (7, 25, 5, '2023-05-06 10:00:00', '2023-05-06 12:00:00', 3, 'Repetition of english times')
insert into lecture (id, capacity, course_id, lecture_from, lecture_to, lecturer_id, topic) values (8, 25, 5, '2023-05-08 10:00:00', '2023-05-08 12:00:00', 3, 'Food')
insert into lecture (id, capacity, course_id, lecture_from, lecture_to, lecturer_id, topic) values (9, 25, 5, '2023-05-08 10:00:00', '2023-05-08 12:00:00', 3, 'School systems around the world')
insert into lecture (id, capacity, course_id, lecture_from, lecture_to, lecturer_id, topic) values (10, 25, 5, '2023-05-15 10:00:00', '2023-05-15 12:00:00', 3, 'Interview questions')
ALTER TABLE lecture ALTER COLUMN id RESTART WITH 10;
-- lecture-user
INSERT INTO lecture_students (students_id, lecture_id) VALUES (8, 1);
INSERT INTO lecture_students (students_id, lecture_id) VALUES (15, 1);
INSERT INTO lecture_students (students_id, lecture_id) VALUES (16, 1);
INSERT INTO lecture_students (students_id, lecture_id) VALUES (17, 1);
INSERT INTO lecture_students (students_id, lecture_id) VALUES (18, 1);
INSERT INTO lecture_students (students_id, lecture_id) VALUES (7, 6);
INSERT INTO lecture_students (students_id, lecture_id) VALUES (9, 6);
INSERT INTO lecture_students (students_id, lecture_id) VALUES (7, 7);
INSERT INTO lecture_students (students_id, lecture_id) VALUES (9, 7);
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment