From 9fd682ccdc350824274f73692ce12f225805bd95 Mon Sep 17 00:00:00 2001 From: 1ilit <1ilit@proton.me> Date: Sat, 28 Sep 2024 18:02:49 +0400 Subject: [PATCH] Fix corrupted endFieldIds after import --- src/utils/importSQL/mariadb.js | 4 ++-- src/utils/importSQL/mssql.js | 4 ++-- src/utils/importSQL/mysql.js | 4 ++-- src/utils/importSQL/sqlite.js | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/utils/importSQL/mariadb.js b/src/utils/importSQL/mariadb.js index 7746175..563200e 100644 --- a/src/utils/importSQL/mariadb.js +++ b/src/utils/importSQL/mariadb.js @@ -119,7 +119,7 @@ export function fromMariaDB(ast, diagramDb = DB.GENERIC) { const endFieldId = tables[endTableId].fields.findIndex( (f) => f.name === endField, ); - if (endField === -1) return; + if (endFieldId === -1) return; const startFieldId = table.fields.findIndex( (f) => f.name === startField, @@ -223,7 +223,7 @@ export function fromMariaDB(ast, diagramDb = DB.GENERIC) { const endFieldId = tables[endTableId].fields.findIndex( (f) => f.name === endField, ); - if (endField === -1) return; + if (endFieldId === -1) return; const startFieldId = tables[startTableId].fields.findIndex( (f) => f.name === startField, diff --git a/src/utils/importSQL/mssql.js b/src/utils/importSQL/mssql.js index bb7a95e..740f744 100644 --- a/src/utils/importSQL/mssql.js +++ b/src/utils/importSQL/mssql.js @@ -131,7 +131,7 @@ export function fromMSSQL(ast, diagramDb = DB.GENERIC) { const endFieldId = tables[endTableId].fields.findIndex( (f) => f.name === endField, ); - if (endField === -1) return; + if (endFieldId === -1) return; const startFieldId = table.fields.findIndex( (f) => f.name === startField, @@ -235,7 +235,7 @@ export function fromMSSQL(ast, diagramDb = DB.GENERIC) { const endFieldId = tables[endTableId].fields.findIndex( (f) => f.name === endField, ); - if (endField === -1) return; + if (endFieldId === -1) return; const startFieldId = tables[startTableId].fields.findIndex( (f) => f.name === startField, diff --git a/src/utils/importSQL/mysql.js b/src/utils/importSQL/mysql.js index e829727..f8b3715 100644 --- a/src/utils/importSQL/mysql.js +++ b/src/utils/importSQL/mysql.js @@ -119,7 +119,7 @@ export function fromMySQL(ast, diagramDb = DB.GENERIC) { const endFieldId = tables[endTableId].fields.findIndex( (f) => f.name === endField, ); - if (endField === -1) return; + if (endFieldId === -1) return; const startFieldId = table.fields.findIndex( (f) => f.name === startField, @@ -223,7 +223,7 @@ export function fromMySQL(ast, diagramDb = DB.GENERIC) { const endFieldId = tables[endTableId].fields.findIndex( (f) => f.name === endField, ); - if (endField === -1) return; + if (endFieldId === -1) return; const startFieldId = tables[startTableId].fields.findIndex( (f) => f.name === startField, diff --git a/src/utils/importSQL/sqlite.js b/src/utils/importSQL/sqlite.js index f279219..5bd3a1b 100644 --- a/src/utils/importSQL/sqlite.js +++ b/src/utils/importSQL/sqlite.js @@ -136,7 +136,7 @@ export function fromSQLite(ast, diagramDb = DB.GENERIC) { const endFieldId = tables[endTableId].fields.findIndex( (f) => f.name === endField, ); - if (endField === -1) return; + if (endFieldId === -1) return; const startFieldId = table.fields.findIndex( (f) => f.name === startField,