From 0a60bd9bb051b2c6f77cba48f63f2068d15ea3a1 Mon Sep 17 00:00:00 2001 From: Karen Mkrtumyan Date: Sat, 9 Aug 2025 00:21:48 +0400 Subject: [PATCH] Import diagram fixes (#549) --- src/utils/importSQL/mariadb.js | 2 +- src/utils/importSQL/oraclesql.js | 11 ++++++----- src/utils/importSQL/postgres.js | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/utils/importSQL/mariadb.js b/src/utils/importSQL/mariadb.js index 8c7f3a8..4f06f37 100644 --- a/src/utils/importSQL/mariadb.js +++ b/src/utils/importSQL/mariadb.js @@ -121,7 +121,7 @@ export function fromMariaDB(ast, diagramDb = DB.GENERIC) { const endField = endTable.fields.find( (f) => f.name === endFieldName, ); - if (endField) return; + if (!endField) return; const startField = table.fields.find( (f) => f.name === startFieldName, diff --git a/src/utils/importSQL/oraclesql.js b/src/utils/importSQL/oraclesql.js index ab06554..de76814 100644 --- a/src/utils/importSQL/oraclesql.js +++ b/src/utils/importSQL/oraclesql.js @@ -4,10 +4,12 @@ import { dbToTypes } from "../../data/datatypes"; const affinity = { [DB.ORACLESQL]: new Proxy( - { INT: "INTEGER" }, - { NUMERIC: "NUMBER" }, - { DECIMAL: "NUMBER" }, - { CHARACTER: "CHAR" }, + { + INT: "INTEGER", + NUMERIC: "NUMBER", + DECIMAL: "NUMBER", + CHARACTER: "CHAR", + }, { get: (target, prop) => (prop in target ? target[prop] : "BLOB") }, ), [DB.GENERIC]: new Proxy( @@ -25,7 +27,6 @@ export function fromOracleSQL(ast, diagramDb = DB.GENERIC) { const enums = []; const parseSingleStatement = (e) => { - console.log(e); if (e.operation === "create") { if (e.object === "table") { const table = {}; diff --git a/src/utils/importSQL/postgres.js b/src/utils/importSQL/postgres.js index a375171..50a496b 100644 --- a/src/utils/importSQL/postgres.js +++ b/src/utils/importSQL/postgres.js @@ -13,7 +13,7 @@ const affinity = { INTEGER: "INT", MEDIUMINT: "INTEGER", BIT: "BOOLEAN", - "CHATACTER VARYING": "VARCHAR", + "CHARACTER VARYING": "VARCHAR", }, { get: (target, prop) => (prop in target ? target[prop] : "BLOB") }, ),