-
-
Notifications
You must be signed in to change notification settings - Fork 568
Mysql sea-orm 1.1 insert bug #2568
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
It's added to support onconflict do nothing #2244 you can propose an idea for some new API / params as long as it's not breaking |
I believe this issue was introduced to support onconflict do nothing for MySQL, which shouldn't have been necessary. This is actually normal insertion behavior rather than an exceptional case. |
When I declare a primary key of type String using #[sea_orm(primary_key)], it defaults auto_increment to true, which caused the aforementioned issue. Should the macro automatically set auto_increment to false when the primary key is of a non-auto-incrementable data type? |
When I was using sea-orm 0.12 with MySQL version 8.0.23, data could be written normally even when the primary key wasn't an auto-increment ID.
However, after upgrading to sea-orm 1.1, I encountered insertion failures. Upon investigation, I found that in the newer version, the
exec_insert
method includes a special check:This check on
last_insert_id
appears to be affecting my use case, even though the data can actually be written to the database normally.I'd like to understand:
last_insert_id
was added?The text was updated successfully, but these errors were encountered: