Skip to content

Commit 300cb17

Browse files
committed
fix: filter out unsuccessful charges during migration
1 parent 8a69ca9 commit 300cb17

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

scripts/database_migration.exs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,12 @@ defmodule DatabaseMigration do
909909
|> put_in([:indexes, "_MergedUser"], %{"id" => index_merged_users(db)})
910910
|> put_in([:indexes, "_BountyTransfer"], %{
911911
"bounty_id" =>
912-
Enum.group_by(db["BountyTransfer"], fn row ->
912+
db["BountyTransfer"]
913+
|> Enum.reject(fn row ->
914+
charge = find_by_index(db, "BountyCharge", "id", row["bounty_charge_id"])
915+
nullish?(charge["succeeded_at"])
916+
end)
917+
|> Enum.group_by(fn row ->
913918
claim = find_by_index(db, "Claim", "id", row["claim_id"])
914919
charge = find_by_index(db, "BountyCharge", "id", row["bounty_charge_id"])
915920

0 commit comments

Comments
 (0)