mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-30 19:43:58 +00:00
SYNC: imrpoved logging of DB analyser
This commit is contained in:
committed by
Diflow
parent
da1efe880d
commit
9886c58681
@@ -49,6 +49,8 @@ export class DatabaseAnalyser<TClient = any> {
|
|||||||
singleObjectId: string = null;
|
singleObjectId: string = null;
|
||||||
dialect: SqlDialect;
|
dialect: SqlDialect;
|
||||||
logger: Logger;
|
logger: Logger;
|
||||||
|
startedTm = Date.now();
|
||||||
|
analyseIdentifier = Math.random().toString().substring(2);
|
||||||
|
|
||||||
constructor(public dbhan: DatabaseHandle<TClient>, public driver: EngineDriver, version) {
|
constructor(public dbhan: DatabaseHandle<TClient>, public driver: EngineDriver, version) {
|
||||||
this.dialect = (driver?.dialectByVersion && driver?.dialectByVersion(version)) || driver?.dialect;
|
this.dialect = (driver?.dialectByVersion && driver?.dialectByVersion(version)) || driver?.dialect;
|
||||||
@@ -78,7 +80,11 @@ export class DatabaseAnalyser<TClient = any> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getLogDbInfo() {
|
getLogDbInfo() {
|
||||||
return this.driver.getLogDbInfo(this.dbhan);
|
return {
|
||||||
|
...this.driver.getLogDbInfo(this.dbhan),
|
||||||
|
analyserTime: Date.now() - this.startedTm,
|
||||||
|
analyseIdentifier: this.analyseIdentifier,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async fullAnalysis() {
|
async fullAnalysis() {
|
||||||
@@ -124,6 +130,7 @@ export class DatabaseAnalyser<TClient = any> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (structureModifications.length == 0) {
|
if (structureModifications.length == 0) {
|
||||||
|
logger.debug(this.getLogDbInfo(), 'DBGM-00267 No changes in database structure detected');
|
||||||
return structureWithRowCounts ? this.addEngineField(structureWithRowCounts) : null;
|
return structureWithRowCounts ? this.addEngineField(structureWithRowCounts) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -376,6 +376,7 @@ class Analyser extends DatabaseAnalyser {
|
|||||||
|
|
||||||
this.logger.debug(
|
this.logger.debug(
|
||||||
{
|
{
|
||||||
|
...this.getLogDbInfo(),
|
||||||
tables: res.tables?.length,
|
tables: res.tables?.length,
|
||||||
columns: _.sum(res.tables?.map(x => x.columns?.length)),
|
columns: _.sum(res.tables?.map(x => x.columns?.length)),
|
||||||
primaryKeys: res.tables?.filter(x => x.primaryKey)?.length,
|
primaryKeys: res.tables?.filter(x => x.primaryKey)?.length,
|
||||||
|
|||||||
Reference in New Issue
Block a user