I want to make some script backfill data from an old database to a new database, with gorm as it ORM, and I want to upsert using FirstOrCreate, below are the attributes and query used:
user {
ID: someid,
Name: somename,
.
.
.
CreatedAt: time.Time,
UpdatedAt: 2020-03-24 17:57:00,
}
err = db.Where(user{ID: someid}).Assign(user).FirstOrCreate(&user)
I want in new database, the data is as it is (updated_at = 2020-03-24 17:57:00) but I got updated_at is time.Now()
How can I upsert the data with updated_at is updated as I send it?