Releases: Brendonovich/prisma-client-rust
0.6.11
0.6.10
Fixed default values with MongoDB
The default_generators
feature is now enabled in the engines when using MongoDB, so using auto()
in a schema should work properly.
0.6.9
OpenSSL 3.1 support
Systems running OpenSSL 3.1.x will now download the OpenSSL 3.0.x versions of the Prisma engines.
Postgres raw queries fixed
Argument numbering now goes from 1 -> N rather than 0 -> N-1.
0.6.8
Inner attributes removed (#306)
It is now recommended to put #[allow(warnings, unused)]
wherever you declare your generated client's mod ...;
, as this allows the client to be imported via import!()
.
Enum lists fixed (#303)
QueryError
now implements Serialize
(#305)
partial_unchecked
fields now pub
(#311)
0.6.7
Big release today for MongoDB users, with support for composite fields and raw mongo queries! partial!
is also here, along with a bunch of bug fixes.
Composite Type Support
It is now possible to perform CRUD operations with MongoDB's embedded documents, with type- and field-level modules now generated with similar types as regular models.
MongoDB Raw Queries
_run_command_raw
, find_raw
, and aggregate_raw
are all now available when using MongoDB.
Partial Types
The partial_unchecked!
macro is now available for all models, providing an easy way to convert input objects to update_unchecked
parameters.
create_unchecked
, update_unchecked
, UncheckedSetParam
For cases where yo want to interact with foreign keys, create_unchecked
and update_unchecked
allow you to do so without risking a runtime error by including a relation operation, improving type-safety. In a future update foreign key operations will be removed from SetParam
enums.
Other
.env
file loading
dotenv
is now being used instead of std::env
, so the client can read from .env
files at runtime.
Unsupported
field handling
Models that have Unsupported
fields won't throw errors, instead it will not be possible to create records of them if the field is required. The fields will also not be returned from queries. Thanks to @laptou for helping with this!
New specta
feature
PCR can now be used with Specta independently of rspc
Next up on the agenda is a bunch of breaking changes like #300, #83, and big changes like #263 and #44, but those will come later.
0.6.6
0.6.5
Just a few bug fixes this time, nothing major.
Fixed MySQL Compatibility (#256)
Prisma recently updated their fork of mysql_async
, the crate which powers the engines' MySQL support, with a breaking change. Due to how Prisma lock git dependencies to branches rather than commits, this breaking change was propagated through quaint
, the engines, and all the way to PCR. For now I have locked mysql_async
to a specific commit on my fork of quaint
, but Prisma are aware of this issue and are working to remove git dependencies.
Restored Read Filters for Scalar Lists (#257)
0.6.4 had a regression where read filters like is_empty
were not generated for scalar list fields.
Improved Reserved Keyword Handling
Reserved keyword transformations are now applied after doing case conversions of model and field names, so models names are now prepended with r#
if they would otherwise be a reserved keyword.
Hopefully the next update can be 0.7.0, it just won't be for a while. In the meantime I'd like to gauge sentiment for turning select
and include
into proc macros (#250) - would you all be opposed? I think it would break autocompletion inside the macros (not sure how big a concern that is seeing as existing autocomplete only works one layer deep), but would allow for much better error handling and reporting, and cleaner code in the generator. If you've got thoughts on this please join our Discord and let me know!
Big thanks to my sponsors @m1guelpf and @DominoTree!
0.6.4
What was going to be a small release with some bug fixes has turned into a whole lot of features and changes, but 0.6.4 is finally here!
First, I'd like to thank @0xtlt and @Congyuwang for their generous sponsorship. It really means a lot to me!
New Features
Improved batching (#237)
Any combination of tuples and Vec
s can now be batched together
Interactive transactions (#60)
With Prisma bringing interactive transactions into GA in 4.7.0, they've now been implemented with both closure-based and begin/commit/rollback
methods being supported.
Mock client (#230)
Sometimes you may want to write tests that don't connect to a database. Mocking is great for this, allowing you to create a client that retrieves query results from values you pass in beforehand.
More traits (#232)
A whole lot of traits have been added and implemented for the query builders. These can be used to make reusable wrapper functions that can add parameters to multiple types of queries in a generic manner.
is_null
field function (#214)
This field function is available for checking if optional 1-1 relations are connected or not.
Dedicated types generated for named select & include (#216)
When using specta/rspc, dedicated TypeScript types will be generated for named select
and include
types. Though this is possible, it's recommended to use rspc.inferProcedureResult
and the like to extract procedure types.
Bug Fixes
Enum fixes (#199, #197, #217, #204)
A regression in 0.6.3 messed up how enums are qualified in the codegen. This is now fixed, along with some QoL improvements.
not
field function now Option
for optional fields (#206)
Fixed FindMany
batch type (#208)
Upsert::include
accepts IncludeType
(#221)
Preview features now passed to the connector (#228)
Other Changes
Include & select code consolidated (#156)
Naming clashes now prefix with r#
(#194)
What's Next
I probably won't put out another release until 0.7.0. This library is at a pretty good point right now feature-wise, and I'd like to focus on improving documentation and creating content to increase awareness.
Again, thank you to my sponsors, and thank you to everyone who has created issues, tested changes, submitted PRs, joined the Discord, and starred the repo!
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!
0.6.2
A new release is here with more features, bug fixes, and faster compile times!
Migrations
Thanks to collaboration with @oscartbeaumont It is now possible to use Prisma's migration engine to apply schema changes and migrations! I don't recommend using this in all projects (if you can migrate with the CLI then do so), but for applications like those built with Tauri this is a great solution for applying migrations on users' machines. Please note that using this feature will likely cause your generated client to be non-transferrable across devices and operating systems, so it will have to be generated separately anywhere you want to use it and be removed from source control if you have it checked in.
Enable the migrations
feature for the library and CLI and read the docs for more info. Thanks to @oscartbeaumont for helping get this done.
Feature Gated Database Connectors
The default behaviour of Prisma Client Rust is to compile and include all database connectors. This adds anywhere from 10-30% more compile time depending on which specific connectors you actually need.
0.6.2 makes it possible to disable support for all connectors using default-features = false
, and then selectively re-enable them with connector-specific features. postgresql
, mysql
, sqlite
, mssql
and mongodb
are all valid options.
Make the mentioned changes for the library and CLI and you should notice compilation improvements immediately!
Introduce create_unchecked
0.6.1 acknowledged that create_many
can only accept scalar fields, but wrongly changed create
to do the same, making it incompatible with upsert
. Now create_unchecked
is the helper to be used with create_many
, and create
can be used with upsert
.
rspc
0.1.2 Support
Recent changes to rspc
have made 0.6.1 incompatible with newer releases, so the minimum version of rspc
has been bumped to 0.1.2.
On the subject of rspc
, enums are usable in resolver return types!
What's Next
These changes have been a long time coming but I wanted to test them as much as possible, especially the migrations feature. How best to take advantage of it is still up in the air, but create-rspc-app
from @oscartbeaumont and @VarunPotti should help with that in the near future. It will be a CLI for initializing a new project with any combination of Prisma, rspc
, axum
, Tauri and a website that takes incorporates a lot of the patterns we adopted building Spacedrive.
The next things I would like to see happen with Prisma Client Rust is a simplification of the codebase, especially the generators, such that external contributions and custom generators get easier; Use of more traits such that query builders can be modified generically and be constructed from JSON; More tests, preferably a setup that has general tests that run on all supported DBs and specific tests for certain DBs; Better docs are also a must, and if anyone would like to help write some I would be very grateful!