Skip to content

Commit

Permalink
Merge branch 'issue-297-3' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
zmcNotafraid committed Jan 5, 2025
2 parents b026f40 + ea403ed commit 14fb832
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/models/ckb_sync/new_node_data_processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,17 @@ def update_addresses_dao_info(addrs_deposit_info)
is_depositor: address_info[:is_depositor],
}
end
Address.upsert_all(addresses_deposit_attributes, record_timestamps: true) if addresses_deposit_attributes.present?
if addresses_deposit_attributes.present?
Address.upsert_all(
addresses_deposit_attributes,
record_timestamps: true,
on_duplicate: Arel.sql(
"dao_deposit = COALESCE(EXCLUDED.dao_deposit, addresses.dao_deposit), " \
"interest = COALESCE(EXCLUDED.interest, addresses.interest), " \
"is_depositor = COALESCE(EXCLUDED.is_depositor, addresses.is_depositor)",
),
)
end
end

def update_or_create_udt_accounts!(local_block)
Expand Down

0 comments on commit 14fb832

Please sign in to comment.