forked from osiris/sugar-graphviz
-
Notifications
You must be signed in to change notification settings - Fork 1
/
graphviz.sql
100 lines (94 loc) · 6.29 KB
/
graphviz.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
DROP TABLE IF EXISTS graphviz_colors;
create table graphviz_colors (colorname varchar(50) not null default '');
insert into graphviz_colors (colorname) values ('aquamarine');
insert into graphviz_colors (colorname) values ('black');
insert into graphviz_colors (colorname) values ('blue');
insert into graphviz_colors (colorname) values ('blueviolet');
insert into graphviz_colors (colorname) values ('brown');
insert into graphviz_colors (colorname) values ('burlywood');
insert into graphviz_colors (colorname) values ('cadetblue');
insert into graphviz_colors (colorname) values ('chocolate');
insert into graphviz_colors (colorname) values ('coral');
insert into graphviz_colors (colorname) values ('cornflowerblue');
insert into graphviz_colors (colorname) values ('crimson');
insert into graphviz_colors (colorname) values ('cyan');
insert into graphviz_colors (colorname) values ('darkgoldenrod');
insert into graphviz_colors (colorname) values ('darkgreen');
insert into graphviz_colors (colorname) values ('darkkhaki');
insert into graphviz_colors (colorname) values ('darkolivegreen');
insert into graphviz_colors (colorname) values ('darkorange');
insert into graphviz_colors (colorname) values ('darkorchid');
insert into graphviz_colors (colorname) values ('darksalmon');
insert into graphviz_colors (colorname) values ('darkseagreen');
insert into graphviz_colors (colorname) values ('darkslateblue');
insert into graphviz_colors (colorname) values ('darkslategray');
insert into graphviz_colors (colorname) values ('darkturquoise');
insert into graphviz_colors (colorname) values ('darkviolet');
insert into graphviz_colors (colorname) values ('deeppink');
insert into graphviz_colors (colorname) values ('deepskyblue');
insert into graphviz_colors (colorname) values ('dimgray');
insert into graphviz_colors (colorname) values ('dodgerblue');
insert into graphviz_colors (colorname) values ('firebrick');
insert into graphviz_colors (colorname) values ('forestgreen');
insert into graphviz_colors (colorname) values ('gold');
insert into graphviz_colors (colorname) values ('goldenrod');
insert into graphviz_colors (colorname) values ('gray');
insert into graphviz_colors (colorname) values ('green');
insert into graphviz_colors (colorname) values ('greenyellow');
insert into graphviz_colors (colorname) values ('hotpink');
insert into graphviz_colors (colorname) values ('indianred');
insert into graphviz_colors (colorname) values ('indigo');
insert into graphviz_colors (colorname) values ('lawngreen');
insert into graphviz_colors (colorname) values ('limegreen');
insert into graphviz_colors (colorname) values ('magenta');
insert into graphviz_colors (colorname) values ('maroon');
insert into graphviz_colors (colorname) values ('mediumaquamarine');
insert into graphviz_colors (colorname) values ('mediumblue');
insert into graphviz_colors (colorname) values ('mediumorchid');
insert into graphviz_colors (colorname) values ('mediumpurple');
insert into graphviz_colors (colorname) values ('mediumseagreen');
insert into graphviz_colors (colorname) values ('mediumslateblue');
insert into graphviz_colors (colorname) values ('mediumspringgreen');
insert into graphviz_colors (colorname) values ('mediumturquoise');
insert into graphviz_colors (colorname) values ('mediumvioletred');
insert into graphviz_colors (colorname) values ('midnightblue');
insert into graphviz_colors (colorname) values ('navy');
insert into graphviz_colors (colorname) values ('navyblue');
insert into graphviz_colors (colorname) values ('olivedrab');
insert into graphviz_colors (colorname) values ('orange');
insert into graphviz_colors (colorname) values ('orangered');
insert into graphviz_colors (colorname) values ('orchid');
insert into graphviz_colors (colorname) values ('palegreen');
insert into graphviz_colors (colorname) values ('paleturquoise');
insert into graphviz_colors (colorname) values ('palevioletred');
insert into graphviz_colors (colorname) values ('peru');
insert into graphviz_colors (colorname) values ('pink');
insert into graphviz_colors (colorname) values ('plum');
insert into graphviz_colors (colorname) values ('powderblue');
insert into graphviz_colors (colorname) values ('purple');
insert into graphviz_colors (colorname) values ('red');
insert into graphviz_colors (colorname) values ('rosybrown');
insert into graphviz_colors (colorname) values ('royalblue');
insert into graphviz_colors (colorname) values ('saddlebrown');
insert into graphviz_colors (colorname) values ('salmon');
insert into graphviz_colors (colorname) values ('sandybrown');
insert into graphviz_colors (colorname) values ('seagreen');
insert into graphviz_colors (colorname) values ('sienna');
insert into graphviz_colors (colorname) values ('skyblue');
insert into graphviz_colors (colorname) values ('slateblue');
insert into graphviz_colors (colorname) values ('slategray');
insert into graphviz_colors (colorname) values ('springgreen');
insert into graphviz_colors (colorname) values ('steelblue');
insert into graphviz_colors (colorname) values ('tan');
insert into graphviz_colors (colorname) values ('thistle');
insert into graphviz_colors (colorname) values ('tomato');
insert into graphviz_colors (colorname) values ('turquoise');
insert into graphviz_colors (colorname) values ('violet');
insert into graphviz_colors (colorname) values ('violetred');
insert into graphviz_colors (colorname) values ('yellow');
insert into graphviz_colors (colorname) values ('yellowgreen');
drop table if exists graphviz_tables;
create table graphviz_tables (tablename varchar(50) not null default '',colorname varchar(50) not null default 'gray');
insert into graphviz_tables (tablename,colorname) select distinct lhs_table as tablename, (select colorname from graphviz_colors order by rand() limit 1) as colorname from relationships where lhs_table is not null group by lhs_table;
insert into graphviz_tables (tablename,colorname) select distinct rhs_table as tablename, (select colorname from graphviz_colors order by rand() limit 1) as colorname from relationships where rhs_table not in (select tablename from graphviz_tables) group by rhs_table;
insert into graphviz_tables (tablename,colorname) select distinct join_table as tablename, (select colorname from graphviz_colors order by rand() limit 1) as colorname from relationships where join_table not in (select tablename from graphviz_tables) group by join_table;