diff --git a/plugins/dbgate-plugin-oracle/src/backend/Analyser.js b/plugins/dbgate-plugin-oracle/src/backend/Analyser.js index c1d14d92..07b45835 100644 --- a/plugins/dbgate-plugin-oracle/src/backend/Analyser.js +++ b/plugins/dbgate-plugin-oracle/src/backend/Analyser.js @@ -139,7 +139,7 @@ class Analyser extends DatabaseAnalyser { indexes: _.uniqBy( indexes.rows.filter( idx => - idx.tableName == table.pureName && !uniqueNames.rows.find(x => x.constraintName == idx.constraintName) + idx.tableName == newTable.pureName && !uniqueNames.rows.find(x => x.constraintName == idx.constraintName) ), 'constraintName' ).map(idx => ({ @@ -149,12 +149,13 @@ class Analyser extends DatabaseAnalyser { .filter(col => col.tableName == idx.tableName && col.constraintName == idx.constraintName) .map(col => ({ ..._.pick(col, ['columnName']), + isDescending: col.descending == 'DESC', })), })), uniques: _.uniqBy( indexes.rows.filter( idx => - idx.tableName == table.pureName && uniqueNames.rows.find(x => x.constraintName == idx.constraintName) + idx.tableName == newTable.pureName && uniqueNames.rows.find(x => x.constraintName == idx.constraintName) ), 'constraintName' ).map(idx => ({ diff --git a/plugins/dbgate-plugin-oracle/src/backend/sql/indexes.js b/plugins/dbgate-plugin-oracle/src/backend/sql/indexes.js index b1eb9d2e..fae13e68 100644 --- a/plugins/dbgate-plugin-oracle/src/backend/sql/indexes.js +++ b/plugins/dbgate-plugin-oracle/src/backend/sql/indexes.js @@ -5,7 +5,6 @@ select i.table_name as "tableName", i.index_type as "indexType", i.uniqueness as "Unique", ic.column_name as "columnName", - ic.column_position as "postion", ic.descend as "descending" from all_ind_columns ic, all_indexes i where INDEX_OWNER = '$owner' AND ic.index_owner = i.owner diff --git a/plugins/dbgate-plugin-oracle/src/backend/sql/uniqueNames.js b/plugins/dbgate-plugin-oracle/src/backend/sql/uniqueNames.js index 62a5b12d..b2d7d964 100644 --- a/plugins/dbgate-plugin-oracle/src/backend/sql/uniqueNames.js +++ b/plugins/dbgate-plugin-oracle/src/backend/sql/uniqueNames.js @@ -1,6 +1,6 @@ module.exports = ` -select constraint_name +select constraint_name as "constraintName" from all_constraints -where OWNER='$owner' and constraint_type = 'U' +where owner='$owner' and constraint_type = 'U' and constraint_name =OBJECT_ID_CONDITION `;