From 1681f48bbf4349454fd4caee7bdd9029cd071ee8 Mon Sep 17 00:00:00 2001 From: "kham.vilaythong" Date: Sat, 4 Apr 2026 23:42:18 +1100 Subject: [PATCH] put try and continue --- API/FamilyTreeAPI/Program.cs | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) 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(); }