0.6.3
It's time for another update, this time with some bug fixes, cleaner errors and a new builder API for PrismaClient
!
Builder API
While new_client
and new_client_with_url
will remain supported for now, PrismaClient::_builder
will be the recommended approach from now on. It is cleaner and more extensible, and will be the only solution when 0.7.0 is released.
Nicer Errors
Previously, any errors that occurred while generating the client would result in an ugly JSON blob being printed to the console. This is because the generator would just panic when it should have sent an error response back to the CLI.
Errors are now sent to the CLI properly, making them more clearer and readable. I can't promise that they will all be this way, but it's definitely an improvement.
Bug Fixes
skip_duplicates
is no longer generated for databases that don't support it - #173- Custom schema paths with
--schema
are now respected - #183 count
passes through where args - #177and!
merges operators applied to the same field - #175order_by
params are treated as an array - #176
Other Stuff
Normalised Read Filters
WhereParams
used to contain every possible combination of filters and fields, which made them very long and resulted in a lot of duplicate code. Now, filters are generated for each field type - be that String, Int or something else - and reused in all other WhereParams
. This shouldn't affect any code you write, it just makes internal stuff nicer.
Custom Generator Example
sdk/example
contains an example of a custom generator could be built. It's just an example for @oscartbeaumont at the moment, and I don't endorse building custom generators yet, but will be supported in future.
Mutation Callbacks
The mutation-callbacks
feature allows callbacks to be registered on the client builder that are triggered when a mutation is ran (eg. create, update, delete). This is purely for use at Spacedrive and is not recommended for public use.
Many thanks to @Congyuwang and @affanshahid for contributing to this release!