mirror of
https://github.com/drawdb-io/drawdb.git
synced 2025-05-24 10:29:11 +00:00
Se añadió la función que solo se pueda formar una FK desde un atributo válido.
This commit is contained in:
parent
7e12237459
commit
f3cf17820e
@ -400,7 +400,11 @@ export default function Canvas() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleGripField = () => {
|
const handleGripField = (field) => {
|
||||||
|
if (!field.primary && !(field.notNull && field.unique)) {
|
||||||
|
Toast.info(t("cannot_fk"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
setPanning((old) => ({ ...old, isPanning: false }));
|
setPanning((old) => ({ ...old, isPanning: false }));
|
||||||
setDragging({ element: ObjectType.NONE, id: -1, prevX: 0, prevY: 0 });
|
setDragging({ element: ObjectType.NONE, id: -1, prevX: 0, prevY: 0 });
|
||||||
setLinking(true);
|
setLinking(true);
|
||||||
|
@ -317,10 +317,10 @@ export default function Table(props) {
|
|||||||
onPointerDown={(e) => {
|
onPointerDown={(e) => {
|
||||||
if (!e.isPrimary) return;
|
if (!e.isPrimary) return;
|
||||||
|
|
||||||
handleGripField(index);
|
handleGripField(fieldData);
|
||||||
setLinkingLine((prev) => ({
|
setLinkingLine((prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
startFieldId: index,
|
startFieldId: fieldData.id,
|
||||||
startTableId: tableData.id,
|
startTableId: tableData.id,
|
||||||
startX: tableData.x + 15,
|
startX: tableData.x + 15,
|
||||||
startY:
|
startY:
|
||||||
|
@ -146,6 +146,7 @@ const en = {
|
|||||||
relationship_deleted: "Relationship deleted",
|
relationship_deleted: "Relationship deleted",
|
||||||
type_deleted: "Type deleted",
|
type_deleted: "Type deleted",
|
||||||
cannot_connect: "Cannot connect, the columns have different types",
|
cannot_connect: "Cannot connect, the columns have different types",
|
||||||
|
cannot_fk: "Cannot create foreign key from this field",
|
||||||
copied_to_clipboard: "Copied to clipboard",
|
copied_to_clipboard: "Copied to clipboard",
|
||||||
create_new_diagram: "Create new diagram",
|
create_new_diagram: "Create new diagram",
|
||||||
cancel: "Cancel",
|
cancel: "Cancel",
|
||||||
|
Loading…
Reference in New Issue
Block a user