@nocobase/database 1.4.0-alpha.20240923152933 → 1.4.0-alpha.20240928155737
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
|
@@ -64,6 +64,7 @@ var import_database_utils = __toESM(require("./database-utils"));
|
|
|
64
64
|
var import_references_map = __toESM(require("./features/references-map"));
|
|
65
65
|
var import_referential_integrity_check = require("./features/referential-integrity-check");
|
|
66
66
|
var FieldTypes = __toESM(require("./fields"));
|
|
67
|
+
var import_helpers = require("./helpers");
|
|
67
68
|
var import_inherited_collection = require("./inherited-collection");
|
|
68
69
|
var import_inherited_map = __toESM(require("./inherited-map"));
|
|
69
70
|
var import_interface_manager = require("./interface-manager");
|
|
@@ -360,9 +361,6 @@ const _Database = class _Database extends import_events.EventEmitter {
|
|
|
360
361
|
options.underscored = true;
|
|
361
362
|
}
|
|
362
363
|
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
364
|
if (import_lodash.default.get(options, "indexes")) {
|
|
367
365
|
options.indexes = options.indexes.map((index) => {
|
|
368
366
|
if (index.fields) {
|
|
@@ -661,7 +659,7 @@ const _Database = class _Database extends import_events.EventEmitter {
|
|
|
661
659
|
* @internal
|
|
662
660
|
*/
|
|
663
661
|
async checkVersion() {
|
|
664
|
-
return
|
|
662
|
+
return process.env.DB_SKIP_VERSION_CHECK === "on" || await (0, import_helpers.checkDatabaseVersion)(this);
|
|
665
663
|
}
|
|
666
664
|
/**
|
|
667
665
|
* @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.
|
|
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");
|
package/lib/fields/sort-field.js
CHANGED
|
@@ -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
|
|
161
|
-
|
|
162
|
-
|
|
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.4.0-alpha.
|
|
3
|
+
"version": "1.4.0-alpha.20240928155737",
|
|
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.4.0-alpha.
|
|
10
|
-
"@nocobase/utils": "1.4.0-alpha.
|
|
9
|
+
"@nocobase/logger": "1.4.0-alpha.20240928155737",
|
|
10
|
+
"@nocobase/utils": "1.4.0-alpha.20240928155737",
|
|
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": "
|
|
41
|
+
"gitHead": "f2765665126f5e9b5ae01f9ca6e8a151916554b4"
|
|
42
42
|
}
|