Skip to content

Free, simple, and intuitive online database diagram editor and SQL generator.

Fix relationship position update bug in undo

1ilit646571ef7676
diff --git a/src/components/ControlPanel.jsx b/src/components/ControlPanel.jsx
index d13fef05..2abf33bb 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 aa11c1e8..0f01e7d0 100644
--- a/src/components/Table.jsx
+++ b/src/components/Table.jsx
@@ -1266,7 +1266,6 @@ export default function Table(props) {
</div>
<div className="text-zinc-400">
{hoveredField === index ? (
-
<Button
theme="solid"
size="small"