diff --git a/src/components/EditorHeader/Modal/Modal.jsx b/src/components/EditorHeader/Modal/Modal.jsx index e6fc3b3a5..a5833bf2f 100644 --- a/src/components/EditorHeader/Modal/Modal.jsx +++ b/src/components/EditorHeader/Modal/Modal.jsx @@ -191,7 +191,8 @@ export default function Modal({ } setModal(MODAL.NONE); - } catch { + } catch (e) { + console.log(e) setError({ type: STATUS.ERROR, message: `Please check for syntax errors or let us know about the error.`, diff --git a/src/utils/importSQL/mysql.js b/src/utils/importSQL/mysql.js index 97bcadd6d..c1d70a3ae 100644 --- a/src/utils/importSQL/mysql.js +++ b/src/utils/importSQL/mysql.js @@ -168,9 +168,6 @@ export function fromMySQL(ast, diagramDb = DB.GENERIC) { } }); - table.fields.forEach((f, j) => { - f.id = j; - }); tables.push(table); } else if (e.keyword === "index") { const index = { diff --git a/src/utils/importSQL/oraclesql.js b/src/utils/importSQL/oraclesql.js index fcd753978..ab0655440 100644 --- a/src/utils/importSQL/oraclesql.js +++ b/src/utils/importSQL/oraclesql.js @@ -122,9 +122,6 @@ export function fromOracleSQL(ast, diagramDb = DB.GENERIC) { relationships.push(relationship); } }); - table.fields.forEach((f, j) => { - f.id = j; - }); tables.push(table); } } diff --git a/src/utils/importSQL/postgres.js b/src/utils/importSQL/postgres.js index b992deadb..57987251c 100644 --- a/src/utils/importSQL/postgres.js +++ b/src/utils/importSQL/postgres.js @@ -51,8 +51,8 @@ export function fromPostgres(ast, diagramDb = DB.GENERIC) { ), )?.name; if (!type && !dbToTypes[diagramDb][d.definition.dataType]) - type = affinity[diagramDb][type]; - field.type = type || d.definition.dataType; + type = affinity[diagramDb][d.definition.dataType.toUpperCase()]; + field.type = type; if (d.definition.expr && d.definition.expr.type === "expr_list") { field.values = d.definition.expr.value.map((v) => v.value); @@ -134,7 +134,9 @@ export function fromPostgres(ast, diagramDb = DB.GENERIC) { ); if (!endField) return; - const startField = table.find((f) => f.name === startFieldName); + const startField = table.fields.find( + (f) => f.name === startFieldName, + ); if (!startField) return; relationship.name = `fk_${startTableName}_${startFieldName}_${endTableName}`; @@ -226,9 +228,6 @@ export function fromPostgres(ast, diagramDb = DB.GENERIC) { relationships.forEach((r, i) => (r.id = i)); } }); - table.fields.forEach((f, j) => { - f.id = j; - }); tables.push(table); } else if (e.keyword === "index") { const index = {