Browse Source

Merge pull request #12226 from abpframework/volo/issues/9728

Cli: Use `workingDirectory` for migration commands after module adding
pull/12233/head
liangshiwei 4 years ago
committed by GitHub
parent
commit
41f8b41777
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/EfCoreMigrationManager.cs
  2. 2
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs

5
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/EfCoreMigrationManager.cs

@ -48,9 +48,10 @@ public class EfCoreMigrationManager : ITransientDependency
? string.Empty ? string.Empty
: $"--context {dbContext}"; : $"--context {dbContext}";
CmdHelper.RunCmd($"cd \"{dbMigrationsProjectFolder}\" && dotnet ef migrations add {migrationName}" + CmdHelper.RunCmd($"dotnet ef migrations add {migrationName}" +
$" --output-dir {outputDirectory}" + $" --output-dir {outputDirectory}" +
$" {dbContextOption}"); $" {dbContextOption}",
workingDirectory: dbMigrationsProjectFolder);
} }
protected virtual string ParseModuleName(string fullModuleName) protected virtual string ParseModuleName(string fullModuleName)

2
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs

@ -679,7 +679,7 @@ public class SolutionModuleAdder : ITransientDependency
if (!string.IsNullOrEmpty(dbMigratorProject)) if (!string.IsNullOrEmpty(dbMigratorProject))
{ {
CmdHelper.RunCmd("cd \"" + Path.GetDirectoryName(dbMigratorProject) + "\" && dotnet run", out int exitCode); CmdHelper.RunCmd($"dotnet run", out int exitCode, workingDirectory: Path.GetDirectoryName(dbMigratorProject));
} }
} }

Loading…
Cancel
Save