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:
- name
- description
- nickname
castTypes:
tinyint: boolean
logs:

View File

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

View File

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