@nocobase/database 1.3.24-beta → 1.3.26-beta

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.
package/lib/database.js CHANGED
@@ -360,9 +360,6 @@ const _Database = class _Database extends import_events.EventEmitter {
360
360
  options.underscored = true;
361
361
  }
362
362
  if (options.underscored) {
363
- if (import_lodash.default.get(options, "sortable.scopeKey")) {
364
- options.sortable.scopeKey = (0, import_utils3.snakeCase)(options.sortable.scopeKey);
365
- }
366
363
  if (import_lodash.default.get(options, "indexes")) {
367
364
  options.indexes = options.indexes.map((index) => {
368
365
  if (index.fields) {
@@ -661,7 +658,7 @@ const _Database = class _Database extends import_events.EventEmitter {
661
658
  * @internal
662
659
  */
663
660
  async checkVersion() {
664
- return await (0, import_helpers.checkDatabaseVersion)(this);
661
+ return process.env.DB_SKIP_VERSION_CHECK === "on" || await (0, import_helpers.checkDatabaseVersion)(this);
665
662
  }
666
663
  /**
667
664
  * @internal
@@ -41,8 +41,14 @@ export interface RealFieldOptions extends BaseColumnFieldOptions {
41
41
  type: 'real';
42
42
  }
43
43
  export declare class DecimalField extends NumberField {
44
- get dataType(): DataTypes.DecimalDataTypeConstructor;
44
+ get dataType(): DataTypes.DecimalDataType;
45
+ static optionsFromRawType(rawType: string): {
46
+ precision: number;
47
+ scale: number;
48
+ };
45
49
  }
46
50
  export interface DecimalFieldOptions extends BaseColumnFieldOptions {
47
51
  type: 'decimal';
52
+ precision: number;
53
+ scale: number;
48
54
  }
@@ -79,7 +79,16 @@ __name(_RealField, "RealField");
79
79
  let RealField = _RealField;
80
80
  const _DecimalField = class _DecimalField extends NumberField {
81
81
  get dataType() {
82
- return import_sequelize.DataTypes.DECIMAL;
82
+ return import_sequelize.DataTypes.DECIMAL(this.options.precision, this.options.scale);
83
+ }
84
+ static optionsFromRawType(rawType) {
85
+ const matches = rawType.match(/DECIMAL\((\d+),\s*(\d+)\)/);
86
+ if (matches) {
87
+ return {
88
+ precision: parseInt(matches[1]),
89
+ scale: parseInt(matches[2])
90
+ };
91
+ }
83
92
  }
84
93
  };
85
94
  __name(_DecimalField, "DecimalField");
@@ -157,9 +157,9 @@ const _SortField = class _SortField extends import_field.Field {
157
157
  }, "doInit");
158
158
  const scopeKey = this.options.scopeKey;
159
159
  if (scopeKey) {
160
- const groups = await this.collection.repository.find({
161
- attributes: [scopeKey],
162
- group: [scopeKey],
160
+ const scopeKeyColumn = this.collection.model.rawAttributes[scopeKey].field;
161
+ const groups = await this.collection.model.findAll({
162
+ attributes: [[import_sequelize.Sequelize.fn("DISTINCT", import_sequelize.Sequelize.col(scopeKeyColumn)), scopeKey]],
163
163
  raw: true,
164
164
  transaction
165
165
  });
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@nocobase/database",
3
- "version": "1.3.24-beta",
3
+ "version": "1.3.26-beta",
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.24-beta",
10
- "@nocobase/utils": "1.3.24-beta",
9
+ "@nocobase/logger": "1.3.26-beta",
10
+ "@nocobase/utils": "1.3.26-beta",
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": "d575eb932c5651c2fa8dbef70e5c356efc6bf271"
41
+ "gitHead": "492868e32388615f75ba5af28f33420899d3b211"
42
42
  }