diff --git a/calm_adapter/calm_deletion_checker/src/main/scala/weco/pipeline/calm_deletion_checker/DeletionMarker.scala b/calm_adapter/calm_deletion_checker/src/main/scala/weco/pipeline/calm_deletion_checker/DeletionMarker.scala index 1f6f19076f..7cbff42ebc 100644 --- a/calm_adapter/calm_deletion_checker/src/main/scala/weco/pipeline/calm_deletion_checker/DeletionMarker.scala +++ b/calm_adapter/calm_deletion_checker/src/main/scala/weco/pipeline/calm_deletion_checker/DeletionMarker.scala @@ -22,7 +22,7 @@ class DeletionMarker(sourceTable: String)(implicit client: DynamoDbClient) .when(attributeExists("id")) .update( "id" === record.id, - set("isDeleted", true) + set("isDeleted", true) and add("version", 1), ) ) .map(_.toPayload) diff --git a/calm_adapter/calm_deletion_checker/src/test/scala/weco/pipeline/calm_deletion_checker/DeletionMarkerTest.scala b/calm_adapter/calm_deletion_checker/src/test/scala/weco/pipeline/calm_deletion_checker/DeletionMarkerTest.scala index b966348f11..795e91b2ae 100644 --- a/calm_adapter/calm_deletion_checker/src/test/scala/weco/pipeline/calm_deletion_checker/DeletionMarkerTest.scala +++ b/calm_adapter/calm_deletion_checker/src/test/scala/weco/pipeline/calm_deletion_checker/DeletionMarkerTest.scala @@ -31,7 +31,10 @@ class DeletionMarkerTest val targetRecord = rows.head.toPayload val result = deletionMarker(targetRecord) - result.success.value shouldBe targetRecord.copy(isDeleted = true) + result.success.value shouldBe targetRecord.copy( + isDeleted = true, + version = targetRecord.version + 1 + ) getRecordFromTable( targetRecord.id, targetRecord.version, @@ -48,7 +51,10 @@ class DeletionMarkerTest val targetRecord = rows.head.toPayload val result = deletionMarker(targetRecord) - result.success.value shouldBe targetRecord.copy(isDeleted = true) + result.success.value shouldBe targetRecord.copy( + isDeleted = true, + version = targetRecord.version + 1 + ) getRecordFromTable( targetRecord.id, targetRecord.version, @@ -65,7 +71,10 @@ class DeletionMarkerTest val targetRecord = records.head.toPayload val result = deletionMarker(targetRecord) - result.success.value shouldBe targetRecord.copy(isDeleted = true) + result.success.value shouldBe targetRecord.copy( + isDeleted = true, + version = targetRecord.version + 1 + ) getRecordFromTable( targetRecord.id, targetRecord.version,