Skip to content

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

Fix inline REFERENCES not creating relationships in PostgreSQL import (#1020)

casar687a5c2a9fb5f2
diff --git a/src/utils/importSQL/postgres.js b/src/utils/importSQL/postgres.js
index 66103769..0e517e6e 100644
--- a/src/utils/importSQL/postgres.js
+++ b/src/utils/importSQL/postgres.js
@@ -209,7 +209,7 @@ export function fromPostgres(ast, diagramDb = DB.GENERIC) {
const endTable = tables.find((t) => t.name === endTableName);
if (!endTable) return;
- const endField = endTable.fields.findIndex(
+ const endField = endTable.fields.find(
(f) => f.name === endFieldName,
);
if (!endField) return;