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] 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