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
letquery=`MERGE INTO ${tableNameQuoted} WITH(HOLDLOCK) AS ${targetTableAlias} USING (${sourceTableQuery}) AS ${sourceTableAlias}(${insertKeysQuoted}) ON ${joinCondition}`;
513
-
query+=` WHEN MATCHED THEN UPDATE SET ${updateSnippet} WHEN NOT MATCHED THEN INSERT ${insertSnippet} OUTPUT $action, INSERTED.*;`;
515
+
query+=` ${updateSnippet} WHEN NOT MATCHED THEN INSERT ${insertSnippet} OUTPUT $action, INSERTED.*;`;
514
516
if(needIdentityInsertWrapper){
515
517
query=`SET IDENTITY_INSERT ${tableNameQuoted} ON; ${query} SET IDENTITY_INSERT ${tableNameQuoted} OFF;`;
Copy file name to clipboardExpand all lines: lib/model.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1672,7 +1672,7 @@ class Model {
1672
1672
* @param {object} [options.having] Having options
1673
1673
* @param {string} [options.searchPath=DEFAULT] An optional parameter to specify the schema search_path (Postgres only)
1674
1674
* @param {boolean|Error} [options.rejectOnEmpty=false] Throws an error when no records found
1675
-
* @param {boolean} [options.dotNotation] Allows including tables having the same attribute/column names - which have a dot in them.
1675
+
* @param {boolean} [options.dotNotation] Allows including tables having the same attribute/column names - which have a dot in them.
1676
1676
*
1677
1677
* @see
1678
1678
* {@link Sequelize#query}
@@ -2438,7 +2438,7 @@ class Model {
2438
2438
* @param {object} values hash of values to upsert
2439
2439
* @param {object} [options] upsert options
2440
2440
* @param {boolean} [options.validate=true] Run validations before the row is inserted
2441
-
* @param {Array} [options.fields=Object.keys(this.attributes)] The fields to insert / update. Defaults to all changed fields
2441
+
* @param {Array} [options.fields=Object.keys(this.attributes)] The fields to update if the record already exists. Defaults to all changed fields. If none of the specified fields are present on the provided `values` object, an insert will still be attempted, but duplicate key conflicts will be ignored.
2442
2442
* @param {boolean} [options.hooks=true] Run before / after upsert hooks?
2443
2443
* @param {boolean} [options.returning=true] If true, fetches back auto generated values
2444
2444
* @param {Transaction} [options.transaction] Transaction to run query under
0 commit comments