oracle: fixed analysing constraints

This commit is contained in:
Jan Prochazka 2024-05-31 16:45:33 +02:00
parent 8f5b395935
commit 2d1ac97191
3 changed files with 5 additions and 5 deletions

View File

@ -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 => ({

View File

@ -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

View File

@ -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
`;