Skip to content

Commit

Permalink
Merge pull request #7271 from abpframework/revert-remove-delete-migra…
Browse files Browse the repository at this point in the history
…tions-when-no-SqlServer

Cli: Remove `DeleteMigrationsIfNeeded` method since migrations are already removed
  • Loading branch information
ebicoglu authored Jan 15, 2021
2 parents 2ee213b + 654efac commit 881e53a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,6 @@ public async Task ExecuteAsync(CommandLineArgs commandLineArgs)
}
}

DeleteMigrationsIfNeeded(databaseProvider, databaseManagementSystem, outputFolder);

Logger.LogInformation($"'{projectName}' has been successfully created to '{outputFolder}'");


Expand Down Expand Up @@ -256,23 +254,6 @@ private string GetNewConnectionStringByDbms(DatabaseManagementSystem databaseMan
}
}

private void DeleteMigrationsIfNeeded(DatabaseProvider databaseProvider, DatabaseManagementSystem databaseManagementSystem, string outputFolder)
{
if (databaseManagementSystem == DatabaseManagementSystem.NotSpecified || databaseManagementSystem == DatabaseManagementSystem.SQLServer)
{
return;
}

if (databaseProvider != DatabaseProvider.NotSpecified && databaseProvider != DatabaseProvider.EntityFrameworkCore)
{
return;
}

Logger.LogInformation($"Deleting migrations...");

_efCoreMigrationManager.RemoveAllMigrations(outputFolder);
}

private void OpenThanksPage(UiFramework uiFramework, DatabaseProvider databaseProvider, bool tiered, bool commercial)
{
uiFramework = uiFramework == UiFramework.NotSpecified || uiFramework == UiFramework.None ? UiFramework.Mvc : uiFramework;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,6 @@ public void AddMigration(string dbMigrationsCsprojFile, string module, string st
GetStartupProjectOption(startupProject));
}

public void RemoveAllMigrations(string solutionFolder)
{
if (Directory.Exists(Path.Combine(solutionFolder, "aspnet-core")))
{
solutionFolder = Path.Combine(solutionFolder, "aspnet-core");
}

var srcFolder = Path.Combine(solutionFolder, "src");

var migrationsFolder = Directory.GetDirectories(srcFolder)
.FirstOrDefault(d => d.EndsWith(".EntityFrameworkCore.DbMigrations"));

if (migrationsFolder != null)
{
Directory.Delete(Path.Combine(migrationsFolder, "Migrations"), true);
}
else
{
Logger.LogWarning("No migration found to delete.");
}
}

protected virtual string ParseModuleName(string fullModuleName)
{
var words = fullModuleName?.Split('.');
Expand Down

0 comments on commit 881e53a

Please sign in to comment.