postgre sql indexes analysis - partialy working

This commit is contained in:
Jan Prochazka
2021-08-20 22:17:02 +02:00
parent 89c904abc1
commit 820044b489
4 changed files with 46 additions and 1 deletions

View File

@@ -65,6 +65,7 @@ class Analyser extends DatabaseAnalyser {
? await this.driver.query(this.pool, this.createQuery('matviewColumns', ['matviews']))
: null;
const routines = await this.driver.query(this.pool, this.createQuery('routines', ['procedures', 'functions']));
const indexes = await this.driver.query(this.pool, this.createQuery('indexes', ['tables']));
return {
tables: tables.rows.map(table => {
@@ -104,6 +105,13 @@ class Analyser extends DatabaseAnalyser {
refSchemaName: x.ref_schema_name,
}))
),
indexes: indexes.rows
.filter(x => x.table_name == table.pure_name && x.schema_name == table.schema_name)
.map(idx => ({
constraintName: idx.index_name,
isUnique: idx.is_unique,
columns: idx.column_names.split('|').map(columnName => ({ columnName })),
})),
};
}),
views: views.rows.map(view => ({