Skip to content

Commit 0b4a67f

Browse files
authored
feat(templates): use Database.EnsureCreatedAsync in boilerplate test project #11524 (#11527)
1 parent 0763d01 commit 0b4a67f

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/Templates/Boilerplate/Bit.Boilerplate/src/Tests/TestsInitializer.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,7 @@ private static async Task InitializeDatabase(AppTestServer testServer)
101101
}
102102
//#endif
103103
//#endif
104-
if ((await dbContext.Database.GetPendingMigrationsAsync()).Any())
105-
{
106-
await dbContext.Database.MigrateAsync();
107-
}
108-
else if ((await dbContext.Database.GetAppliedMigrationsAsync()).Any() is false)
109-
{
110-
throw new InvalidOperationException("No migrations have been added. Please ensure that migrations are added before running tests.");
111-
}
104+
await dbContext.Database.EnsureCreatedAsync(); // It's recommended to start using ef-core migrations.
112105
}
113106
}
114107

0 commit comments

Comments
 (0)