You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just ran into a big issue that is largely a result of how knex works, issue here: knex/knex#95
Basically Knex inserts for MySQL can only return auto-increment primary keys. I'm generating my own UUIDs for some of my tables which causes the "create" service method to fail, since it is unable to retrieve the newly created user using "get" because the primary key is not available.
The easiest way to fix this would be to provide the ability to return a property from the original object being inserted. I'm happy to submit a pull request for this, but I'm not sure of the best way to expose this functionality. We can either add a flag option that indicates the "id" option specified should be pulled from the original object, or use a convention like if the "id" begins with a "." then the value should be retrieved from the original object instead of the result from knex. Thoughts?
The text was updated successfully, but these errors were encountered:
I just ran into a big issue that is largely a result of how knex works, issue here: knex/knex#95
Basically Knex inserts for MySQL can only return auto-increment primary keys. I'm generating my own UUIDs for some of my tables which causes the "create" service method to fail, since it is unable to retrieve the newly created user using "get" because the primary key is not available.
The easiest way to fix this would be to provide the ability to return a property from the original object being inserted. I'm happy to submit a pull request for this, but I'm not sure of the best way to expose this functionality. We can either add a flag option that indicates the "id" option specified should be pulled from the original object, or use a convention like if the "id" begins with a "." then the value should be retrieved from the original object instead of the result from knex. Thoughts?
The text was updated successfully, but these errors were encountered: