@nocobase/database 1.9.1 → 1.9.3

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.
@@ -124,6 +124,7 @@ export declare class Collection<TModelAttributes extends {} = any, TCreationAttr
124
124
  updateOptions(options: CollectionOptions, mergeOptions?: any): this;
125
125
  setSortable(sortable: any): void;
126
126
  updateField(name: string, options: FieldOptions): void;
127
+ private normalizeFieldName;
127
128
  addIndex(index: string | string[] | {
128
129
  fields: string[];
129
130
  unique?: boolean;
package/lib/collection.js CHANGED
@@ -591,6 +591,12 @@ const _Collection = class _Collection extends import_events.EventEmitter {
591
591
  }
592
592
  this.setField(options.name || name, options);
593
593
  }
594
+ normalizeFieldName(val) {
595
+ if (!this.options.underscored) {
596
+ return val;
597
+ }
598
+ return Array.isArray(val) ? val.map((v) => (0, import_utils.snakeCase)(v)) : (0, import_utils.snakeCase)(val);
599
+ }
594
600
  addIndex(index) {
595
601
  if (!index) {
596
602
  return;
@@ -620,7 +626,7 @@ const _Collection = class _Collection extends import_events.EventEmitter {
620
626
  return;
621
627
  }
622
628
  for (const item of indexes) {
623
- if (import_lodash.default.isEqual(item.fields, indexName)) {
629
+ if (import_lodash.default.isEqual(this.normalizeFieldName(item.fields), this.normalizeFieldName(indexName))) {
624
630
  return;
625
631
  }
626
632
  const name2 = item.fields.join(",");
@@ -35,7 +35,12 @@ module.exports = __toCommonJS(mariadb_dialect_exports);
35
35
  var import_base_dialect = require("./base-dialect");
36
36
  const _MariadbDialect = class _MariadbDialect extends import_base_dialect.BaseDialect {
37
37
  getSequelizeOptions(options) {
38
- options.dialectOptions = { ...options.dialectOptions || {}, supportBigNumbers: true, bigNumberStrings: true };
38
+ options.dialectOptions = {
39
+ ...options.dialectOptions || {},
40
+ multipleStatements: true,
41
+ supportBigNumbers: true,
42
+ bigNumberStrings: true
43
+ };
39
44
  return options;
40
45
  }
41
46
  getVersionGuard() {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@nocobase/database",
3
- "version": "1.9.1",
3
+ "version": "1.9.3",
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.9.1",
10
- "@nocobase/utils": "1.9.1",
9
+ "@nocobase/logger": "1.9.3",
10
+ "@nocobase/utils": "1.9.3",
11
11
  "async-mutex": "^0.3.2",
12
12
  "chalk": "^4.1.1",
13
13
  "cron-parser": "4.4.0",
@@ -39,5 +39,5 @@
39
39
  "url": "git+https://github.com/nocobase/nocobase.git",
40
40
  "directory": "packages/database"
41
41
  },
42
- "gitHead": "8a4face22c9be89c86484b97351e48f2ced3a834"
42
+ "gitHead": "e691264453aac97972d2cf18412d5a0228dff361"
43
43
  }