🏗️ structured files for testing
Co-authored-by: Sindre Kjelsrud <kjelsrudsindre@gmail.com>
This commit is contained in:
parent
5cfc2653bb
commit
d4b53e9912
15 changed files with 4 additions and 5 deletions
|
@ -38,14 +38,13 @@ using (var scope = services.CreateScope())
|
||||||
var context = scope.ServiceProvider.GetRequiredService<MovieDbContext>();
|
var context = scope.ServiceProvider.GetRequiredService<MovieDbContext>();
|
||||||
context.Database.EnsureCreated();
|
context.Database.EnsureCreated();
|
||||||
|
|
||||||
using (context)
|
|
||||||
{
|
|
||||||
context.Database.Migrate();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if movies are already inserted to avoid duplicate insertion
|
// Check if movies are already inserted to avoid duplicate insertion
|
||||||
if (!context.Movies.Any())
|
if (!context.Movies.Any())
|
||||||
{
|
{
|
||||||
|
using (context)
|
||||||
|
{
|
||||||
|
context.Database.Migrate();
|
||||||
|
}
|
||||||
using (var reader = new StreamReader("public/DbMockData.csv"))
|
using (var reader = new StreamReader("public/DbMockData.csv"))
|
||||||
using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
|
using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
|
||||||
{
|
{
|
Reference in a new issue