From 654efac9f5c0ccb8ea2e70b04eaf0e28ec196785 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Fri, 15 Jan 2021 18:14:18 +0300 Subject: [PATCH] Cli: Remove `DeleteMigrationsIfNeeded` method since migrations are already removed resolves https://github.com/abpframework/abp/issues/7270 --- .../Volo/Abp/Cli/Commands/NewCommand.cs | 19 ---------------- .../EfCoreMigrationManager.cs | 22 ------------------- 2 files changed, 41 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs index 55247c71bb6..9caa952528f 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs @@ -226,8 +226,6 @@ public async Task ExecuteAsync(CommandLineArgs commandLineArgs) } } - DeleteMigrationsIfNeeded(databaseProvider, databaseManagementSystem, outputFolder); - Logger.LogInformation($"'{projectName}' has been successfully created to '{outputFolder}'"); @@ -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; diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/EfCoreMigrationManager.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/EfCoreMigrationManager.cs index b26ca1be908..b15ffaa274b 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/EfCoreMigrationManager.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/EfCoreMigrationManager.cs @@ -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('.');