The only way I found practical is by having aggregate data be duplicated, one is original props, second is current, like
type UserProps { id: number name: string } type User { original: UserProps, current: UserProps } When working with the aggregate we change current:
user.currecntcurrent.name = "new_name" When saving to the database we just check what changed and generate the optimal sql query:
function save(user: User) { let query = orm.user.update().where(id, user.current.id) if (user.current.name != user.original.name) { query.update('name', user.current.name) } } save(user)