NIAEFEUP / tts-be

A platform where students can experiment with the possible combination of schedule options they can pick at the start of the semester
https://tts.niaefeup.pt
5 stars 1 forks source link

refactor: use postgres #96

Closed limwa closed 1 month ago

limwa commented 1 month ago

Changes the RDBMS to be PostgreSQL. Needed for niployments.

thePeras commented 1 month ago

uow, well done!

Don't forget to update the README about the phpmyadmin and ports changes.

Do the same data.sql file works without changes?

limwa commented 1 month ago

Don't forget to update the README about the phpmyadmin and ports changes.

Will do! Done!

Do the same data.sql file works without changes?

No, booleans in MySQL are represented using 1 and 0. In postgres, they take the values TRUE and FALSE. Unfortunately, I'm not sure I have the availability to change the scraper on my own to apply these changes. It's something for the @NIAEFEUP/tts team, I think.

limwa commented 1 month ago

I've updated the schema to reflect what is created in the DB when using the models generated by the MySQL version. Currently an error is being thrown when using the data dump on the drive. image

'B' is being used in the year field. Were fields removed/added to the schema, that are outdated in the data dump?

limwa commented 1 month ago

New error image

tomaspalma commented 1 month ago

New error image

This is because in the auto generated schema, the primary key of course_metadata was only one attribute when it should contain 3, that is why it was giving that error.

There other 2 tables with that same error. I fixed it and pushed.

I've tested locally and even with the frontend (although I needed to change the frontend year to 2024 but that is expected and good behaviour) and it was working correctly, even with the mysql dump!