pyronear / pyro-api

Alert Management API for wildfire prevention, detection & monitoring. Built with FastAPI & PostgreSQL
Apache License 2.0
21 stars 9 forks source link

chore: Bumps PG version to 15 to avoid deprecation #297

Closed frgfm closed 11 months ago

frgfm commented 11 months ago

This PR introduces the following modifications:

To upgrade existing DB, I tried locally, you just need to:

on the PG 12.1 (dump only the data, removing the PG version specific aspects, then delete the volume)

docker compose exec -it db pg_dumpall -U mybdsuperuserpyro > my_local_dump.sql
./scripts/pg_extract.sh my_local_dump.sql pyro_api_prod >> upgrade_dump.sql
docker compose down
docker volume rm pyro-api_postgres_data

On the PG 15 (we only run the db so that it stays empty, then we restore the data):

docker compose up db -d
cat upgrade_dump.sql| docker compose exec -T db psql -U mybdsuperuserpyro

This has been added in the CONTRIBUTING (adapted from https://thomasbandt.com/postgres-docker-major-version-upgrade)

codecov[bot] commented 11 months ago

Codecov Report

Merging #297 (e0c2936) into main (5b256b7) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #297   +/-   ##
=======================================
  Coverage   95.17%   95.17%           
=======================================
  Files          66       66           
  Lines        1575     1575           
=======================================
  Hits         1499     1499           
  Misses         76       76           
Flag Coverage Δ
client 100.00% <ø> (ø)
unittests 94.93% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
src/app/api/endpoints/alerts.py 98.63% <ø> (ø)