befly 3.21.1 → 3.22.0
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/README.md +7 -0
- package/apis/admin/list.js +1 -1
- package/apis/admin/upd.js +2 -2
- package/apis/dict/all.js +1 -1
- package/apis/dict/detail.js +1 -1
- package/apis/dict/list.js +1 -1
- package/apis/dict/upd.js +1 -1
- package/apis/dictType/upd.js +1 -1
- package/apis/role/all.js +1 -1
- package/apis/role/list.js +1 -1
- package/apis/role/upd.js +1 -1
- package/checks/config.js +1 -3
- package/checks/table.js +2 -15
- package/configs/beflyConfig.json +1 -3
- package/index.js +5 -10
- package/lib/dbHelper.js +201 -736
- package/lib/dbParse.js +1045 -0
- package/lib/dbUtil.js +83 -438
- package/lib/logger.js +21 -45
- package/lib/sqlBuilder.js +78 -294
- package/package.json +2 -2
- package/plugins/mysql.js +2 -1
- package/scripts/syncDb/context.js +62 -47
- package/scripts/syncDb/diff.js +78 -15
- package/scripts/syncDb/index.js +16 -46
- package/scripts/syncDb/report.js +97 -98
- package/tables/admin.json +24 -0
- package/tables/api.json +24 -0
- package/tables/dict.json +24 -0
- package/tables/dictType.json +24 -0
- package/tables/emailLog.json +24 -0
- package/tables/errorReport.json +140 -0
- package/tables/infoReport.json +123 -0
- package/tables/loginLog.json +24 -0
- package/tables/menu.json +24 -0
- package/tables/operateLog.json +24 -0
- package/tables/role.json +24 -0
- package/tables/sysConfig.json +24 -0
- package/utils/loggerUtils.js +9 -14
- package/utils/scanSources.js +3 -3
- package/scripts/syncDb/query.js +0 -26
package/utils/scanSources.js
CHANGED
|
@@ -15,16 +15,16 @@ export const scanSources = async () => {
|
|
|
15
15
|
const apis = [];
|
|
16
16
|
const plugins = [];
|
|
17
17
|
const hooks = [];
|
|
18
|
-
const tables =
|
|
18
|
+
const tables = {};
|
|
19
19
|
|
|
20
20
|
// 处理表格
|
|
21
21
|
const allCoreTables = await scanFiles(coreTableDir, "core", "table", "*.json");
|
|
22
22
|
for (const item of allCoreTables) {
|
|
23
|
-
tables.
|
|
23
|
+
tables[`befly${item.fileName.charAt(0).toUpperCase()}${item.fileName.slice(1)}`] = item.fieldsDef;
|
|
24
24
|
}
|
|
25
25
|
const allAppTables = await scanFiles(appTableDir, "app", "table", "*.json");
|
|
26
26
|
for (const item of allAppTables) {
|
|
27
|
-
tables.
|
|
27
|
+
tables[item.fileName] = item.fieldsDef;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
// 处理插件
|
package/scripts/syncDb/query.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
const SYNC_DB_COLUMNS_SQL = `
|
|
2
|
-
SELECT
|
|
3
|
-
c.TABLE_NAME AS tableName,
|
|
4
|
-
t.TABLE_COMMENT AS tableComment,
|
|
5
|
-
c.COLUMN_NAME AS columnName,
|
|
6
|
-
c.DATA_TYPE AS dataType,
|
|
7
|
-
c.COLUMN_TYPE AS columnType,
|
|
8
|
-
c.CHARACTER_MAXIMUM_LENGTH AS charLength,
|
|
9
|
-
c.COLUMN_COMMENT AS columnComment,
|
|
10
|
-
c.ORDINAL_POSITION AS ordinalPosition
|
|
11
|
-
FROM information_schema.COLUMNS AS c
|
|
12
|
-
LEFT JOIN information_schema.TABLES AS t
|
|
13
|
-
ON t.TABLE_SCHEMA = c.TABLE_SCHEMA
|
|
14
|
-
AND t.TABLE_NAME = c.TABLE_NAME
|
|
15
|
-
WHERE c.TABLE_SCHEMA = DATABASE()
|
|
16
|
-
ORDER BY c.TABLE_NAME ASC, c.ORDINAL_POSITION ASC
|
|
17
|
-
`;
|
|
18
|
-
|
|
19
|
-
export async function querySyncDbColumns(mysql) {
|
|
20
|
-
const queryRes = await mysql.execute(SYNC_DB_COLUMNS_SQL);
|
|
21
|
-
if (!Array.isArray(queryRes.data)) {
|
|
22
|
-
return [];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return queryRes.data;
|
|
26
|
-
}
|