@nocobase/database 1.2.6-alpha → 1.2.8-alpha

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.
@@ -113,8 +113,8 @@ const _MysqlQueryInterface = class _MysqlQueryInterface extends import_query_int
113
113
  const results = await this.db.sequelize.query(sql, { type: "SELECT", transaction });
114
114
  let currentVal = results[0]["currentVal"];
115
115
  if (currentVal === null) {
116
- const maxSql = `SELECT MAX(${fieldName}) as currentVal
117
- FROM ${tableInfo.tableName};`;
116
+ const maxSql = `SELECT MAX(\`${fieldName}\`) as currentVal
117
+ FROM \`${tableInfo.tableName}\`;`;
118
118
  const maxResults = await this.db.sequelize.query(maxSql, { type: "SELECT", transaction });
119
119
  currentVal = maxResults[0]["currentVal"];
120
120
  }
@@ -124,8 +124,10 @@ const _MysqlQueryInterface = class _MysqlQueryInterface extends import_query_int
124
124
  }
125
125
  async setAutoIncrementVal(options) {
126
126
  const { tableInfo, columnName, seqName, currentVal, transaction } = options;
127
- const sql = `ALTER TABLE ${this.quoteIdentifier(tableInfo.tableName)} AUTO_INCREMENT = ${currentVal};`;
128
- await this.db.sequelize.query(sql, { transaction });
127
+ if (currentVal) {
128
+ const sql = `ALTER TABLE ${this.quoteIdentifier(tableInfo.tableName)} AUTO_INCREMENT = ${currentVal};`;
129
+ await this.db.sequelize.query(sql, { transaction });
130
+ }
129
131
  }
130
132
  };
131
133
  __name(_MysqlQueryInterface, "MysqlQueryInterface");
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@nocobase/database",
3
- "version": "1.2.6-alpha",
3
+ "version": "1.2.8-alpha",
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.2.6-alpha",
10
- "@nocobase/utils": "1.2.6-alpha",
9
+ "@nocobase/logger": "1.2.8-alpha",
10
+ "@nocobase/utils": "1.2.8-alpha",
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": "c3a33ebeeb5ca33c0612946e3999cbbb2b7b5dae"
41
+ "gitHead": "23132ae9e60c152ea61b77a6371a41c684d4041a"
42
42
  }