1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

feat: schema size in explore bar

This commit is contained in:
2021-11-06 16:36:54 +01:00
parent 5ca3a22dc5
commit fd25f881f9
3 changed files with 34 additions and 3 deletions

View File

@ -187,6 +187,7 @@ export class MySQLClient extends AntaresCore {
const tablesArr = [];
const triggersArr = [];
let schemaSize = 0;
for (const db of filteredDatabases) {
if (!schemas.has(db.Database)) continue;
@ -224,6 +225,9 @@ export class MySQLClient extends AntaresCore {
break;
}
const tableSize = table.Data_length + table.Index_length;
schemaSize += tableSize;
return {
name: table.Name,
type: tableType,
@ -232,7 +236,7 @@ export class MySQLClient extends AntaresCore {
updated: table.Update_time,
engine: table.Engine,
comment: table.Comment,
size: table.Data_length + table.Index_length,
size: tableSize,
autoIncrement: table.Auto_increment,
collation: table.Collation
};
@ -309,6 +313,7 @@ export class MySQLClient extends AntaresCore {
return {
name: db.Database,
size: schemaSize,
tables: remappedTables,
functions: remappedFunctions,
procedures: remappedProcedures,
@ -319,6 +324,7 @@ export class MySQLClient extends AntaresCore {
else {
return {
name: db.Database,
size: 0,
tables: [],
functions: [],
procedures: [],