Skip to content
Snippets Groups Projects
Commit f3641094 authored by quentin.fasler's avatar quentin.fasler
Browse files

edit readme + sql

parent b87273e6
No related branches found
No related tags found
No related merge requests found
Pipeline #30149 failed
# Mini projet Spring boot "TP-QUIZ"
# Starter quiz
## Configuration du projet
Le projet utilise les ressources suivantes situées dans le répertoire `src/main/resources` :
- `docker-compose.yml` : Ce fichier permet de lancer deux conteneurs Docker, l'un pour MariaDB et l'autre pour phpMyAdmin.
- `quiz.sql` : Ce fichier contient le script SQL pour créer la BDD.
- `data.sql` : Ce fichier contient le script SQL pour remplir la bdd.
- `application.properties` : Ce fichier contient la configuration de Spring Boot .
- spring.datasource.* => Configuration pour la connexion a la BDD
- server.servlet.context-path => permet de préfixe les routes par "/api"
- spring.datasource.* => Configuration pour la connexion a la BDD
## Lancer le projet
......@@ -30,7 +26,7 @@ Le projet utilise les ressources suivantes situées dans le répertoire `src/mai
- Mot de passe : root
3. Dans phpMyAdmin, importez le fichier `quiz.sql` pour créer votre schéma de base de données.
3. Dans phpMyAdmin, importez le fichier `quiz.sql` pour créer votre schéma de base de données, puis `data.sql`pour les données.
### Exécution de spring boot
......
spring.datasource.url=jdbc:mariadb://localhost:3307/quiz
spring.datasource.url=jdbc:mariadb://localhost:3308/quiz
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
server.servelt.context-path=/api
This diff is collapsed.
......@@ -3,17 +3,6 @@ CREATE TABLE IF NOT EXISTS categories (
name TEXT NOT NULL UNIQUE
);
INSERT INTO categories (name) VALUES
('Géographie'),
('Histoire'),
('Science'),
('Cinéma'),
('Musique'),
('Sport'),
('Informatique'),
('Cuisine'),
('Littérature'),
('Art');
CREATE TABLE IF NOT EXISTS questions (
id INTEGER PRIMARY KEY AUTO_INCREMENT,
......@@ -36,53 +25,3 @@ CREATE TABLE IF NOT EXISTS users (
lastname TEXT NOT NULL,
email TEXT NOT NULL UNIQUE
);
INSERT INTO questions (question_text, category_id)
VALUES
('Question 1', 1),
('Question 2', 2),
('Question 3', 3),
('Question 4', 1),
('Question 5', 2),
('Question 6', 3),
('Question 7', 1),
('Question 8', 2),
('Question 9', 3),
('Question 10', 1);
-- Insérer 30 réponses dans la table "answers" avec une réponse correcte par question
INSERT INTO answers (answer_text, correct, question_id)
VALUES
('Réponse 1 Question 1', TRUE, 1),
('Réponse 2 Question 1', FALSE, 1),
('Réponse 3 Question 1', FALSE, 1),
('Réponse 1 Question 2', FALSE, 2),
('Réponse 2 Question 2', TRUE, 2),
('Réponse 3 Question 2', FALSE, 2),
('Réponse 1 Question 3', FALSE, 3),
('Réponse 2 Question 3', FALSE, 3),
('Réponse 3 Question 3', TRUE, 3),
('Réponse 1 Question 4', TRUE, 4),
('Réponse 2 Question 4', FALSE, 4),
('Réponse 3 Question 4', FALSE, 4),
('Réponse 1 Question 5', FALSE, 5),
('Réponse 2 Question 5', TRUE, 5),
('Réponse 3 Question 5', FALSE, 5),
('Réponse 1 Question 6', FALSE, 6),
('Réponse 2 Question 6', FALSE, 6),
('Réponse 3 Question 6', TRUE, 6),
('Réponse 1 Question 7', TRUE, 7),
('Réponse 2 Question 7', FALSE, 7),
('Réponse 3 Question 7', FALSE, 7),
('Réponse 1 Question 8', FALSE, 8),
('Réponse 2 Question 8', TRUE, 8),
('Réponse 3 Question 8', FALSE, 8),
('Réponse 1 Question 9', FALSE, 9),
('Réponse 2 Question 9', FALSE, 9),
('Réponse 3 Question 9', TRUE, 9),
('Réponse 1 Question 10', TRUE, 10),
('Réponse 2 Question 10', FALSE, 10),
('Réponse 3 Question 10', FALSE, 10);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment