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
If you set mysql variable auto_increment_increment to 2,
When saving multiple entities, pk should be incremented by 2.
However, if you use the following code in the MySqlDriver file, it will be set to 1.
async getAutoIncrementIncrement(ctx) {
if (this.autoIncrementIncrement == null) {
// the increment step may differ when running a cluster, see https://github.com/mikro-orm/mikro-orm/issues/3828
const res = await this.connection.execute(`show variables like 'auto_increment_increment'`, [], 'get', ctx, { enabled: false });
/* istanbul ignore next */
this.autoIncrementIncrement = res?.auto_increment_increment ? +res?.auto_increment_increment : 1;
}
*/ return this.autoIncrementIncrement;
}
Hmm weird, even looking at the original issue, the screenshot there confirms the same format as you say (and I can see it too, both in MySQL 8 and mariadb - will check MySQL 5 to be sure its not about that, but I kinda doubt it). I guess I must have been hallucinating, lol.
Describe the bug
If you set mysql variable auto_increment_increment to 2,
When saving multiple entities, pk should be incremented by 2.
However, if you use the following code in the MySqlDriver file, it will be set to 1.
when I debugging, the res value is like below.
I want to pull request this, but I don't know why this code is written. So I report this on issue.
Reproduction
version Info:
What driver are you using?
@mikro-orm/mysql
MikroORM version
6.2.1
Node.js version
v18.16.0
Operating system
mac os
Validations
The text was updated successfully, but these errors were encountered: