Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading