Skip to content

Commit

Permalink
Add tests for $default. Add examples to changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
AndriiSherman committed Aug 21, 2023
1 parent 3470cd8 commit a84ff4f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/mysql-core/dialect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,12 +335,11 @@ export class MySqlDialect {
}

buildInsertQuery({ table, values, ignore, onConflict }: MySqlInsertConfig): SQL {
const isSingleValue = values.length === 1;
// const isSingleValue = values.length === 1;
const valuesSqlList: ((SQLChunk | SQL)[] | SQL)[] = [];
const columns: Record<string, MySqlColumn> = table[Table.Symbol.Columns];
const colEntries: [string, MySqlColumn][] = isSingleValue
? Object.keys(values[0]!).map((fieldName) => [fieldName, columns[fieldName]!])
: Object.entries(columns);
const colEntries: [string, MySqlColumn][] = Object.entries(columns)

const insertOrder = colEntries.map(([, column]) => sql.identifier(column.name));

for (const [valueIndex, value] of values.entries()) {
Expand Down

0 comments on commit a84ff4f

Please sign in to comment.