mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Added support for composite foreign keys in the ERD tool. Fixes #6891
This commit is contained in:
committed by
Akshay Joshi
parent
96ce298789
commit
8b7b63868f
@@ -256,7 +256,13 @@ export default class ForeignKeySchema extends BaseUISchema {
|
||||
}
|
||||
}
|
||||
|
||||
let oldindex = 'fki_'+actionObj.oldState.name;
|
||||
let oldindex;
|
||||
if(obj.inTable) {
|
||||
let oldFk = _.get(actionObj.oldState, _.slice(actionObj.path, 0, -1));
|
||||
oldindex = 'fki_'+oldFk.name;
|
||||
} else {
|
||||
oldindex = 'fki_'+actionObj.oldState.name;
|
||||
}
|
||||
if(state.hasindex) {
|
||||
return {};
|
||||
} else if(!state.autoindex) {
|
||||
|
||||
@@ -352,6 +352,15 @@ export default class TableSchema extends BaseUISchema {
|
||||
delete c.inheritedfromtable;
|
||||
return c;
|
||||
});
|
||||
|
||||
/* Make autoindex as true if there is coveringindex since ERD works in create mode */
|
||||
newData.foreign_key = (newData.foreign_key||[]).map((fk)=>{
|
||||
fk.autoindex = false;
|
||||
if(fk.coveringindex) {
|
||||
fk.autoindex = true;
|
||||
}
|
||||
return fk;
|
||||
});
|
||||
return newData;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user