Browse Source
Merge pull request #7329 from abpframework/migrator-cli-path-whitespace
allow paths to include whitespace in dbmigrator & cli
pull/7330/head
maliming
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
7 additions and
3 deletions
-
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/CreateMigrationAndRunMigrator.cs
-
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs
-
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/Data/MyProjectNameDbMigrationService.cs
|
|
|
@ -26,12 +26,16 @@ namespace Volo.Abp.Cli.Commands |
|
|
|
throw new Exception("DbMigrator is not found!"); |
|
|
|
} |
|
|
|
|
|
|
|
var output = CmdHelper.RunCmdAndGetOutput("cd \"" + commandLineArgs.Target + "\" && dotnet ef migrations add Initial -s " + dbMigratorProjectPath); |
|
|
|
var output = CmdHelper.RunCmdAndGetOutput($"cd \"{commandLineArgs.Target}\" && dotnet ef migrations add Initial -s \"{dbMigratorProjectPath}\""); |
|
|
|
|
|
|
|
if (output.Contains("Done.") && output.Contains("To undo this action") && output.Contains("ef migrations remove")) // Migration added successfully
|
|
|
|
{ |
|
|
|
CmdHelper.RunCmd("cd \"" + Path.GetDirectoryName(dbMigratorProjectPath) + "\" && dotnet run"); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
throw new Exception("Migrations failed: " + output); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private string GetDbMigratorProjectPath(string dbMigrationsFolderPath) |
|
|
|
|
|
|
|
@ -47,7 +47,7 @@ namespace Volo.Abp.Cli.Utils |
|
|
|
{ |
|
|
|
process.StartInfo = new ProcessStartInfo(CmdHelper.GetFileName()) |
|
|
|
{ |
|
|
|
Arguments = CmdHelper.GetArguments(command), |
|
|
|
Arguments = GetArguments(command), |
|
|
|
UseShellExecute = false, |
|
|
|
CreateNoWindow = true, |
|
|
|
RedirectStandardOutput = true, |
|
|
|
|
|
|
|
@ -141,7 +141,7 @@ namespace MyCompanyName.MyProjectName.Data |
|
|
|
} |
|
|
|
|
|
|
|
var procStartInfo = new ProcessStartInfo( fileName, |
|
|
|
$"{argumentPrefix} \"abp create-migration-and-run-migrator {GetDbMigrationsProjectFolderPath()}\"" |
|
|
|
$"{argumentPrefix} \"abp create-migration-and-run-migrator \"{GetDbMigrationsProjectFolderPath()}\"\"" |
|
|
|
); |
|
|
|
|
|
|
|
try |
|
|
|
|