Open
Description
Discussed in #517
Originally posted by krishna-404 May 31, 2025
I have fields createdByUserId & updatedByUserId. I want to auto add them to every create and update query as the case may be. What would be the best way to do this?
I was searching for some kind of query builder pattern for create and update but couldn't find anything, any direction would be great. Thanks!
- drop
updateSql
(raw SQL values are still supported by a regularupdate
) and changeonConflict().set
so that ORM can track what exact fields are being updated. (BREAKING_CHANGES.md at the root has more details on this) - in
beforeCreate
andbeforeSave
hook, add an utility to allow setting value when creating a record, it should work in all creational methods such ascreateMany
,createFrom
. - in
beforeUpdate
andbeforeSave
hook, add an utility to set a value when updating a record, it should work in all updating methods. - add
readOnly
method to columns to forbid inserting or updating the column on the type level. - add column-level helpers to set the values not from the
before*
hooks, but on the column definition itself.