Skip to content

Commit 622a54f

Browse files
authored
Merge pull request #13 from funktechno/f/lastlink
make matching case insensitive
2 parents fda0fe8 + 83a7736 commit 622a54f

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -418,13 +418,13 @@ export class SqlSimpleParser {
418418
this.primaryKeyList.forEach((pk) => {
419419
// find table index
420420
var pkTableIndex = this.tableList.findIndex(
421-
(t) => t.Name == pk.PrimaryKeyTableName
421+
(t) => t.Name.toLocaleLowerCase() == pk.PrimaryKeyTableName.toLocaleLowerCase()
422422
);
423423

424424
// find property index
425425
if (pkTableIndex > -1) {
426426
var propertyIndex = this.tableList[pkTableIndex].Properties.findIndex(
427-
(p) => p.Name == pk.PrimaryKeyName
427+
(p) => p.Name.toLocaleLowerCase() == pk.PrimaryKeyName.toLocaleLowerCase()
428428
);
429429
if (propertyIndex > -1) {
430430
this.tableList[pkTableIndex].Properties[
@@ -438,7 +438,7 @@ export class SqlSimpleParser {
438438
this.foreignKeyList.forEach((fk) => {
439439
// find table index
440440
var pkTableIndex = this.tableList.findIndex(
441-
(t) => t.Name == fk.ReferencesTableName
441+
(t) => t.Name.toLocaleLowerCase() == fk.ReferencesTableName.toLocaleLowerCase()
442442
);
443443

444444
// var fkTableIndex = this.tableList.findIndex(
@@ -448,7 +448,7 @@ export class SqlSimpleParser {
448448
// find property index
449449
if (pkTableIndex > -1) {
450450
var propertyIndex = this.tableList[pkTableIndex].Properties.findIndex(
451-
(p) => p.Name == fk.PrimaryKeyName
451+
(p) => p.Name.toLocaleLowerCase() == fk.PrimaryKeyName.toLocaleLowerCase()
452452
);
453453
if (propertyIndex > -1) {
454454
this.tableList[pkTableIndex].Properties[

tests/data/results/ToModel.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20538,7 +20538,7 @@
2053820538
}
2053920539
],
2054020540
"IsForeignKey": false,
20541-
"IsPrimaryKey": false
20541+
"IsPrimaryKey": true
2054220542
},
2054320543
{
2054420544
"Name": "LastName",

0 commit comments

Comments
 (0)