mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
postgres analyse index desc #514
This commit is contained in:
parent
9d4105335f
commit
feed0cd8db
@ -199,19 +199,23 @@ class Analyser extends DatabaseAnalyser {
|
|||||||
x.schema_name == table.schema_name &&
|
x.schema_name == table.schema_name &&
|
||||||
!uniqueNames.rows.find(y => y.constraint_name == x.index_name)
|
!uniqueNames.rows.find(y => y.constraint_name == x.index_name)
|
||||||
)
|
)
|
||||||
.map(idx => ({
|
.map(idx => {
|
||||||
constraintName: idx.index_name,
|
const indOptionSplit = idx.indoption.split(' ');
|
||||||
isUnique: idx.is_unique,
|
return {
|
||||||
columns: _.compact(
|
constraintName: idx.index_name,
|
||||||
idx.indkey
|
isUnique: idx.is_unique,
|
||||||
.split(' ')
|
columns: _.compact(
|
||||||
.map(colid => indexcols.rows.find(col => col.oid == idx.oid && col.attnum == colid))
|
idx.indkey
|
||||||
.filter(col => col != null)
|
.split(' ')
|
||||||
.map(col => ({
|
.map(colid => indexcols.rows.find(col => col.oid == idx.oid && col.attnum == colid))
|
||||||
columnName: col.column_name,
|
.filter(col => col != null)
|
||||||
}))
|
.map((col, colIndex) => ({
|
||||||
),
|
columnName: col.column_name,
|
||||||
})),
|
isDescending: parseInt(indOptionSplit[colIndex]) > 0,
|
||||||
|
}))
|
||||||
|
),
|
||||||
|
};
|
||||||
|
}),
|
||||||
uniques: indexes.rows
|
uniques: indexes.rows
|
||||||
.filter(
|
.filter(
|
||||||
x =>
|
x =>
|
||||||
|
@ -6,6 +6,7 @@ module.exports = `
|
|||||||
ix.indisprimary as "is_primary",
|
ix.indisprimary as "is_primary",
|
||||||
ix.indisunique as "is_unique",
|
ix.indisunique as "is_unique",
|
||||||
ix.indkey as "indkey",
|
ix.indkey as "indkey",
|
||||||
|
ix.indoption as "indoption",
|
||||||
t.oid as "oid"
|
t.oid as "oid"
|
||||||
from
|
from
|
||||||
pg_class t,
|
pg_class t,
|
||||||
|
Loading…
Reference in New Issue
Block a user