put in try and catch just continue

This commit is contained in:
2026-04-04 23:40:26 +11:00
parent 817eee7d3e
commit d57751eefa
+20 -3
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
{
using var cts = new CancellationTokenSource();
CancellationToken cancellationToken = cts.Token;
await db.MigrateAsync(cancellationToken);
db.EnsureCreated();
}
catch
{
//continue
}
db.Migrate();
db.EnsureCreated();
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,7 +123,15 @@ using (var scope = app.Services.CreateScope())
if (databaseCreator != null) if (databaseCreator != null)
{ {
//if (!databaseCreator.Exists()) //if (!databaseCreator.Exists())
databaseCreator.CreateTables(); try
{
databaseCreator.CreateTables();
}
catch
{
//continue
}
} }
id = staff.InsertOneUser(); id = staff.InsertOneUser();
} }