Browse Source

Make sure migration is added before running dbmigrator again

pull/6779/head
Yunus Emre Kalkan 6 years ago
parent
commit
589b540f99
  1. 8
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/CreateMigrationAndRunMigrator.cs

8
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/CreateMigrationAndRunMigrator.cs

@ -26,8 +26,12 @@ namespace Volo.Abp.Cli.Commands
throw new Exception("DbMigrator is not found!");
}
CmdHelper.RunCmd("cd \"" + commandLineArgs.Target + "\" && dotnet ef migrations add Initial -s " + dbMigratorProjectPath);
CmdHelper.RunCmd("cd \"" + Path.GetDirectoryName(dbMigratorProjectPath) + "\" && dotnet run");
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");
}
}
private string GetDbMigratorProjectPath(string dbMigrationsFolderPath)

Loading…
Cancel
Save