projects
/
erdiag.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8edb29f
)
Do not add extra 'NOT NULL' when irrelevant
author
Benjamin Auder
<benjamin.auder@somewhere>
Sat, 3 Feb 2018 00:11:24 +0000
(
01:11
+0100)
committer
Benjamin Auder
<benjamin.auder@somewhere>
Sat, 3 Feb 2018 00:11:24 +0000
(
01:11
+0100)
parser.js
patch
|
blob
|
blame
|
history
diff --git
a/parser.js
b/parser.js
index
2b75709
..
65ac9ec
100644
(file)
--- a/
parser.js
+++ b/
parser.js
@@
-207,11
+207,13
@@
class ErDiags
this.entities[e2.name].attributes.forEach( attr => {
if (attr.isKey)
{
this.entities[e2.name].attributes.forEach( attr => {
if (attr.isKey)
{
+ // For "weak tables", foreign keys become part of the key
+ const isKey = e.card.length >= 2 && e.card[1] == 'R';
this.tables[e.name].push({
this.tables[e.name].push({
- isKey:
e.card.length >= 2 && e.card[1] == 'R', //"weak tables" foreign keys become part of the key
+ isKey:
isKey,
name: e2.name + "_" + attr.name,
type: attr.type,
name: e2.name + "_" + attr.name,
type: attr.type,
- qualifiers: "foreign key references " + e2.name + " " + (e.card[0]=='1' ? "not null" : ""),
+ qualifiers: "foreign key references " + e2.name + " " + (
!isKey &&
e.card[0]=='1' ? "not null" : ""),
ref: e2.name, //easier drawMld function (fewer regexps)
});
}
ref: e2.name, //easier drawMld function (fewer regexps)
});
}
@@
-241,7
+243,7
@@
class ErDiags
name: item.entity + "_" + f.name,
isKey: true,
type: f.type,
name: item.entity + "_" + f.name,
isKey: true,
type: f.type,
- qualifiers: (f.qualifiers || "") + " foreign key references " + item.entity
+ " not null"
,
+ qualifiers: (f.qualifiers || "") + " foreign key references " + item.entity,
ref: item.entity,
});
});
ref: item.entity,
});
});