remove links in table editor

This commit is contained in:
Jan Prochazka
2021-09-12 08:45:52 +02:00
parent f47c83fece
commit e7c64265ae
6 changed files with 94 additions and 6 deletions

View File

@@ -21,19 +21,19 @@ export function generateTablePairingId(table: TableInfo): TableInfo {
if (!table.pairingId) {
return {
...table,
columns: table.columns.map(col => ({
columns: table.columns?.map(col => ({
...col,
pairingId: col.pairingId || uuidv1(),
})),
foreignKeys: table.foreignKeys.map(cnt => ({
foreignKeys: table.foreignKeys?.map(cnt => ({
...cnt,
pairingId: cnt.pairingId || uuidv1(),
})),
checks: table.checks.map(cnt => ({
checks: table.checks?.map(cnt => ({
...cnt,
pairingId: cnt.pairingId || uuidv1(),
})),
indexes: table.indexes.map(cnt => ({
indexes: table.indexes?.map(cnt => ({
...cnt,
pairingId: cnt.pairingId || uuidv1(),
})),

View File

@@ -155,5 +155,13 @@ export function editorDeleteConstraint(table: TableInfo, constraint: ConstraintI
res.foreignKeys = table.foreignKeys.filter(x => x.pairingId != constraint.pairingId);
}
if (constraint.constraintType == 'index') {
res.indexes = table.indexes.filter(x => x.pairingId != constraint.pairingId);
}
if (constraint.constraintType == 'unique') {
res.uniques = table.uniques.filter(x => x.pairingId != constraint.pairingId);
}
return res;
}