From e999c37947f81333e1d0be6db0ac1e43c36f4ea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 20 Nov 2020 15:58:33 +0300 Subject: [PATCH 1/2] Update Upgrading.md --- docs/en/Upgrading.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/en/Upgrading.md b/docs/en/Upgrading.md index 1140c5d573..ee4aa60c20 100644 --- a/docs/en/Upgrading.md +++ b/docs/en/Upgrading.md @@ -16,6 +16,15 @@ Run this command in the terminal while you are in the root folder of your soluti > If your solution has the Angular UI, you probably have `aspnet-core` and `angular` folders in the solution. Run this command in the parent folder of these two folders. +### Database Migrations + +When you upgrade to a new version, it is good to check if there is a database schema change and upgrade your database schema if your database provider is **Entity Framework Core**; + +* Use `Add-Migration "Upgraded_To_Abp_4_1"` or a similar command in the Package Manager Console (PMC) to create a new migration (Set the `EntityFrameworkCore.DbMigrations` as the Default project in the PMC and `.DbMigrator` as the Startup Project in the Solution Explorer, in the Visual Studio). +* Run the `.DbMigrator` application to upgrade the database and seed the initial data. + +If `Add-Migration` generates an empty migration, you can use `Remove-Migration` to delete it before executing the `.DbMigrator`. + ## The Blog Posts Sometimes we introduce new features/changes that requires to make changes in the startup template. We already implement the changes in the startup template for new applications. However, in some cases you need to manually make some minor changes in your solution. From 4f646ab784b626b5dfeab52c170a5dcfe864efd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 20 Nov 2020 16:00:57 +0300 Subject: [PATCH 2/2] Update Upgrading.md --- docs/en/Upgrading.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/en/Upgrading.md b/docs/en/Upgrading.md index ee4aa60c20..884b0bbcd0 100644 --- a/docs/en/Upgrading.md +++ b/docs/en/Upgrading.md @@ -18,6 +18,8 @@ Run this command in the terminal while you are in the root folder of your soluti ### Database Migrations +> Warning: Be careful if you are migrating your database since you may have data loss in some cases. Carefully check the generated migration code before executing it. It is suggested to take a backup of your current database. + When you upgrade to a new version, it is good to check if there is a database schema change and upgrade your database schema if your database provider is **Entity Framework Core**; * Use `Add-Migration "Upgraded_To_Abp_4_1"` or a similar command in the Package Manager Console (PMC) to create a new migration (Set the `EntityFrameworkCore.DbMigrations` as the Default project in the PMC and `.DbMigrator` as the Startup Project in the Solution Explorer, in the Visual Studio).