From 646571ef767674eec04a091efc95fc81706ada71 Mon Sep 17 00:00:00 2001 From: 1ilit Date: Tue, 23 Jan 2024 08:57:21 +0200 Subject: [PATCH] Fix relationship position update bug in undo --- src/components/ControlPanel.jsx | 8 ++++---- src/components/Table.jsx | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/components/ControlPanel.jsx b/src/components/ControlPanel.jsx index d13fef0..2abf33b 100644 --- a/src/components/ControlPanel.jsx +++ b/src/components/ControlPanel.jsx @@ -223,7 +223,7 @@ export default function ControlPanel({ } else if (a.component === "field_delete") { setRelationships((prev) => { return prev.map((e) => { - if (e.startTableId === a.tid && e.startFieldId > a.data.id) { + if (e.startTableId === a.tid && e.startFieldId >= a.data.id) { return { ...e, startFieldId: e.startFieldId + 1, @@ -231,7 +231,7 @@ export default function ControlPanel({ startY: tables[a.tid].y + (e.startFieldId + 1) * 36 + 50 + 19, }; } - if (e.endTableId === a.tid && e.endFieldId > a.data.id) { + if (e.endTableId === a.tid && e.endFieldId >= a.data.id) { return { ...e, endFieldId: e.endFieldId + 1, @@ -1256,8 +1256,8 @@ export default function ControlPanel({ field.comment = ""; field.unique = false; if (d.unique) field.unique = true; - field.auto_increment = false; - if (d.auto_increment) field.auto_increment = true; + field.increment = false; + if (d.auto_increment) field.increment = true; field.notNull = false; if (d.nullable) field.notNull = true; field.primary = false; diff --git a/src/components/Table.jsx b/src/components/Table.jsx index aa11c1e..0f01e7d 100644 --- a/src/components/Table.jsx +++ b/src/components/Table.jsx @@ -1266,7 +1266,6 @@ export default function Table(props) {
{hoveredField === index ? ( -