diff --git a/backend/OLA.mysql b/backend/OLA.mysql index 0d38095..ce8efea 100644 --- a/backend/OLA.mysql +++ b/backend/OLA.mysql @@ -1,6 +1,6 @@ # Script de creation de la structure de la base OLA (a executer en root) -- INSTALLER LA DERNIERE VERSION DE MARIADB --- LANCER CE SCRIPT AVEC LA COMMANDE : mysql -u root < ola_export.mysql +-- LANCER CE SCRIPT AVEC LA COMMANDE : mysql -u root < OLA.mysql # Create schemas and users CREATE DATABASE IF NOT EXISTS OLA CHARACTER SET utf8 COLLATE utf8_general_ci; @@ -73,22 +73,21 @@ CREATE TABLE IF NOT EXISTS LIVRET CREATE TABLE IF NOT EXISTS PERIOD ( - livret_id BIGINT NOT NULL, - num INT NOT NULL, - `type` INT, - `start` DATE, - `end` DATE, - student_desc TEXT, - etutor_desc TEXT, + id BIGINT NOT NULL AUTO_INCREMENT, + livret_id BIGINT NOT NULL, + `type` INT, + `start` DATE, + `end` DATE, + student_desc TEXT, + etutor_desc TEXT, ressources_dir VARCHAR(512), - PRIMARY KEY(livret_id, num) + PRIMARY KEY (id) ) ENGINE = INNODB; CREATE TABLE IF NOT EXISTS HASHTABLE ( token VARCHAR(255) NOT NULL, exipre DATE NOT NULL, - livret BIGINT NOT NULL, period INT NOT NULL, PRIMARY KEY(token) ) ENGINE = INNODB; @@ -130,17 +129,16 @@ ALTER TABLE LIVRET ON DELETE CASCADE ON UPDATE CASCADE ; - -ALTER TABLE HASHTABLE - ADD FOREIGN KEY (livret) - REFERENCES PERIOD(livret_id) + +ALTER TABLE PERIOD + ADD FOREIGN KEY (livret_id) +REFERENCES LIVRET (id) ON DELETE CASCADE - ON UPDATE CASCADE -; + ON UPDATE CASCADE; ALTER TABLE HASHTABLE - ADD FOREIGN KEY (livret, period) - REFERENCES PERIOD(livret_id, num) + ADD FOREIGN KEY (period) +REFERENCES PERIOD (id) ON DELETE CASCADE ON UPDATE CASCADE ; diff --git a/backend/README.md b/backend/README.md index 220a436..5d125d9 100644 --- a/backend/README.md +++ b/backend/README.md @@ -47,7 +47,7 @@ Installez la dernière version de MariaDB. Lancer le script : ``` - mysql -u root < ola_export.mysql + mysql -u root < OLA.mysql ``` diff --git a/backend/app/config.py.example b/backend/app/config.py.example index e46de8e..c8b8c73 100644 --- a/backend/app/config.py.example +++ b/backend/app/config.py.example @@ -35,7 +35,7 @@ class Prod(Config): class Debug(Config): DEBUG = True SESSION_COOKIE_SECURE = False - SQLALCHEMY_DATABASE_URI = 'mysql://ola:ola@localhost/OLA' + SQLALCHEMY_DATABASE_URI = 'mysql://ola:XXX@localhost/OLA' class Test(Config): diff --git a/backend/app/core.py b/backend/app/core.py index 8d621a2..a36f4b8 100644 --- a/backend/app/core.py +++ b/backend/app/core.py @@ -1,13 +1,12 @@ import importlib from datetime import timedelta +from app.config import Config from flask import Flask, session from flask_restful import Api from flask_sqlalchemy import SQLAlchemy from sqlalchemy import create_engine from sqlalchemy.ext.automap import automap_base -from app.config import Config - # initialization Flask app = Flask(__name__)