From 145dcabba66afc9d108bb479e206c16e82257871 Mon Sep 17 00:00:00 2001 From: Chad Scharf <3904944+cscharf@users.noreply.github.com> Date: Fri, 10 Apr 2020 13:43:51 -0400 Subject: [PATCH] [Soft Delete] bulk import fails if DeletedDate null --- src/Core/Repositories/SqlServer/CipherRepository.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Core/Repositories/SqlServer/CipherRepository.cs b/src/Core/Repositories/SqlServer/CipherRepository.cs index 781b6efb04..1f9d52d079 100644 --- a/src/Core/Repositories/SqlServer/CipherRepository.cs +++ b/src/Core/Repositories/SqlServer/CipherRepository.cs @@ -629,7 +629,7 @@ namespace Bit.Core.Repositories.SqlServer ciphersTable.Columns.Add(creationDateColumn); var revisionDateColumn = new DataColumn(nameof(c.RevisionDate), c.RevisionDate.GetType()); ciphersTable.Columns.Add(revisionDateColumn); - var deletedDateColumn = new DataColumn(nameof(c.DeletedDate), c.DeletedDate.GetType()); + var deletedDateColumn = new DataColumn(nameof(c.DeletedDate), typeof(DateTime)); ciphersTable.Columns.Add(deletedDateColumn); foreach (DataColumn col in ciphersTable.Columns) @@ -655,7 +655,7 @@ namespace Bit.Core.Repositories.SqlServer row[attachmentsColumn] = cipher.Attachments; row[creationDateColumn] = cipher.CreationDate; row[revisionDateColumn] = cipher.RevisionDate; - row[deletedDateColumn] = cipher.DeletedDate; + row[deletedDateColumn] = cipher.DeletedDate.HasValue ? (object)cipher.DeletedDate : DBNull.Value; ciphersTable.Rows.Add(row); }