diff --git a/API/FamilyTreeAPI/Program.cs b/API/FamilyTreeAPI/Program.cs index 117d54d..293bc0e 100644 --- a/API/FamilyTreeAPI/Program.cs +++ b/API/FamilyTreeAPI/Program.cs @@ -104,8 +104,18 @@ using (var scope = app.Services.CreateScope()) if (db != null) { - db.Migrate(); - db.EnsureCreated(); + try + { + using var cts = new CancellationTokenSource(); + CancellationToken cancellationToken = cts.Token; + await db.MigrateAsync(cancellationToken); + db.EnsureCreated(); + } + catch + { + //continue + } + var staff = context.GetService(); int id = staff.InsertOneUser(); if (id < 0) @@ -114,7 +124,15 @@ using (var scope = app.Services.CreateScope()) if (databaseCreator != null) { //if (!databaseCreator.Exists()) - databaseCreator.CreateTables(); + try + { + databaseCreator.CreateTables(); + } + catch + { + //continue + } + } id = staff.InsertOneUser(); }