@nocobase/database 2.0.0-alpha.32 → 2.0.0-alpha.34

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.
@@ -126,6 +126,7 @@ export declare class Collection<TModelAttributes extends {} = any, TCreationAttr
126
126
  updateOptions(options: CollectionOptions, mergeOptions?: any): this;
127
127
  setSortable(sortable: any): void;
128
128
  updateField(name: string, options: FieldOptions): void;
129
+ private normalizeFieldName;
129
130
  addIndex(index: string | string[] | {
130
131
  fields: string[];
131
132
  unique?: boolean;
package/lib/collection.js CHANGED
@@ -597,6 +597,12 @@ const _Collection = class _Collection extends import_events.EventEmitter {
597
597
  }
598
598
  this.setField(options.name || name, options);
599
599
  }
600
+ normalizeFieldName(val) {
601
+ if (!this.options.underscored) {
602
+ return val;
603
+ }
604
+ return Array.isArray(val) ? val.map((v) => (0, import_utils.snakeCase)(v)) : (0, import_utils.snakeCase)(val);
605
+ }
600
606
  addIndex(index) {
601
607
  if (!index) {
602
608
  return;
@@ -626,7 +632,7 @@ const _Collection = class _Collection extends import_events.EventEmitter {
626
632
  return;
627
633
  }
628
634
  for (const item of indexes) {
629
- if (import_lodash.default.isEqual(item.fields, indexName)) {
635
+ if (import_lodash.default.isEqual(this.normalizeFieldName(item.fields), this.normalizeFieldName(indexName))) {
630
636
  return;
631
637
  }
632
638
  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": "2.0.0-alpha.32",
3
+ "version": "2.0.0-alpha.34",
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": "2.0.0-alpha.32",
10
- "@nocobase/utils": "2.0.0-alpha.32",
9
+ "@nocobase/logger": "2.0.0-alpha.34",
10
+ "@nocobase/utils": "2.0.0-alpha.34",
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": "50bb60d2f42e0fc2c1cd1eee397f9c0da94084df"
42
+ "gitHead": "d7bda14bac775be7ef207cb25986511740b2ed70"
43
43
  }