-
Notifications
You must be signed in to change notification settings - Fork 1
Database
Juliane Marubayashi edited this page Mar 7, 2022
·
1 revision
This project uses MySql
as database.
The database should define some specific environment variables. An example of variables is well defined at .env.dev:
DEBUG=1
SECRET_KEY=foo
MYSQL_DATABASE=tts
MYSQL_PASSWORD=root
MYSQL_ROOT_PASSWORD=root
MYSQL_HOST=db
MYSQL_PORT=3306
Notice that, since the entire project is running in docker, the
MYSQL_HOST
variable, must be the name of the container which runs the database. To check the name of the container and also the port, check the docker-compose.yaml file in the project root.
To populate the database execute the following steps:
- Run the scrapper to generate the
.sql
files uporto-scrapper-timetable. The latest version considered table was the commit 07e7bc182512cf671eaf77949ee5889a958b6ae8. - After running the program in the previous step, 4 files will be generated:
faculty.sql
,course.sql
,course_unit.sql
andschedule.sql
. - You must copy these files into the mysql/sql/ folder and rename the files respectively to:
1_faculty.sql
,2_course.sql
,3_course_unit.sql
and4_schedule.sql
. On this way the backend can load the files in a specific order.
After following the previous points, the next time you execute the database it will be populated with the correct information.
!Important!: as mentioned in the README, it may be necessary to execute the docker-compose up
command more than once, in order to get the data loaded.