refs #5541 Added/fixed per table: showField, relation, idName
gitea/mylogger/pipeline/head This commit looks good Details

This commit is contained in:
Juan Ferrer 2023-04-12 18:57:15 +02:00
parent 7c27e96243
commit c007d316e8
3 changed files with 28 additions and 16 deletions

View File

@ -22,6 +22,7 @@ dstDb:
showFields: showFields:
- name - name
- description - description
- nickname
castTypes: castTypes:
tinyint: boolean tinyint: boolean
logs: logs:

View File

@ -64,10 +64,19 @@ module.exports = class MyLogger {
? toUpperCamelCase(table.name) ? toUpperCamelCase(table.name)
: table.name; : table.name;
const {
showField,
relation,
idName
} = tableConf;
Object.assign(tableInfo, { Object.assign(tableInfo, {
conf: tableConf, conf: tableConf,
exclude: new Set(tableConf.exclude), exclude: new Set(tableConf.exclude),
modelName modelName,
showField,
relation,
idName,
}); });
return tableInfo; return tableInfo;
@ -200,6 +209,7 @@ module.exports = class MyLogger {
// Fetch primary key // Fetch primary key
if (!tableConf.idName) {
const [dbPks] = await db.query( const [dbPks] = await db.query(
`SELECT COLUMN_NAME idName `SELECT COLUMN_NAME idName
FROM information_schema.KEY_COLUMN_USAGE FROM information_schema.KEY_COLUMN_USAGE
@ -216,6 +226,7 @@ module.exports = class MyLogger {
for (const {idName} of dbPks) for (const {idName} of dbPks)
tableInfo.idName = idName; tableInfo.idName = idName;
}
// Get show field // Get show field

View File

@ -1,6 +1,6 @@
{ {
"name": "mylogger", "name": "mylogger",
"version": "0.1.7", "version": "0.1.9",
"author": "Verdnatura Levante SL", "author": "Verdnatura Levante SL",
"description": "MySQL and MariaDB logger using binary log", "description": "MySQL and MariaDB logger using binary log",
"license": "GPL-3.0", "license": "GPL-3.0",