Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.
If you're creating a bug/problem report, please include followings:
- ABP Framework version: v5.2.2
- UI type: Blazor
- ABP Suite: Yes
- ABP Suite Version: v5.2.2
- DB provider: EF Core
- Tiered (MVC) or Identity Server Separated (Angular): no
- Soution has Public Web Site project: Yes
- Exception message and stack trace:
- Steps to reproduce the issue:"
I created Solution containg a Blazor App, Web API ({appname}.HttpApi.Host) and Public Website using ABP Suite as shown by the picture below:
At this moment the solution was created with no additional entities. The solution containing multiples projects (Blazor App, Wep API, Public WebSite) was synchronized with Github repository, additionally it was created 3 branches named "Development", "Staging" and "Main" to allow 3 distinct environments for the software lifecycle.
We created the Microsoft Azure WebApps integrated with Github using the standard Azure wizard during the WebApp creation process (using the wizard), and just set manually the project path to the CSPROJ file in the YAML for each project. We created a "Azure Cache for Redis" service in Microsoft Azure to support the "Public Website" considering the documentation requirements to have Redis available for caching the Public Website. We created 3 distinct database instances using Azure SQL Server to support each of 3 environments.
The WebAPI is published on each AzureWebApp pointing to the right database instance.
How can we propagate the Database Migrations when we create or change any Entity using ABP Suite? In the Local Database at my PC where I´m running ABP Suite, the changes were applied automatically by ABP Suite. Once I sync with the remote repository and commit using Github to "Development" branch, the Github automation starts a new deployment to Azure WebApp instance but I could not find a way to apply the changes to remote database instance automatically, the only way I could do this migration was by running manually the project DbMigrator existing in my PC (using DOTNET RUN inside the DbMigrator folder) pointing to the remote Database Instance, applying the changes manually. How can I apply the migration/changes to the Database when the new release of the WebAPI is deployed and is required to update the database instance? Is there any solution embebed WebAPI project to verify the database instance and apply the migrations?
Best regards,
Christian
3 Answer(s)
-
0
hi
You should be able to compile
DbMigrator
in CI/CD and replace the connection string etc, and finally run it. -
0
Hi Folks, I know that the file aspsetting.json can be customized for each environment and the connection string for each environment is already set as the picture below shows:
Similar aspsettings.json file can be prepared to development, production or any other environment. This is not the problem.
The question is: how to make make the WebApi implemented by "{appname}.HttpApi.Host" to understand that there is a migration pending and apply the migration to the Database once the new release is launched in the remote server? Is it possible to refer explain how to implement it? Or is there another strategy recommended by ABP.IO to deploy the application to multiples environments?
-
0
hi
: how to make make the WebApi implemented by "{appname}.HttpApi.Host" to understand that there is a migration pending and apply the migration to the Database once the new release is launched in the remote server?
Maybe you can refer to https://makolyte.com/ef-core-apply-migrations-programmatically/