put in try and catch just continue

This commit is contained in:
2026-04-04 23:40:26 +11:00
parent 817eee7d3e
commit d57751eefa
+19 -2
View File
@@ -103,9 +103,18 @@ using (var scope = app.Services.CreateScope())
var db = context.Database; var db = context.Database;
if (db != null) if (db != null)
{ {
try
db.Migrate(); {
using var cts = new CancellationTokenSource();
CancellationToken cancellationToken = cts.Token;
await db.MigrateAsync(cancellationToken);
db.EnsureCreated(); db.EnsureCreated();
}
catch
{
//continue
}
var staff = context.GetService<Seed>(); var staff = context.GetService<Seed>();
int id = staff.InsertOneUser(); int id = staff.InsertOneUser();
if (id < 0) if (id < 0)
@@ -114,8 +123,16 @@ using (var scope = app.Services.CreateScope())
if (databaseCreator != null) if (databaseCreator != null)
{ {
//if (!databaseCreator.Exists()) //if (!databaseCreator.Exists())
try
{
databaseCreator.CreateTables(); databaseCreator.CreateTables();
} }
catch
{
//continue
}
}
id = staff.InsertOneUser(); id = staff.InsertOneUser();
} }