model_meta.go
4.31 KB
-
🐛 fix(model): preserve created_time on Model update and streamline field maintenance · b0fe7291The update operation for Model previously overwrote `created_time` with zero because GORM included every struct field in the UPDATE statement. This commit adjusts `Model.Update()` to: * Call `Omit("created_time")` so the creation timestamp is never modified. * Refresh `UpdatedTime` with `common.GetTimestamp()` before persisting. * Delegate the remainder of the struct to GORM, eliminating the need to maintain an explicit allow-list whenever new fields are introduced. No API contract is changed; existing CRUD endpoints continue to work normally while data integrity for historical records is now guaranteed.t0ng7u committed