mm_mysql 2.3.3 → 2.3.4
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/db.js +3 -3
- package/package.json +4 -4
package/db.js
CHANGED
|
@@ -205,7 +205,7 @@ DB.prototype.fields = async function (table, field_name, timeout = 15000) {
|
|
|
205
205
|
if (!targetTable) {
|
|
206
206
|
throw new TypeError('table must be specified');
|
|
207
207
|
}
|
|
208
|
-
const field = 'COLUMN_NAME as `name`,ORDINAL_POSITION as `cid`,COLUMN_DEFAULT as `
|
|
208
|
+
const field = 'COLUMN_NAME as `name`,ORDINAL_POSITION as `cid`,COLUMN_DEFAULT as `default_value`,IS_NULLABLE as `not_null`,COLUMN_TYPE as `type`,COLUMN_KEY as `pk`,EXTRA as `auto`,COLUMN_COMMENT as `note`';
|
|
209
209
|
let sql = 'select ' + field + " from information_schema.COLUMNS where `table_name` = '" + targetTable +
|
|
210
210
|
"' and `table_schema` = '" + this.database() + "'";
|
|
211
211
|
if (field_name) {
|
|
@@ -215,7 +215,7 @@ DB.prototype.fields = async function (table, field_name, timeout = 15000) {
|
|
|
215
215
|
const len = list.length;
|
|
216
216
|
for (let i = 0; i < len; i++) {
|
|
217
217
|
list[i].pk = !!list[i].pk;
|
|
218
|
-
list[i].
|
|
218
|
+
list[i].not_null = list[i].not_null === 'NO';
|
|
219
219
|
}
|
|
220
220
|
return list;
|
|
221
221
|
} catch (err) {
|
|
@@ -591,7 +591,7 @@ DB.prototype.backupTable = function (table, backup, timeout = 60000) {
|
|
|
591
591
|
* @param {string} table 表名
|
|
592
592
|
* @param {object} model 表模型,键值对,根据值类型创建字段类型,根据键名创建字段名
|
|
593
593
|
* @param {string} key 主键
|
|
594
|
-
* @param timeout
|
|
594
|
+
* @param timeout
|
|
595
595
|
* @returns {Promise | number} 操作结果
|
|
596
596
|
*/
|
|
597
597
|
DB.prototype.createTable = function (table, model, key = 'id', timeout = 15000) {
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mm_mysql",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.4",
|
|
4
4
|
"description": "这是超级美眉mysql帮助函数模块,用于便捷操作mysql,使用await方式,可以避免嵌套函数",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"mm_expand": "^2.
|
|
8
|
-
"mysql2": "^3.
|
|
7
|
+
"mm_expand": "^2.1.9",
|
|
8
|
+
"mysql2": "^3.22.0",
|
|
9
9
|
"sqlstring": "^2.3.3"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"node": ">=12.0.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"eslint": "^10.
|
|
39
|
+
"eslint": "^10.2.0",
|
|
40
40
|
"eslint-plugin-jsdoc": "^62.9.0",
|
|
41
41
|
"mm_eslint": "^1.7.1"
|
|
42
42
|
}
|