mirror of
https://github.com/drawdb-io/drawdb.git
synced 2025-09-01 18:35:24 +00:00
Fix invalid field indexes after import (#466)
* Fix invalid field indexes after import * fix postgres types
This commit is contained in:
@@ -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.`,
|
||||
|
@@ -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 = {
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -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 = {
|
||||
|
Reference in New Issue
Block a user