diff --git a/db/device.go b/db/device.go index 064c92f..aa6b46e 100644 --- a/db/device.go +++ b/db/device.go @@ -59,7 +59,7 @@ func (d *DB) Device(id string) (*Device, error) { func (d *DB) UpsertDevice(t *Device) error { err := d.db.Clauses(clause.OnConflict{ Columns: []clause.Column{{Name: "id"}}, - DoUpdates: clause.AssignmentColumns([]string{"nft_id", "owner", "address", "status", "proposer", "updated_at"}), + DoUpdates: clause.AssignmentColumns([]string{"name", "nft_id", "owner", "address", "status", "proposer", "updated_at"}), }).Create(t).Error return errors.Wrap(err, "failed to upsert device") } diff --git a/monitor/monitor.go b/monitor/monitor.go index 2a9d9a5..48e5361 100644 --- a/monitor/monitor.go +++ b/monitor/monitor.go @@ -103,6 +103,7 @@ func (c *contract) processLogs(logs []types.Log) error { if err := c.h.UpsertDevice(&db.Device{ ID: e.Did, + Name: e.Did, NFTID: e.Id.String(), Owner: e.Owner.String(), Address: address.String(),