15
"emailaddress" [shape = record, label = "<col0> \N | id: serial\l email: text\l person: integer\l status: integer\l" ];
17
"gpgkey" [shape = record, label = "<col0> \N | id: serial\l person: integer\l keyid: text\l fingerprint: text\l pubkey: text\l revoked: boolean\l algorithm: integer\l keysize: integer\l" ];
19
"ircid" [shape = record, label = "<col0> \N | id: serial\l person: integer\l network: text\l nickname: text\l" ];
21
"jabberid" [shape = record, label = "<col0> \N | id: serial\l person: integer\l jabberid: text\l" ];
23
"karma" [shape = record, label = "<col0> \N | id: serial\l karmafield: integer\l datecreated: timestamp without time zone\l person: integer\l points: integer\l" ];
25
"logintoken" [shape = record, label = "<col0> \N | id: serial\l requester: integer\l requesteremail: text\l email: text\l created: timestamp without time zone\l tokentype: integer\l token: text\l" ];
27
"person" [shape = record, label = "<col0> \N | id: serial\l displayname: text\l givenname: text\l familyname: text\l password: text\l teamowner: integer\l teamdescription: text\l karma: integer\l karmatimestamp: timestamp without time zone\l name: text\l language: integer\l fti: tsvector\l" ];
29
"personlabel" [shape = record, label = "<col0> \N | person: integer\l label: integer\l" ];
31
"personlanguage" [shape = record, label = "<col0> \N | id: serial\l person: integer\l language: integer\l" ];
33
"sshkey" [shape = record, label = "<col0> \N | id: serial\l person: integer\l keytype: integer\l keytext: text\l comment: text\l" ];
35
"teammembership" [shape = record, label = "<col0> \N | id: serial\l person: integer\l team: integer\l role: integer\l status: integer\l" ];
37
"teamparticipation" [shape = record, label = "<col0> \N | id: serial\l team: integer\l person: integer\l" ];
39
"wikiname" [shape = record, label = "<col0> \N | id: serial\l person: integer\l wiki: text\l wikiname: text\l" ];
42
"emailaddress" -> "person" [label=""];
43
"gpgkey" -> "person" [label=""];
44
"ircid" -> "person" [label=""];
45
"jabberid" -> "person" [label=""];
46
"karma" -> "person" [label="karma_person_fk"];
47
"logintoken" -> "person" [label="logintoken_requester_fk"];
48
"person" -> "person" [label=""];
49
"personlabel" -> "person" [label=""];
50
"personlanguage" -> "person" [label="personlanguage_person_fk"];
51
"sshkey" -> "person" [label=""];
52
"teammembership" -> "person" [label=""];
53
"teammembership" -> "person" [label=""];
54
"teamparticipation" -> "person" [label=""];
55
"teamparticipation" -> "person" [label=""];
56
"wikiname" -> "person" [label=""];
60
# Shorten timestamp declarations
62
dot = re.subn('timestamp without time zone','timestamp', dot)[0]
64
lines = dot.split('\n')
65
for i in xrange(0, len(lines)):
67
if r'label = "<col0> \N' in line:
70
label \s = \s "<col0> \s \\N \s \| \s+ (.+?)" \s ];$
72
assert m is not None, 'Bad line %s' % repr(m)
75
assert raw_cols.endswith(r'\l'), 'Bad column list'
77
r.strip() for r in raw_cols.split(r'\l') if r.strip()
79
cols = [c.split(':') for c in raw_cols]
80
cols = [(a.strip(), b.strip()) for a,b in cols]
82
# This version looks nicer, but we have two cells for a table
83
# column instead of one and we will have more difficulty using
84
#label = r"{<col0>\N|{{"
85
#for col, typ in cols:
86
# label += r"%s |" % col
87
#label = label[:-1] + "}|{"
88
#for col, typ in cols:
89
# label += r"%s |" % typ
90
#label = label[:-1] + "}}}"
91
#label = '"%s"' % label
94
# This version is feature full, but looks crappy since we
95
# can't control fonts or cell formatting
96
#label = r"{<col0>\N | "
98
# label += r'<%s> %s: %s |' % (col, col, typ)
102
#label = '"%s"' % label
105
# This version uses new HTML tables
108
<TABLE BGCOLOR="azure3" BORDER="1" ALIGN="LEFT" PORT="col1">
110
<TD BGCOLOR="white" COLSPAN="2" ALIGN="CENTER">\\N</TD>
112
for col, typ in cols:
113
label += '<TR BORDER="0" PORT="%s">\n' % col
114
label += '<TD ALIGN="LEFT" BORDER="0">%s</TD>\n' % col
115
label += '<TD ALIGN="LEFT" BORDER="0">%s</TD>\n' % typ
117
label += '</TABLE>\n>'
119
lines[i] = '"%s" [shape = %s, label = %s ];' % (table, shape, label)