mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
Fix: Crash during migration on some SQLite instances (Close #4623)
This commit is contained in:
@@ -214,7 +214,6 @@ namespace BTCPayServer.Hosting
|
||||
var typeMapping = t.EntityTypeMappings.Single();
|
||||
var query = (IQueryable<object>)otherContext.GetType().GetMethod("Set", new Type[0])!.MakeGenericMethod(typeMapping.EntityType.ClrType).Invoke(otherContext, null)!;
|
||||
Logger.LogInformation($"Migrating table: " + t.Name);
|
||||
|
||||
List<PropertyInfo> datetimeProperties = new List<PropertyInfo>();
|
||||
foreach (var col in t.Columns)
|
||||
if (col.PropertyMappings.Single().Property.ClrType == typeof(DateTime))
|
||||
@@ -235,6 +234,10 @@ namespace BTCPayServer.Hosting
|
||||
v = new DateTime(v.Ticks, DateTimeKind.Utc);
|
||||
prop.SetValue(row, v);
|
||||
}
|
||||
else if (v.Kind == DateTimeKind.Local)
|
||||
{
|
||||
prop.SetValue(row, v.ToUniversalTime());
|
||||
}
|
||||
}
|
||||
postgresContext.Entry(row).State = EntityState.Added;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user