Skip to content

Commit

Permalink
fix(mysql): fix reading auto_increment_increment value
Browse files Browse the repository at this point in the history
Closes #5460
  • Loading branch information
B4nan committed Apr 17, 2024
1 parent 509acab commit 1da88af
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/mariadb/src/MariaDbDriver.ts
Expand Up @@ -25,15 +25,15 @@ export class MariaDbDriver extends AbstractSqlDriver<MariaDbConnection, MariaDbP
private async getAutoIncrementIncrement(ctx?: Transaction): Promise<number> {
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<{ auto_increment_increment: number }>(
const res = await this.connection.execute<{ Value: string }>(
`show variables like 'auto_increment_increment'`,
[],
'get',
ctx,
{ enabled: false },
);
/* istanbul ignore next */
this.autoIncrementIncrement = res?.auto_increment_increment ? +res?.auto_increment_increment : 1;
this.autoIncrementIncrement = res?.Value ? +res?.Value : 1;
}

return this.autoIncrementIncrement;
Expand Down
4 changes: 2 additions & 2 deletions packages/mysql/src/MySqlDriver.ts
Expand Up @@ -12,15 +12,15 @@ export class MySqlDriver extends AbstractSqlDriver<MySqlConnection, MySqlPlatfor
private async getAutoIncrementIncrement(ctx?: Transaction): Promise<number> {
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<{ auto_increment_increment: number }>(
const res = await this.connection.execute<{ Value: string }>(
`show variables like 'auto_increment_increment'`,
[],
'get',
ctx,
{ enabled: false },
);
/* istanbul ignore next */
this.autoIncrementIncrement = res?.auto_increment_increment ? +res?.auto_increment_increment : 1;
this.autoIncrementIncrement = res?.Value ? +res?.Value : 1;
}

return this.autoIncrementIncrement;
Expand Down

0 comments on commit 1da88af

Please sign in to comment.