@@ -144,24 +144,123 @@ vpc: VPC 1 10.1.0.0./16 {
144
144
## ER diagram
145
145
146
146
``` d2 layout=elk
147
- objects: {
148
- shape: sql_table
149
-
150
- id: int {constraint: primary_key}
151
- disk: int {constraint: foreign_key}
152
-
153
- json: jsonb {constraint: unique}
154
- last_updated: timestamp with time zone
155
- }
156
-
157
- disks: {
158
- shape: sql_table
159
- id: int {constraint: primary_key}
147
+ # Edges
148
+ User <-> User : "spouse" {
149
+ # o2o optional
150
+ source-arrowhead: {
151
+ shape: cf-one-required
152
+ }
153
+ target-arrowhead: {
154
+ shape: cf-one
155
+ }
156
+
157
+ }
158
+ User <-> User : "children/parent" {
159
+ # o2m optional
160
+ source-arrowhead: {
161
+ shape: cf-one-required
162
+ }
163
+ target-arrowhead: {
164
+ shape: cf-many
165
+ }
166
+
167
+ }
168
+ User <-> Pet : "pets/owner" {
169
+ # o2m optional
170
+ source-arrowhead: {
171
+ shape: cf-one-required
172
+ }
173
+ target-arrowhead: {
174
+ shape: cf-many
175
+ }
176
+
177
+ }
178
+ User <-> Card : "card/owner" {
179
+ # o2o optional
180
+ source-arrowhead: {
181
+ shape: cf-one-required
182
+ }
183
+ target-arrowhead: {
184
+ shape: cf-one
185
+ }
186
+
187
+ }
188
+ User <-> Post : "posts/author" {
189
+ # o2m optional
190
+ source-arrowhead: {
191
+ shape: cf-one-required
192
+ }
193
+ target-arrowhead: {
194
+ shape: cf-many
195
+ }
196
+
197
+ }
198
+ User <-> Metadata : "metadata/user" {
199
+ # o2m optional
200
+ source-arrowhead: {
201
+ shape: cf-one-required
202
+ }
203
+ target-arrowhead: {
204
+ shape: cf-many
205
+ }
206
+
207
+ }
208
+ User <-> Info : "info/user" {
209
+ # o2m optional
210
+ source-arrowhead: {
211
+ shape: cf-one-required
212
+ }
213
+ target-arrowhead: {
214
+ shape: cf-many
215
+ }
216
+
217
+ }
218
+
219
+ # Tables
220
+ Card: {
221
+ shape: sql_table
222
+ id: int {constraint: primary_key}
223
+ owner_id: int {constraint: foreign_key}
224
+ # this is a comment
225
+ }
226
+ Info: {
227
+ shape: sql_table
228
+ id: int {constraint: primary_key}
229
+ content: json.RawMessage
230
+ # this is a comment
231
+ }
232
+ Metadata: {
233
+ shape: sql_table
234
+ id: int {constraint: primary_key}
235
+ age: int
236
+ # this is a comment
237
+ }
238
+ Pet: {
239
+ shape: sql_table
240
+ id: int {constraint: primary_key}
241
+ owner_id: int {constraint: foreign_key}
242
+ # this is a comment
243
+ }
244
+ Post: {
245
+ shape: sql_table
246
+ id: int {constraint: primary_key}
247
+ text: string
248
+ # this is a comment
249
+ author_id: int {constraint: foreign_key}
250
+ # this is a comment
251
+ }
252
+ User: {
253
+ shape: sql_table
254
+ id: int {constraint: primary_key}
255
+ parent_id: int {constraint: foreign_key}
256
+ # this is a comment
257
+ spouse_id: int {constraint: foreign_key}
258
+ # this is a comment
160
259
}
161
-
162
- objects.disk -> disks.id
163
260
```
164
261
262
+ Source: https://github.com/tmc/ent2d2/blob/master/testdata/schema.d2
263
+
165
264
## Sequence Diagrams
166
265
167
266
``` d2
0 commit comments