-
-
Notifications
You must be signed in to change notification settings - Fork 12
Add support for MySql #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@weiznich, I finished all the steps except following one easily.
Without possibility to get id of inserted item, which mysql/mariadb offers by mysql_insert_id I can hardly implement Sure, it is possible to implement both methods in style of Sqlite
but I rather reluctant to do that. In my opinion it would be good to do an amendment in diesel crate to support in guide described get_result approach, which implemented for PostgreSQL back end only.
For instance DBIc::Class::ResultSet->create uses |
First of all a big thanks for working on this.It's great to see that this is done 👍
This situation is quite unfortunate, as neither SQlite nor MySQL do provide a reliable way to get back the inserted (or updated) column in such queries. The following statement more or less describes the reasoning on diesel side: There is Hopefully that explains at least a bit why things are as they are. |
Indeed,
I think both |
Diesel does not provide a |
Thank you for pointing it out to me. I'm struggling with type casting yet. Unfortunately I couldn't figure out by my self how to solve this issue. May I ask your help for that? |
So that's a really tricky one. On the surface that question is simple as we would only need to adjust those trait bounds to make this work. Below the surface there is a much more fundamental problem. Now that I look at that code again I remember why I've written the sqlite code that way and have not used For MySQL it's unfortunately not possible because there is no such hidden column. Now we could try to emulate this behavior using the That all written down I'm not really sure what's the right way forward here. Possible solutions are:
T::PrimaryKey: Expression<SqlType = Integer>,
<&'static L as Identifiable>::Id: UnRef<'static, UnRefed = i32>,
|
|
Your solution is basically that what I've proposed with my second point 😉 The consequences that tables with composite keys are not supported are kind of expected... |
Indeed, but I wasn't aware of the consequences for |
Do you have any advice how this attempt to implement |
I think you don't need nearly as many generic constraints as you've used there to make this work for a concrete type. See this impls for example. |
Indeed, this seems to be the right approach. |
In case of wundergraph/wundergraph_example/src/lib.rs Lines 104 to 109 in ffbb883
It looks like to move forward with #48 the only option I have:
and provide implementation of Do you agree? |
If I remember correctly the PR to your repo I've linked above does choose a hybrid approach: It does implement |
I beg your pardon, I've completely overseen it is a PR. Such a pity! It would have save me some hours |
In my opinion at least for CI sake wundergraph_bench should support MySql also. wundergraph/wundergraph_bench/src/api.rs Lines 555 to 557 in ffbb883
Souldn't the struct provide both two other fields like wundergraph/wundergraph_bench/src/api.rs Line 288 in ffbb883
|
Sorry for taking that long to answer, but life is currently really busy here.
👍
Yes that struct should provide also the other two keys. Seems like this is a bug in |
This one should be quite easy:
wundergraph_derive
,wundergraph
andwundergraph_cli
crateLoadingHandler
fordiesel::mysql::Mysql
inwundergraph_derive/src/wundergraph_entity.rs
WundergraphBelongsTo
fordiesel::mysql::Mysql
inwundergraph_derive/src/belonging_to.rs
BuildFilterHelper
fordiesel::mysql::Mysql
inwundergraph_derive/src/build_filter_helper.rs
HandleInsert
andHandleBatchInsert
fordiesel::mysql::Mysql
inwundergraph/src/query_builder/mutations/insert
ApplyOffset
fordiesel::mysql::Mysql
inwundergraph/src/query_builder/selection/offset.rs
wundergraph_example
running with the mysql backend. This includes porting the SQL migrations here to the MySQL dialect.The text was updated successfully, but these errors were encountered: