MasoniteFramework / orm

Masonite ORM is a beautiful Python ORM. It's also a nearly drop in replacement of the Orator ORM
https://orm.masoniteproject.com
MIT License
165 stars 48 forks source link

`QueryBuilder.update()` does not respect model `__casts__` #831

Closed zombeer closed 1 year ago

zombeer commented 1 year ago

Describe the feature as you'd like to see it In my code I rely on models casts for some fields. As far as I can see it's implemented everywhere in model methods, but querybuilder ones. It would be really nice to have consistent behavior over all Model/QueryBuilder methods. In order for change to be non breaking I suggest to add cast=False kwarg to QueryBuilder.update() to preserve current state of things by default.

What do we currently have to do now? To be exact: I have to call Model.update(..) with some ugly json.dumps(...) inside while having json casts enabled in model.

zombeer commented 1 year ago

PR attached (: https://github.com/MasoniteFramework/orm/pull/832

circulon commented 1 year ago

Related to #759

zombeer commented 1 year ago

Related to #759

Yep. But I suggest to implement non breaking change though.

stoutput commented 1 year ago

Also addressed in https://github.com/MasoniteFramework/orm/pull/830

stoutput commented 1 year ago

This has been fixed in #830

josephmancuso commented 1 year ago

closing then :)