This commit is contained in:
Jan Prochazka
2020-01-20 20:41:15 +01:00
parent 23492a3bef
commit 07e2b0f26f
6 changed files with 53 additions and 22 deletions

View File

@@ -1,8 +1,8 @@
const fp = require('lodash/fp');
const _ = require('lodash');
const connections = require('./connections');
const socket = require('../utility/socket');
const { fork } = require('child_process');
const DatabaseAnalyser = require('../engines/default/DatabaseAnalyser')
const DatabaseAnalyser = require('../engines/default/DatabaseAnalyser');
module.exports = {
/** @type {import('../types').OpenedDatabaseConnection[]} */
@@ -39,9 +39,12 @@ module.exports = {
return newOpened;
},
listTables_meta: 'get',
async listTables({ id, database }) {
listObjects_meta: 'get',
async listObjects({ id, database }) {
const opened = await this.ensureOpened(id, database);
return opened.structure.tables; // .map(fp.pick(['tableName', 'schemaName']));
const { tables } = opened.structure;
return {
tables: _.sortBy(tables, x => `${x.schemaName}.${x.pureName}`),
}; // .map(fp.pick(['tableName', 'schemaName']));
},
};

View File

@@ -1,5 +1,5 @@
select
o.name as tableName, s.name as schemaName, o.object_id,
o.name as pureName, s.name as schemaName, o.object_id,
o.create_date, o.modify_date
from sys.tables o
inner join sys.schemas s on o.schema_id = s.schema_id

View File

@@ -7,15 +7,12 @@ export interface EngineDriver {
analyseIncremental(pool): Promise<void>;
}
// export interface NameWithSchema {
// schema: string;
// name: string;
// }
export interface TableInfo {
// name: NameWithSchema;
tableName: string;
export interface NamedObjectInfo {
pureName: string;
schemaName: string;
}
export interface TableInfo extends NamedObjectInfo {
}
export interface DatabaseInfo {