Skip to content

Commit

Permalink
remove extra duplicate migration existence check (#28454)
Browse files Browse the repository at this point in the history
  • Loading branch information
MoienTajik authored Jul 30, 2022
1 parent 7f79784 commit 64fbf09
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/EFCore.Design/Migrations/Design/MigrationsScaffolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ public virtual ScaffoldedMigration ScaffoldMigration(
string? subNamespace = null,
string? language = null)
{
if (string.Equals(migrationName, "migration", StringComparison.OrdinalIgnoreCase))
{
throw new OperationException(DesignStrings.CircularBaseClassDependency);
}

if (Dependencies.MigrationsAssembly.FindMigrationId(migrationName) != null)
{
throw new OperationException(DesignStrings.DuplicateMigrationName(migrationName));
Expand All @@ -80,16 +85,6 @@ public virtual ScaffoldedMigration ScaffoldMigration(
subNamespaceDefaulted = true;
subNamespace = "Migrations";
}

if (string.Equals(migrationName, "migration", StringComparison.OrdinalIgnoreCase))
{
throw new OperationException(DesignStrings.CircularBaseClassDependency);
}

if (Dependencies.MigrationsAssembly.FindMigrationId(migrationName) != null)
{
throw new OperationException(DesignStrings.DuplicateMigrationName(migrationName));
}

var (key, typeInfo) = Dependencies.MigrationsAssembly.Migrations.LastOrDefault();

Expand Down

0 comments on commit 64fbf09

Please sign in to comment.