Skip to content

Commit ca145c7

Browse files
committed
Add tbls' JSON Schema ERD.
1 parent a6b5a80 commit ca145c7

File tree

2 files changed

+138
-1
lines changed

2 files changed

+138
-1
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ debug.log
2121
/tbls-driver-sf-cli-meta
2222
/tbls-driver-sf-cli-meta.exe
2323

24-
doc/schema
24+
/doc/schema

doc/design/tbls-schema-erd.md

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
# tbls JSON Schema ER diagram
2+
3+
```mermaid
4+
erDiagram
5+
Schema ||--o{ Table : tables
6+
Schema ||--o{ Relation : relations
7+
Schema ||--o{ Function : functions
8+
Schema ||--o{ Enum : enums
9+
Schema ||--o| Driver : driver
10+
Schema ||--o{ Label : labels
11+
Schema ||--o{ Viewpoint : viewpoints
12+
Table ||--o{ Column : columns
13+
Table ||--o{ Constraint : constraints
14+
Table ||--o{ Index : indexes
15+
Table ||--o{ Trigger : triggers
16+
Table ||--o{ Label : labels
17+
Viewpoint ||--o{ ViewpointGroup : groups
18+
Viewpoint ||..o{ Table : tables
19+
Viewpoint ||..o{ Label : labels
20+
ViewpointGroup ||..o{ Table : tables
21+
ViewpointGroup ||..o{ Label : labels
22+
Column ||--o{ Label : labels
23+
Driver ||--o| DriverMeta : meta
24+
Index ||..|{ Column : columns
25+
Constraint ||..|| Table : referenced_table
26+
Constraint ||..|{ Column : columns
27+
Constraint ||..o{ Column : referenced_columns
28+
Relation ||..|{ Column : columns
29+
Relation ||..|{ Column : parent_columns
30+
Relation ||..|| Table : table
31+
Relation ||..|| Table : parent_table
32+
33+
Table {
34+
string name
35+
string type
36+
string comment
37+
Column[] columns
38+
Index[] indexes
39+
Constraint[] constraints
40+
Trigger[] triggers
41+
string def
42+
Label[] labels
43+
string[] referenced_tables
44+
}
45+
46+
Column {
47+
string name
48+
string type
49+
boolean nullable
50+
string default
51+
string extra_def
52+
Label[] labels
53+
string comment
54+
}
55+
56+
Index {
57+
string name
58+
string def
59+
string table
60+
string[] columns
61+
string comment
62+
}
63+
64+
Constraint {
65+
string name
66+
string type
67+
string def
68+
string table
69+
string referenced_table
70+
string[] columns
71+
string[] referenced_columns
72+
string comment
73+
}
74+
75+
Trigger {
76+
string name
77+
string def
78+
string comment
79+
}
80+
81+
Label {
82+
string name
83+
boolean virtual
84+
}
85+
86+
Relation {
87+
string table
88+
string[] columns
89+
string cardinality
90+
string parent_table
91+
string[] parent_columns
92+
string parent_cardinality
93+
string def
94+
boolean virtual
95+
}
96+
97+
Function {
98+
string name
99+
string return_type
100+
string arguments
101+
string type
102+
}
103+
104+
Enum {
105+
string name
106+
string[] values
107+
}
108+
109+
Driver {
110+
string name
111+
string database_version
112+
DriverMeta meta
113+
}
114+
115+
DriverMeta {
116+
string current_schema
117+
string[] search_paths
118+
object dict
119+
}
120+
121+
Viewpoint {
122+
string name
123+
string desc
124+
string[] labels
125+
string[] tables
126+
integer distance
127+
ViewpointGroup[] groups
128+
}
129+
130+
ViewpointGroup {
131+
string name
132+
string desc
133+
string[] labels
134+
string[] tables
135+
string color
136+
}
137+
```

0 commit comments

Comments
 (0)