@nocobase/plugin-workflow-manual 1.6.0 → 1.6.2

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.
@@ -8,7 +8,7 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "1.6.0",
11
+ "@nocobase/client": "1.6.2",
12
12
  "react": "18.2.0",
13
13
  "@formily/react": "2.3.0",
14
14
  "@formily/antd-v5": "1.1.9",
@@ -18,13 +18,13 @@ module.exports = {
18
18
  "dayjs": "1.11.10",
19
19
  "react-i18next": "11.18.6",
20
20
  "lodash": "4.17.21",
21
- "@nocobase/plugin-workflow": "1.6.0",
22
- "@nocobase/utils": "1.6.0",
23
- "@nocobase/server": "1.6.0",
24
- "@nocobase/actions": "1.6.0",
25
- "@nocobase/resourcer": "1.6.0",
26
- "@nocobase/test": "1.6.0",
27
- "@nocobase/plugin-workflow-test": "1.6.0",
21
+ "@nocobase/plugin-workflow": "1.6.2",
22
+ "@nocobase/utils": "1.6.2",
23
+ "@nocobase/server": "1.6.2",
24
+ "@nocobase/actions": "1.6.2",
25
+ "@nocobase/resourcer": "1.6.2",
26
+ "@nocobase/test": "1.6.2",
27
+ "@nocobase/plugin-workflow-test": "1.6.2",
28
28
  "@formily/core": "2.3.0",
29
- "@nocobase/database": "1.6.0"
29
+ "@nocobase/database": "1.6.2"
30
30
  };
@@ -31,29 +31,55 @@ __export(change_table_name_exports, {
31
31
  module.exports = __toCommonJS(change_table_name_exports);
32
32
  var import_server = require("@nocobase/server");
33
33
  class change_table_name_default extends import_server.Migration {
34
- appVersion = "<1.6.0";
34
+ appVersion = "<1.7.0";
35
35
  on = "beforeLoad";
36
36
  async up() {
37
37
  const { db } = this.context;
38
38
  const queryInterface = db.sequelize.getQueryInterface();
39
+ const usersJobsCollection = db.collection({
40
+ name: "users_jobs",
41
+ fields: [{ name: "id", type: "bigInt" }]
42
+ });
43
+ const workflowManualTasksCollection = db.collection({
44
+ name: "workflowManualTasks",
45
+ fields: [{ name: "id", type: "bigInt" }]
46
+ });
47
+ const oldTableName = usersJobsCollection.getTableNameWithSchema();
48
+ const oldTableNameWithQuotes = usersJobsCollection.getRealTableName(true);
49
+ const newTableName = workflowManualTasksCollection.getTableNameWithSchema();
50
+ const newTableNameWithQuotes = workflowManualTasksCollection.getRealTableName(true);
39
51
  await db.sequelize.transaction(async (transaction) => {
40
- const exists = await queryInterface.tableExists("users_jobs", { transaction });
52
+ const exists = await queryInterface.tableExists(oldTableName, { transaction });
41
53
  if (exists) {
42
- const newTableName = db.options.underscored ? "workflow_manual_tasks" : "workflowManualTasks";
43
- await queryInterface.renameTable("users_jobs", newTableName, { transaction });
54
+ const newExists = await queryInterface.tableExists(newTableName, { transaction });
55
+ if (newExists) {
56
+ await queryInterface.dropTable(newTableName, { transaction });
57
+ }
58
+ if (this.db.isPostgresCompatibleDialect()) {
59
+ await db.sequelize.query(
60
+ `ALTER TABLE ${oldTableNameWithQuotes} RENAME TO "${db.options.tablePrefix || ""}${db.options.underscored ? "workflow_manual_tasks" : "workflowManualTasks"}";`,
61
+ {
62
+ transaction
63
+ }
64
+ );
65
+ } else {
66
+ await queryInterface.renameTable(oldTableName, newTableName, { transaction });
67
+ }
44
68
  const indexes = await queryInterface.showIndex(newTableName, { transaction });
69
+ const oldIndexPrefix = `${db.options.tablePrefix || ""}users_jobs`;
70
+ const newIndexPrefix = `${db.options.tablePrefix || ""}workflow_manual_tasks`;
45
71
  for (const item of indexes) {
46
- if (item.name.startsWith("users_jobs")) {
72
+ if (item.name.startsWith(oldIndexPrefix)) {
47
73
  if (this.db.isPostgresCompatibleDialect()) {
48
74
  await db.sequelize.query(
49
- `ALTER INDEX "${item.name}" RENAME TO "${item.name.replace("users_jobs", "workflow_manual_tasks")}";`,
75
+ `ALTER INDEX ${db.options.schema ? `"${db.options.schema}".` : ""}"${item.name}" RENAME TO "${item.name.replace(oldIndexPrefix, newIndexPrefix)}";`,
50
76
  { transaction }
51
77
  );
52
78
  } else if (this.db.isMySQLCompatibleDialect()) {
53
79
  await db.sequelize.query(
54
- `ALTER TABLE ${newTableName} RENAME INDEX ${item.name} TO ${item.name.replace(
55
- "users_jobs",
56
- "workflow_manual_tasks"
80
+ `ALTER TABLE ${newTableNameWithQuotes} RENAME INDEX ${item.name} TO ${item.name.replace(
81
+ oldIndexPrefix,
82
+ newIndexPrefix
57
83
  )};`,
58
84
  { transaction }
59
85
  );
@@ -62,5 +88,7 @@ class change_table_name_default extends import_server.Migration {
62
88
  }
63
89
  }
64
90
  });
91
+ db.removeCollection("users_jobs");
92
+ db.removeCollection("workflowManualTasks");
65
93
  }
66
94
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "工作流:人工处理节点",
5
5
  "description": "Could be used for workflows which some of decisions are made by users.",
6
6
  "description.zh-CN": "用于人工控制部分决策的流程。",
7
- "version": "1.6.0",
7
+ "version": "1.6.2",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "./dist/server/index.js",
10
10
  "homepage": "https://docs.nocobase.com/handbook/workflow-manual",
@@ -30,7 +30,7 @@
30
30
  "@nocobase/test": "1.x",
31
31
  "@nocobase/utils": "1.x"
32
32
  },
33
- "gitHead": "7422d72a4e515a11300860028a26030ed5732135",
33
+ "gitHead": "d1f1a2c1a038986f751abdeb82e9df97a2fd9e25",
34
34
  "keywords": [
35
35
  "Workflow"
36
36
  ]