mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 11:26:00 +00:00
mysql index analysis works
This commit is contained in:
@@ -74,6 +74,7 @@ class Analyser extends DatabaseAnalyser {
|
||||
);
|
||||
|
||||
const viewTexts = await this.getViewTexts(views.rows.map(x => x.pureName));
|
||||
const indexes = await this.driver.query(this.pool, this.createQuery('indexes', ['tables']));
|
||||
|
||||
return {
|
||||
tables: tables.rows.map(table => ({
|
||||
@@ -83,6 +84,19 @@ class Analyser extends DatabaseAnalyser {
|
||||
columns: columns.rows.filter(col => col.pureName == table.pureName).map(getColumnInfo),
|
||||
primaryKey: DatabaseAnalyser.extractPrimaryKeys(table, pkColumns.rows),
|
||||
foreignKeys: DatabaseAnalyser.extractForeignKeys(table, fkColumns.rows),
|
||||
uniques: [],
|
||||
indexes: _.uniqBy(
|
||||
indexes.rows.filter(idx => idx.tableName == table.pureName),
|
||||
'constraintName'
|
||||
).map(idx => ({
|
||||
..._.pick(idx, ['constraintName', 'indexType']),
|
||||
isUnique: !idx.nonUnique,
|
||||
columns: indexes.rows
|
||||
.filter(col => col.tableName == idx.tableName && col.constraintName == idx.constraintName)
|
||||
.map(col => ({
|
||||
..._.pick(col, ['columnName']),
|
||||
})),
|
||||
})),
|
||||
})),
|
||||
views: views.rows.map(view => ({
|
||||
...view,
|
||||
|
||||
Reference in New Issue
Block a user