@nocobase/database 1.6.0-beta.1 → 1.6.0-beta.10

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.
@@ -29,15 +29,18 @@ export type DumpRules = BuiltInGroup | ({
29
29
  } & BaseDumpRules) | ({
30
30
  group: BuiltInGroup | string;
31
31
  } & BaseDumpRules);
32
+ export type MigrationRule = 'overwrite' | 'skip' | 'upsert' | 'schema-only' | 'insert-ignore' | (string & {}) | null;
32
33
  export interface CollectionOptions extends Omit<ModelOptions, 'name' | 'hooks'> {
33
34
  name: string;
34
35
  title?: string;
35
36
  namespace?: string;
37
+ migrationRules?: MigrationRule[];
36
38
  dumpRules?: DumpRules;
37
39
  tableName?: string;
38
40
  inherits?: string[] | string;
39
41
  viewName?: string;
40
42
  writableView?: boolean;
43
+ isThrough?: boolean;
41
44
  filterTargetKey?: string | string[];
42
45
  fields?: FieldOptions[];
43
46
  fieldSort?: string[];
package/lib/database.js CHANGED
@@ -220,6 +220,7 @@ const _Database = class _Database extends import_events.EventEmitter {
220
220
  autoGenId: false,
221
221
  timestamps: false,
222
222
  dumpRules: "required",
223
+ migrationRules: ["schema-only", "overwrite"],
223
224
  origin: "@nocobase/database",
224
225
  fields: [{ type: "string", name: "name", primaryKey: true }]
225
226
  });
@@ -14,4 +14,5 @@ export declare class MysqlDialect extends BaseDialect {
14
14
  get: (v: string) => string;
15
15
  version: string;
16
16
  };
17
+ getSequelizeOptions(options: any): any;
17
18
  }
@@ -32,6 +32,7 @@ __export(mysql_dialect_exports, {
32
32
  MysqlDialect: () => MysqlDialect
33
33
  });
34
34
  module.exports = __toCommonJS(mysql_dialect_exports);
35
+ var import_utils = require("@nocobase/utils");
35
36
  var import_base_dialect = require("./base-dialect");
36
37
  const _MysqlDialect = class _MysqlDialect extends import_base_dialect.BaseDialect {
37
38
  getVersionGuard() {
@@ -44,6 +45,10 @@ const _MysqlDialect = class _MysqlDialect extends import_base_dialect.BaseDialec
44
45
  version: ">=8.0.17"
45
46
  };
46
47
  }
48
+ getSequelizeOptions(options) {
49
+ import_utils.lodash.set(options, "dialectOptions.multipleStatements", true);
50
+ return options;
51
+ }
47
52
  };
48
53
  __name(_MysqlDialect, "MysqlDialect");
49
54
  __publicField(_MysqlDialect, "dialectName", "mysql");
@@ -125,7 +125,10 @@ const _BelongsToManyField = class _BelongsToManyField extends import_relation_fi
125
125
  Through = database.getCollection(through);
126
126
  } else {
127
127
  const throughCollectionOptions = {
128
- name: through
128
+ name: through,
129
+ isThrough: true,
130
+ sourceCollectionName: this.collection.name,
131
+ targetCollectionName: this.target
129
132
  };
130
133
  if (this.collection.options.dumpRules) {
131
134
  throughCollectionOptions["dumpRules"] = this.collection.options.dumpRules;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@nocobase/database",
3
- "version": "1.6.0-beta.1",
3
+ "version": "1.6.0-beta.10",
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.6.0-beta.1",
10
- "@nocobase/utils": "1.6.0-beta.1",
9
+ "@nocobase/logger": "1.6.0-beta.10",
10
+ "@nocobase/utils": "1.6.0-beta.10",
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": "69a79d1ed9660beb14ee956ec634f0c6d142acfa"
41
+ "gitHead": "72684ad7261e46b67969ecc4db0f1bcbea545a8d"
42
42
  }