Option to show dot input without running graphviz
[erdiag.git] / examples / example2.html
1 <h2>MCD graph:</h3>
2 <div id="mcd"></div>
3
4 <h2>MLD graph:</h2>
5 <div id="mld"></div>
6
7 <h2>SQL instructions:</h2>
8 <div id="sql"></div>
9
10 <script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script>
11 <script src="parser.js"></script>
12 <script>
13 let er =
14 new ErDiags(`
15 [Users]
16 +id
17 name VARCHAR NOT NULL
18 email VARCHAR
19 location VARCHAR
20 birthdate DATE
21 gender CHARACTER
22 avatar BLOB
23
24 [Groups]
25 +id
26 name VARCHAR NOT NULL
27 description TEXT
28
29 [Events]
30 +id
31 name VARCHAR NOT NULL
32 description TEXT
33
34 [Messages]
35 +id
36 date DATE NOT NULL
37 content TEXT NOT NULL
38 receiver INTEGER REFERENCES Users(id) NOT NULL
39
40 [Posts]
41 +id
42 content TEXT NOT NULL
43 date DATE NOT NULL
44 type VARCHAR NOT NULL DEFAULT "Wall"
45 reference INTEGER NOT NULL
46
47 {publish}
48 Posts 1
49 Users *
50
51 {send}
52 Messages 1
53 Users *
54
55 {like}
56 Users *
57 Posts *
58
59 {follow}
60 Users *
61 Users *
62
63 {friend_with}
64 Users *
65 Users *
66
67 {participate}
68 Events *
69 Users *
70 --
71 degree VARCHAR NOT NULL DEFAULT "sure"
72 creator BOOLEAN
73
74 {belong_to}
75 Groups +
76 Users *
77 --
78 creator BOOLEAN
79 `);
80 er.drawMcd("mcd"); //,"bubble"
81 er.drawMld("mld");
82 er.fillSql("sql");
83 </script>