python-discord / api

A FastAPI-based service that allows our services to communicatie with our database.
MIT License
10 stars 1 forks source link

Move to asyncpg instead of psycopg #29

Closed ChrisLovering closed 2 years ago

ChrisLovering commented 2 years ago

This PR moves our migrations to asyncpg, adds a docker volume for migrations and adds a helper task for generating those migrations.

Simply by running poetry run task revision "Migration message here." while the docker containers are running, a migration will be generated.

Something to keep in mind is that, now that we are using asyncpg, no database validation can be run within Pydantic models. This now needs to be deferred to the routes that need that validation instead.

D0rs4n commented 2 years ago

Looks fine, the bogus DATABASE_URL in the CI has to be changed. It was added because of the Pydantic configuration, I'll resolve all of those problems in my next PR, but it has to be updated in order for the tests to pass. Thank you!