isKey: e.card.length >= 2 && e.card[1] == 'R', //"weak tables" foreign keys become part of the key
name: "#" + e2.name + "_" + attr.name,
type: attr.type,
isKey: e.card.length >= 2 && e.card[1] == 'R', //"weak tables" foreign keys become part of the key
name: "#" + e2.name + "_" + attr.name,
type: attr.type,
if (newTableAttrs.length > 1)
{
// Ok, really create a new table
let newTable = {
if (newTableAttrs.length > 1)
{
// Ok, really create a new table
let newTable = {
_.shuffle(Object.keys(this.tables)).forEach( name => {
mldDot += '"' + name + '" [label=<<table BORDER="1" ALIGN="LEFT" CELLPADDING="5" CELLSPACING="0">\n';
mldDot += '<tr><td BGCOLOR="#ae7d4e" BORDER="0"><font COLOR="#FFFFFF">' + name + '</font></td></tr>\n';
_.shuffle(Object.keys(this.tables)).forEach( name => {
mldDot += '"' + name + '" [label=<<table BORDER="1" ALIGN="LEFT" CELLPADDING="5" CELLSPACING="0">\n';
mldDot += '<tr><td BGCOLOR="#ae7d4e" BORDER="0"><font COLOR="#FFFFFF">' + name + '</font></td></tr>\n';
let label = (f.isKey ? '<u>' : '') + (!!f.qualifiers && f.qualifiers.indexOf("foreign")>=0 ? '#' : '') + f.name + (f.isKey ? '</u>' : '');
mldDot += '<tr><td port="' + f.name + '"' + (f.isKey ? ' port="__key"' : '')
+ ' BGCOLOR="#FFFFFF" BORDER="0" ALIGN="LEFT"><font COLOR="#000000" >' + label + '</font></td></tr>\n';
if (!!f.ref)
{
if (Math.random() < 0.5)
let label = (f.isKey ? '<u>' : '') + (!!f.qualifiers && f.qualifiers.indexOf("foreign")>=0 ? '#' : '') + f.name + (f.isKey ? '</u>' : '');
mldDot += '<tr><td port="' + f.name + '"' + (f.isKey ? ' port="__key"' : '')
+ ' BGCOLOR="#FFFFFF" BORDER="0" ALIGN="LEFT"><font COLOR="#000000" >' + label + '</font></td></tr>\n';
if (!!f.ref)
{
if (Math.random() < 0.5)
ErDiags.AjaxGet(mldDot, graphSvg => {
this.mldGraph = graphSvg;
element.innerHTML = graphSvg;
ErDiags.AjaxGet(mldDot, graphSvg => {
this.mldGraph = graphSvg;
element.innerHTML = graphSvg;