@nocobase/database 1.3.53 → 1.3.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -258,7 +258,11 @@ async function updateSingleAssociation(model, key, value, options = {}) {
258
258
  return;
259
259
  }
260
260
  if (updateAssociationValues.includes(key)) {
261
- await instance2.update(value, { ...options, transaction });
261
+ const updateValues = { ...value };
262
+ if (association.associationType === "HasOne") {
263
+ delete updateValues[association.foreignKey];
264
+ }
265
+ await instance2.update(updateValues, { ...options, transaction });
262
266
  }
263
267
  await updateAssociations(instance2, value, {
264
268
  ...options,
@@ -393,6 +397,9 @@ async function updateMultipleAssociation(model, key, value, options = {}) {
393
397
  continue;
394
398
  }
395
399
  if (updateAssociationValues.includes(key)) {
400
+ if (association.associationType === "HasMany") {
401
+ delete item[association.foreignKey];
402
+ }
396
403
  await instance.update(item, { ...options, transaction });
397
404
  }
398
405
  await updateAssociations(instance, item, {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@nocobase/database",
3
- "version": "1.3.53",
3
+ "version": "1.3.55",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
7
7
  "license": "AGPL-3.0",
8
8
  "dependencies": {
9
- "@nocobase/logger": "1.3.53",
10
- "@nocobase/utils": "1.3.53",
9
+ "@nocobase/logger": "1.3.55",
10
+ "@nocobase/utils": "1.3.55",
11
11
  "async-mutex": "^0.3.2",
12
12
  "chalk": "^4.1.1",
13
13
  "cron-parser": "4.4.0",
@@ -38,5 +38,5 @@
38
38
  "url": "git+https://github.com/nocobase/nocobase.git",
39
39
  "directory": "packages/database"
40
40
  },
41
- "gitHead": "5abb7080c6788bc1efb37fa52d75282dd357dcab"
41
+ "gitHead": "29126bb873bd07a9f40a7f2fee5ca1c396f09794"
42
42
  }