add database migration to limit UID and Hash max lengths

This commit is contained in:
Stanley Dimant
2022-07-12 11:39:23 +02:00
parent b8950ca886
commit e70f564162
6 changed files with 325 additions and 11 deletions

View File

@@ -158,7 +158,6 @@ namespace MareSynchronosServer.Hubs
await DbContext.Files.AddAsync(new FileCache()
{
Hash = file,
LastAccessTime = DateTime.Now,
Uploaded = false,
Uploader = DbContext.Users.Single(u => u.UID == userId)
});
@@ -225,7 +224,6 @@ namespace MareSynchronosServer.Hubs
await File.WriteAllBytesAsync(Path.Combine(BasePath, hash), uploadedFile.ToArray());
relatedFile = DbContext.Files.Single(f => f.Hash == hash);
relatedFile.Uploaded = true;
relatedFile.LastAccessTime = DateTime.Now;
await DbContext.SaveChangesAsync();
Logger.LogInformation("File " + hash + " added to DB");
}