mirror of
https://github.com/drawdb-io/drawdb.git
synced 2025-05-24 02:09:17 +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 }));
|
||||
setDragging({ element: ObjectType.NONE, id: -1, prevX: 0, prevY: 0 });
|
||||
setLinking(true);
|
||||
|
@ -317,10 +317,10 @@ export default function Table(props) {
|
||||
onPointerDown={(e) => {
|
||||
if (!e.isPrimary) return;
|
||||
|
||||
handleGripField(index);
|
||||
handleGripField(fieldData);
|
||||
setLinkingLine((prev) => ({
|
||||
...prev,
|
||||
startFieldId: index,
|
||||
startFieldId: fieldData.id,
|
||||
startTableId: tableData.id,
|
||||
startX: tableData.x + 15,
|
||||
startY:
|
||||
|
@ -146,6 +146,7 @@ const en = {
|
||||
relationship_deleted: "Relationship deleted",
|
||||
type_deleted: "Type deleted",
|
||||
cannot_connect: "Cannot connect, the columns have different types",
|
||||
cannot_fk: "Cannot create foreign key from this field",
|
||||
copied_to_clipboard: "Copied to clipboard",
|
||||
create_new_diagram: "Create new diagram",
|
||||
cancel: "Cancel",
|
||||
|
Loading…
Reference in New Issue
Block a user