Skip to content

Commit 35d55a0

Browse files
authored
Merge pull request #282 from ruizhiii/fix/foreign-key-case-sensitive
Fix foreign key comparison case sensitive
2 parents 90f70a7 + dcf73e6 commit 35d55a0

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

src/utils/importSQL/mariadb.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export function fromMariaDB(ast, diagramDb = DB.GENERIC) {
105105
}
106106
});
107107
});
108-
} else if (d.constraint_type === "FOREIGN KEY") {
108+
} else if (d.constraint_type.toLowerCase() === "foreign key") {
109109
const relationship = {};
110110
const startTableId = table.id;
111111
const startTable = e.table[0].table;
@@ -187,7 +187,7 @@ export function fromMariaDB(ast, diagramDb = DB.GENERIC) {
187187
e.expr.forEach((expr) => {
188188
if (
189189
expr.action === "add" &&
190-
expr.create_definitions.constraint_type === "FOREIGN KEY"
190+
expr.create_definitions.constraint_type.toLowerCase() === "foreign key"
191191
) {
192192
const relationship = {};
193193
const startTable = e.table[0].table;

src/utils/importSQL/mssql.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export function fromMSSQL(ast, diagramDb = DB.GENERIC) {
117117
}
118118
});
119119
});
120-
} else if (d.constraint_type === "FOREIGN KEY") {
120+
} else if (d.constraint_type.toLowerCase() === "foreign key") {
121121
const relationship = {};
122122
const startTableId = table.id;
123123
const startTable = e.table[0].table;
@@ -199,7 +199,7 @@ export function fromMSSQL(ast, diagramDb = DB.GENERIC) {
199199
e.expr.forEach((expr) => {
200200
if (
201201
expr.action === "add" &&
202-
expr.create_definitions.constraint_type === "FOREIGN KEY"
202+
expr.create_definitions.constraint_type.toLowerCase() === "foreign key"
203203
) {
204204
const relationship = {};
205205
const startTable = e.table[0].table;

src/utils/importSQL/mysql.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export function fromMySQL(ast, diagramDb = DB.GENERIC) {
105105
}
106106
});
107107
});
108-
} else if (d.constraint_type === "FOREIGN KEY") {
108+
} else if (d.constraint_type.toLowerCase() === "foreign key") {
109109
const relationship = {};
110110
const startTableId = table.id;
111111
const startTable = e.table[0].table;
@@ -187,7 +187,7 @@ export function fromMySQL(ast, diagramDb = DB.GENERIC) {
187187
e.expr.forEach((expr) => {
188188
if (
189189
expr.action === "add" &&
190-
expr.create_definitions.constraint_type === "FOREIGN KEY"
190+
expr.create_definitions.constraint_type.toLowerCase() === "foreign key"
191191
) {
192192
const relationship = {};
193193
const startTable = e.table[0].table;

src/utils/importSQL/postgres.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export function fromPostgres(ast, diagramDb = DB.GENERIC) {
105105
}
106106
});
107107
});
108-
} else if (d.constraint_type === "FOREIGN KEY") {
108+
} else if (d.constraint_type.toLowerCase() === "foreign key") {
109109
const relationship = {};
110110
const startTableId = table.id;
111111
const startTable = e.table[0].table;
@@ -278,7 +278,7 @@ export function fromPostgres(ast, diagramDb = DB.GENERIC) {
278278
e.expr.forEach((expr) => {
279279
if (
280280
expr.action === "add" &&
281-
expr.create_definitions.constraint_type === "FOREIGN KEY"
281+
expr.create_definitions.constraint_type.toLowerCase() === "foreign key"
282282
) {
283283
const relationship = {};
284284
const startTable = e.table[0].table;

src/utils/importSQL/sqlite.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export function fromSQLite(ast, diagramDb = DB.GENERIC) {
122122
}
123123
});
124124
});
125-
} else if (d.constraint_type === "FOREIGN KEY") {
125+
} else if (d.constraint_type.toLowerCase() === "foreign key") {
126126
const relationship = {};
127127
const startTableId = table.id;
128128
const startTable = e.table[0].table;

0 commit comments

Comments
 (0)