Merge pull request #7381 from crobibero/migrate-datetime

This commit is contained in:
Bond-009 2022-03-03 13:55:09 +01:00 committed by GitHub
commit 6e91657f01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,13 +58,18 @@ namespace Jellyfin.Server.Migrations.Routines
foreach (var row in authenticatedDevices) foreach (var row in authenticatedDevices)
{ {
var dateCreatedStr = row[9].ToString();
_ = DateTime.TryParse(dateCreatedStr, out var dateCreated);
var dateLastActivityStr = row[10].ToString();
_ = DateTime.TryParse(dateLastActivityStr, out var dateLastActivity);
if (row[6].IsDbNull()) if (row[6].IsDbNull())
{ {
dbContext.ApiKeys.Add(new ApiKey(row[3].ToString()) dbContext.ApiKeys.Add(new ApiKey(row[3].ToString())
{ {
AccessToken = row[1].ToString(), AccessToken = row[1].ToString(),
DateCreated = row[9].ToDateTime(), DateCreated = dateCreated,
DateLastActivity = row[10].ToDateTime() DateLastActivity = dateLastActivity
}); });
} }
else else
@ -78,8 +83,8 @@ namespace Jellyfin.Server.Migrations.Routines
{ {
AccessToken = row[1].ToString(), AccessToken = row[1].ToString(),
IsActive = row[8].ToBool(), IsActive = row[8].ToBool(),
DateCreated = row[9].ToDateTime(), DateCreated = dateCreated,
DateLastActivity = row[10].ToDateTime() DateLastActivity = dateLastActivity
}); });
} }
} }