@nocobase/plugin-data-source-main 1.4.0-alpha.20241027230531 → 1.4.0-alpha.20241104151643
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/dist/externalVersion.js
CHANGED
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "1.4.0-alpha.
|
|
12
|
-
"@nocobase/database": "1.4.0-alpha.
|
|
13
|
-
"@nocobase/plugin-error-handler": "1.4.0-alpha.
|
|
14
|
-
"@nocobase/server": "1.4.0-alpha.
|
|
11
|
+
"@nocobase/client": "1.4.0-alpha.20241104151643",
|
|
12
|
+
"@nocobase/database": "1.4.0-alpha.20241104151643",
|
|
13
|
+
"@nocobase/plugin-error-handler": "1.4.0-alpha.20241104151643",
|
|
14
|
+
"@nocobase/server": "1.4.0-alpha.20241104151643",
|
|
15
15
|
"async-mutex": "0.3.2",
|
|
16
16
|
"lodash": "4.17.21",
|
|
17
|
-
"@nocobase/test": "1.4.0-alpha.
|
|
18
|
-
"@nocobase/utils": "1.4.0-alpha.
|
|
17
|
+
"@nocobase/test": "1.4.0-alpha.20241104151643",
|
|
18
|
+
"@nocobase/utils": "1.4.0-alpha.20241104151643",
|
|
19
19
|
"sequelize": "6.35.2",
|
|
20
20
|
"dayjs": "1.11.10"
|
|
21
21
|
};
|
|
@@ -72,6 +72,9 @@ class CollectionModel extends import_database.MagicAttributeModel {
|
|
|
72
72
|
if (!this.db.inDialect("postgres") && collectionOptions.schema) {
|
|
73
73
|
delete collectionOptions.schema;
|
|
74
74
|
}
|
|
75
|
+
if (this.db.inDialect("postgres") && !collectionOptions.schema && collectionOptions.from !== "db2cm") {
|
|
76
|
+
collectionOptions.schema = process.env.COLLECTION_MANAGER_SCHEMA || this.db.options.schema || "public";
|
|
77
|
+
}
|
|
75
78
|
if (this.db.hasCollection(name)) {
|
|
76
79
|
collection = this.db.getCollection(name);
|
|
77
80
|
if (skipExist) {
|
package/dist/server/server.d.ts
CHANGED
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
import { Filter } from '@nocobase/database';
|
|
10
10
|
import { Plugin } from '@nocobase/server';
|
|
11
11
|
export declare class PluginDataSourceMainServer extends Plugin {
|
|
12
|
-
schema: string;
|
|
13
12
|
private loadFilter;
|
|
14
13
|
setLoadFilter(filter: Filter): void;
|
|
15
14
|
onSync(message: any): Promise<void>;
|
package/dist/server/server.js
CHANGED
|
@@ -45,7 +45,6 @@ var import_server = require("@nocobase/server");
|
|
|
45
45
|
var import_async_mutex = require("async-mutex");
|
|
46
46
|
var import_lodash = __toESM(require("lodash"));
|
|
47
47
|
var import_path = __toESM(require("path"));
|
|
48
|
-
var process = __toESM(require("process"));
|
|
49
48
|
var import__ = require(".");
|
|
50
49
|
var import_hooks = require("./hooks");
|
|
51
50
|
var import_beforeCreateForValidateField = require("./hooks/beforeCreateForValidateField");
|
|
@@ -58,7 +57,6 @@ var import_beforeDestoryField = require("./hooks/beforeDestoryField");
|
|
|
58
57
|
var import_field_is_depended_on_by_other = require("./errors/field-is-depended-on-by-other");
|
|
59
58
|
var import_beforeCreateCheckFieldInMySQL = require("./hooks/beforeCreateCheckFieldInMySQL");
|
|
60
59
|
class PluginDataSourceMainServer extends import_server.Plugin {
|
|
61
|
-
schema;
|
|
62
60
|
loadFilter = {};
|
|
63
61
|
setLoadFilter(filter) {
|
|
64
62
|
this.loadFilter = filter;
|
|
@@ -75,9 +73,6 @@ class PluginDataSourceMainServer extends import_server.Plugin {
|
|
|
75
73
|
}
|
|
76
74
|
}
|
|
77
75
|
async beforeLoad() {
|
|
78
|
-
if (this.app.db.inDialect("postgres")) {
|
|
79
|
-
this.schema = process.env.COLLECTION_MANAGER_SCHEMA || this.db.options.schema || "public";
|
|
80
|
-
}
|
|
81
76
|
this.app.db.registerRepositories({
|
|
82
77
|
CollectionRepository: import__.CollectionRepository
|
|
83
78
|
});
|
|
@@ -92,11 +87,6 @@ class PluginDataSourceMainServer extends import_server.Plugin {
|
|
|
92
87
|
plugin: this
|
|
93
88
|
}
|
|
94
89
|
});
|
|
95
|
-
this.app.db.on("collections.beforeCreate", async (model) => {
|
|
96
|
-
if (this.app.db.inDialect("postgres") && this.schema && model.get("from") != "db2cm" && !model.get("schema")) {
|
|
97
|
-
model.set("schema", this.schema);
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
90
|
this.app.db.on("collections.beforeCreate", (0, import_beforeCreateForViewCollection.beforeCreateForViewCollection)(this.db));
|
|
101
91
|
this.app.db.on(
|
|
102
92
|
"collections.afterSaveWithAssociations",
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"displayName.zh-CN": "数据源:主数据库",
|
|
5
5
|
"description": "NocoBase main database, supports relational databases such as PostgreSQL, MySQL, MariaDB and so on.",
|
|
6
6
|
"description.zh-CN": "NocoBase 主数据库,支持 PostgreSQL、MySQL、MariaDB 等关系型数据库。",
|
|
7
|
-
"version": "1.4.0-alpha.
|
|
7
|
+
"version": "1.4.0-alpha.20241104151643",
|
|
8
8
|
"main": "./dist/server/index.js",
|
|
9
9
|
"homepage": "https://docs.nocobase.com/handbook/data-source-main",
|
|
10
10
|
"homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/data-source-main",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"@nocobase/test": "1.x",
|
|
23
23
|
"@nocobase/utils": "1.x"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "7596b7bb7568b6de5a8fc062eab2b1b7ecc09054",
|
|
26
26
|
"keywords": [
|
|
27
27
|
"Data sources"
|
|
28
28
|
]
|