<r>In my opinion, it is your first point (Database.Migrate() due startup) that meets mostly our use case. So for me, it`s currently the preferred way to do that.<br/>
<br/>
We have some additional constellations in the starting up process:<br/>
<br/>
- <br/>
<br/>
Docker container locally only (for dev environment and testing for sure)<br/>
<br/>
- <br/>
<br/>
Own startup project which executes the Database.Migrate() part (cause we have more than one project with its own database)<br/>
<br/>
- <br/>
<br/>
Additional project with the actually API website <E>🙂</E><br/>
<br/>
- <br/>
<br/>
Production environment with Azure SQL server (Published and deployed through Azure DevOps pipeline<br/>
<br/>
- <br/>
<br/>
Migrations are created in its own project via dotnet ef ...<br/>
<br/>
dotnet ef migrations add "your migration name" --startup-project "path to your actually API" --context "database context name"<br/>
<br/>
Important:<br/>
you have to change the working directory to the migration project first in order to use another startup project but generate the migration files in the "migration project"<br/>
<br/>
In our case, it works fine with different APIs with their own databases behind the scene.<br/>
<br/>
Regards</r>