From 7ce6a122f065f68bc4a041d665740b46cf442343 Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Sat, 12 Sep 2020 19:15:31 +0800 Subject: [PATCH 1/2] add entity-framework core quick migration script --- aspnet-core/services/start-apigateway-admin.bat | 5 +++++ aspnet-core/services/start-auth-server.bat | 5 +++++ aspnet-core/services/start-backend-admin.bat | 5 +++++ aspnet-core/services/start-messages.bat | 5 +++++ aspnet-core/services/start-platform.bat | 5 +++++ build/build-aspnetcore-ef-update.ps1 | 11 +++++++++++ 6 files changed, 36 insertions(+) create mode 100644 build/build-aspnetcore-ef-update.ps1 diff --git a/aspnet-core/services/start-apigateway-admin.bat b/aspnet-core/services/start-apigateway-admin.bat index 6246d5321..e6d5e10be 100644 --- a/aspnet-core/services/start-apigateway-admin.bat +++ b/aspnet-core/services/start-apigateway-admin.bat @@ -9,6 +9,7 @@ cd .\apigateway\LINGYUN.ApiGateway.HttpApi.Host if '%1' equ '--publish' goto publish if '%1' equ '--run' goto run if '%1' equ '--restore' goto restore +if '%1' equ '--ef-u' goto efu if '%1' equ '' goto run @@ -23,4 +24,8 @@ exit :restore dotnet restore +exit + +:efu +dotnet ef database update exit \ No newline at end of file diff --git a/aspnet-core/services/start-auth-server.bat b/aspnet-core/services/start-auth-server.bat index 25ed0a9c0..1fbdf3385 100644 --- a/aspnet-core/services/start-auth-server.bat +++ b/aspnet-core/services/start-auth-server.bat @@ -9,6 +9,7 @@ cd .\account\AuthServer.Host if '%1' equ '--publish' goto publish if '%1' equ '--run' goto run if '%1' equ '--restore' goto restore +if '%1' equ '--ef-u' goto efu if '%1' equ '' goto run exit @@ -23,4 +24,8 @@ exit :restore dotnet restore +exit + +:efu +dotnet ef database update exit \ No newline at end of file diff --git a/aspnet-core/services/start-backend-admin.bat b/aspnet-core/services/start-backend-admin.bat index 2da54a63e..36270a632 100644 --- a/aspnet-core/services/start-backend-admin.bat +++ b/aspnet-core/services/start-backend-admin.bat @@ -9,6 +9,7 @@ cd .\admin\LINGYUN.BackendAdminApp.Host if '%1' equ '--publish' goto publish if '%1' equ '--run' goto run if '%1' equ '--restore' goto restore +if '%1' equ '--ef-u' goto efu if '%1' equ '' goto run exit @@ -23,4 +24,8 @@ exit :restore dotnet restore +exit + +:efu +dotnet ef database update exit \ No newline at end of file diff --git a/aspnet-core/services/start-messages.bat b/aspnet-core/services/start-messages.bat index 40bd48840..996884110 100644 --- a/aspnet-core/services/start-messages.bat +++ b/aspnet-core/services/start-messages.bat @@ -9,6 +9,7 @@ cd .\messages\LINGYUN.Abp.MessageService.HttpApi.Host if '%1' equ '--publish' goto publish if '%1' equ '--run' goto run if '%1' equ '--restore' goto restore +if '%1' equ '--ef-u' goto efu if '%1' equ '' goto run exit @@ -23,4 +24,8 @@ exit :restore dotnet restore +exit + +:efu +dotnet ef database update exit \ No newline at end of file diff --git a/aspnet-core/services/start-platform.bat b/aspnet-core/services/start-platform.bat index 0a8436521..cb4ec6e3b 100644 --- a/aspnet-core/services/start-platform.bat +++ b/aspnet-core/services/start-platform.bat @@ -9,6 +9,7 @@ cd .\platform\LINGYUN.Platform.HttpApi.Host if '%1' equ '--publish' goto publish if '%1' equ '--run' goto run if '%1' equ '--restore' goto restore +if '%1' equ '--ef-u' goto efu if '%1' equ '' goto run exit @@ -23,4 +24,8 @@ exit :restore dotnet restore +exit + +:efu +dotnet ef databse update exit \ No newline at end of file diff --git a/build/build-aspnetcore-ef-update.ps1 b/build/build-aspnetcore-ef-update.ps1 new file mode 100644 index 000000000..55dc70a6a --- /dev/null +++ b/build/build-aspnetcore-ef-update.ps1 @@ -0,0 +1,11 @@ +. "./build-aspnetcore-common.ps1" + +# Build all solutions +foreach ($batchCommandPath in $batchCommandPaths) { + $file = [io.fileinfo]$batchCommandPath; + Write-Host $file.DirectoryName + Set-Location $file.DirectoryName + CMD /c $file.Name --ef-u -Wait +} + +Set-Location $rootFolder \ No newline at end of file From 22b038493b1fe533607d8fbf8bcbd4e0d2fe6234 Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Sat, 12 Sep 2020 19:22:20 +0800 Subject: [PATCH 2/2] Update README.md --- README.en.md | 8 ++++++++ README.md | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/README.en.md b/README.en.md index fc2b8b3ae..babd72814 100644 --- a/README.en.md +++ b/README.en.md @@ -233,6 +233,12 @@ VUE_APP_CLIENT_SECRET = '1q2w3e*' ``` +### Initializes appsettings.json + +In directory **./aspnet-core/configuration** ,Copy the given settings file to your own project directory (only if you are cloning the repository for the first time) + +Make sure the configuration file is the same as the connection configuration of your development environment middleware, such as RabbitMQ, MySql, Redis, and so on + ### EntityFramework migration Please switch to the service project startup directory and execute the **dotnet EF ** command for database migration @@ -247,6 +253,8 @@ dotnet ef database update ``` +- You can also use quick migration script files: **./build/build-aspnetcore-ef-update.ps1** + ### Initializes the apigateway database diff --git a/README.md b/README.md index 480a69186..8cc2e80dd 100644 --- a/README.md +++ b/README.md @@ -242,6 +242,12 @@ VUE_APP_CLIENT_SECRET = '1q2w3e*' ``` +### 初始化 appsettings.json + +当前所有启动项目配置存储在 **./aspnet-core/configuration** 目录,请按照给定的项目名称复制到自己的项目目录(仅在您第一次克隆此仓库是这样做) + +确保配置文件与您的开发环境中间件的连接配置相同,例如RabbitMQ、MySql、Redis等 + ### EntityFramework 迁移 请切换到服务项目启动目录, 执行 **dotnet ef** 命令进行数据库迁移 @@ -255,6 +261,8 @@ dotnet ef database update ``` +- 也可以使用快速迁移脚本文件: **./build/build-aspnetcore-ef-update.ps1** + ### 初始化网关数据库