Skip to content

Commit

Permalink
Fix $returningId() to correctly set selected fields
Browse files Browse the repository at this point in the history
The local variable `returning` computes the selected fields in
$returningId() but throws this away. Change to correctly
store config in the insert query builder.

Fixed #2971
  • Loading branch information
danielsharvey committed Sep 16, 2024
1 parent 17991b2 commit 0018eea
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drizzle-orm/src/mysql-core/query-builders/insert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import type { Placeholder, Query, SQLWrapper } from '~/sql/sql.ts';
import { Param, SQL, sql } from '~/sql/sql.ts';
import type { InferModelFromColumns } from '~/table.ts';
import { Table } from '~/table.ts';
import { mapUpdateSet, orderSelectedFields } from '~/utils.ts';
import type { AnyMySqlColumn, MySqlColumn } from '../columns/common.ts';
import { mapUpdateSet } from '~/utils.ts';
import type { AnyMySqlColumn } from '../columns/common.ts';
import type { SelectedFieldsOrdered } from './select.types.ts';
import type { MySqlUpdateSetSource } from './update.ts';

Expand Down Expand Up @@ -252,7 +252,7 @@ export class MySqlInsertBase<
returning.push({ field: value, path: [key] });
}
}
this.config.returning = orderSelectedFields<MySqlColumn>(this.config.table[Table.Symbol.Columns]);
this.config.returning = returning;
return this as any;
}

Expand Down

0 comments on commit 0018eea

Please sign in to comment.