Closed santiDotIO closed 2 years ago
MySQL doesn't return the identifiers of the created rows. Objection models can't be created for the result without identifiers. That's why it's not supported.
That makes sense. In my opinion, I believe there should still be some support, and instead of returning a set of models, just a count or boolean. Especially since this in a sort creates a weird scenario where it removes a feature of knex. I would imagine having this feature would still be more beneficial than having to break out of using objection to make a knex query? or at least some clearer explanation as to why in the docs or error messages.
This is really annoying issue, must agree with @santi6291. If we are using MySQL and want to insert batches, we are already not receiving any ids back, and that is fine. I understand that this might be necessary for some graph inserts, where you need to relate stuff to an object after it was inserted, but that is something that would be okay to not allow in MySQL. The only solution here is to bypass objection and use knex itself, that can lead to errors and other issues. @koskimas would you consider reopening this?
Now allowed to execute batch inserts on MySQL8 server, Works fine when running with knex directly, maybe mysql2 client is not getting grouped together with the mysql/postgress client?
The following query works just fine using knex directly
but get the error below when I try to run it using Objectionjs
On the knex file: