refs #5541 Added/fixed per table: showField, relation, idName
gitea/mylogger/pipeline/head This commit looks good
Details
gitea/mylogger/pipeline/head This commit looks good
Details
This commit is contained in:
parent
7c27e96243
commit
c007d316e8
|
@ -22,6 +22,7 @@ dstDb:
|
|||
showFields:
|
||||
- name
|
||||
- description
|
||||
- nickname
|
||||
castTypes:
|
||||
tinyint: boolean
|
||||
logs:
|
||||
|
|
13
mylogger.js
13
mylogger.js
|
@ -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
|
||||
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue