Skip to content

Commit 1819090

Browse files
authored
fix(database): update account on conflict updates (#1057)
Signed-off-by: Chris Gianelloni <wolf31o2@blinklabs.io>
1 parent 78c8ece commit 1819090

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

database/plugin/metadata/sqlite/transaction.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,10 @@ func (d *MetadataStoreSqlite) getOrCreateAccount(
8787
func saveAccountIfNew(account *models.Account, txn *gorm.DB) error {
8888
if account.ID == 0 {
8989
result := txn.Clauses(clause.OnConflict{
90-
Columns: []clause.Column{{Name: "staking_key"}},
91-
UpdateAll: true,
90+
Columns: []clause.Column{{Name: "staking_key"}},
91+
DoUpdates: clause.AssignmentColumns(
92+
[]string{"pool", "drep"},
93+
),
9294
}).Create(account)
9395
if result.Error != nil {
9496
return result.Error

0 commit comments

Comments
 (0)