Skip to content

Commit

Permalink
Ensure the document is created (not e.g. updated)
Browse files Browse the repository at this point in the history
This reflects the prior behaviour.
  • Loading branch information
supersven committed Nov 5, 2024
1 parent 7dc0c5b commit 9c29e8c
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,13 @@ persistMigrationVersionImpl :: (Member (Embed IO) r, Member TinyLog r, Member (E
persistMigrationVersionImpl env v = do
let docIdText = Text.pack . show $ migrationVersion v
docId = ES.DocId docIdText
persistResponse <- liftIO $ ES.runBH env $ ES.indexDocument migrationIndexName ES.defaultIndexDocumentSettings v docId
persistResponse <-
liftIO . ES.runBH env . ES.performBHRequest . ES.keepBHResponse $
(ESR.indexDocument migrationIndexName ES.defaultIndexDocumentSettings v docId)
case persistResponse of
Left _ -> throw $ PersistVersionFailed v $ show persistResponse
Right r ->
if ES.idxDocId r == docIdText
Right (resp, doc) ->
if (ES.idxDocId doc == docIdText) && ES.isCreated resp
then do
Log.info $
Log.msg (Log.val "Migration success recorded")
Expand Down

0 comments on commit 9c29e8c

Please sign in to comment.