Browse Source
Refactor variable declaration for exit codes in CLI commands
pull/24685/head
maliming
2 weeks ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
2 changed files with
2 additions and
3 deletions
-
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Internal/RecreateInitialMigrationCommand.cs
-
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/EfCoreMigrationManager.cs
|
|
|
@ -54,8 +54,7 @@ public class RecreateInitialMigrationCommand : IConsoleCommand, ITransientDepend |
|
|
|
separateDbContext = true; |
|
|
|
} |
|
|
|
|
|
|
|
var exitCode = 0; |
|
|
|
CmdHelper.RunCmd("dotnet build", workingDirectory: projectDir, exitCode: out exitCode); |
|
|
|
CmdHelper.RunCmd("dotnet build", workingDirectory: projectDir, exitCode: out var exitCode); |
|
|
|
if (exitCode != 0) |
|
|
|
{ |
|
|
|
Logger.LogError("Build failed for project {Project}. Skipping migration recreation.", csprojFile); |
|
|
|
|
|
|
|
@ -45,12 +45,12 @@ public class EfCoreMigrationManager : ITransientDependency |
|
|
|
string outputDirectory) |
|
|
|
{ |
|
|
|
CmdHelper.RunCmd($"dotnet build", workingDirectory: dbMigrationsProjectFolder, exitCode: out var buildExitCode); |
|
|
|
|
|
|
|
if (buildExitCode != 0) |
|
|
|
{ |
|
|
|
Logger.LogWarning("Dotnet build failed for project folder {ProjectFolder}. Skipping EF Core migration command.", dbMigrationsProjectFolder); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
var dbContextOption = string.IsNullOrWhiteSpace(dbContext) |
|
|
|
? string.Empty |
|
|
|
: $"--context {dbContext}"; |
|
|
|
|