osu-tournament-rating / otr-api

API powering osu! Tournament Rating
https://otr.stagec.xyz/
GNU General Public License v3.0
8 stars 5 forks source link

Identify and implement a more reliable method of applying database migrations for deployments #375

Closed myssto closed 1 month ago

myssto commented 2 months ago

Currently the API is responsible for applying database migrations via the context during startup. This worked perfectly fine for a monolithic architecture where we knew that the API was the only point of access for the database. Now that we are deploying multiple microservices that will be accessing the database independently of each other, this method can create problems if a microservice is expecting a certain database schema before the API is able to perform a migration during deployment (think race conditions). This specific strategy is documented here in the EF Core documentation.

hburn7 commented 1 month ago

We now use EF migration scripts, documented here. https://docs.otr.stagec.xyz/database-setup-backup-and-recovery.html#migrations