Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cli: Remove DeleteMigrationsIfNeeded method since migrations are already removed #7271

Merged
merged 1 commit into from
Jan 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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