Skip to content

Commit 14fb832

Browse files
committed
Merge branch 'issue-297-3' into staging
2 parents b026f40 + ea403ed commit 14fb832

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

app/models/ckb_sync/new_node_data_processor.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,17 @@ def update_addresses_dao_info(addrs_deposit_info)
355355
is_depositor: address_info[:is_depositor],
356356
}
357357
end
358-
Address.upsert_all(addresses_deposit_attributes, record_timestamps: true) if addresses_deposit_attributes.present?
358+
if addresses_deposit_attributes.present?
359+
Address.upsert_all(
360+
addresses_deposit_attributes,
361+
record_timestamps: true,
362+
on_duplicate: Arel.sql(
363+
"dao_deposit = COALESCE(EXCLUDED.dao_deposit, addresses.dao_deposit), " \
364+
"interest = COALESCE(EXCLUDED.interest, addresses.interest), " \
365+
"is_depositor = COALESCE(EXCLUDED.is_depositor, addresses.is_depositor)",
366+
),
367+
)
368+
end
359369
end
360370

361371
def update_or_create_udt_accounts!(local_block)

0 commit comments

Comments
 (0)