Free, simple, and intuitive online database diagram editor and SQL generator.
JavaScript databasedatabase-designdatabase-diagramdatabase-schemadbmldiagram-editoreditorer-diagramerderdiagramindexeddbmariadbmcporacle-databaseoracle-dbpostgresqlschema-designsqlsql-serversqlite
Fix invalid field indexes after import (#466)
1ilitf2d60a70e03a
diff --git a/src/components/EditorHeader/Modal/Modal.jsx b/src/components/EditorHeader/Modal/Modal.jsxindex e6fc3b3a..a5833bf2 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.jsindex 97bcadd6..c1d70a3a 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.jsindex fcd75397..ab065544 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.jsindex b992dead..57987251 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 = {