...

Text file src/oss.terrastruct.com/d2/e2etests/testdata/files/ent2d2_basic.d2

Documentation: oss.terrastruct.com/d2/e2etests/testdata/files

     1# Edges
     2User <-> User: "spouse" {
     3  # o2o optional
     4  source-arrowhead: {
     5    shape: cf-one-required
     6  }
     7  target-arrowhead: {
     8    shape: cf-one
     9  }
    10}
    11User <-> User: "children/parent/ancestor" {
    12  # o2m optional
    13  source-arrowhead: {
    14    shape: cf-one-required
    15  }
    16  target-arrowhead: {
    17    shape: cf-many
    18  }
    19}
    20User <-> Pet: "pets/owner" {
    21  # o2m optional
    22  source-arrowhead: {
    23    shape: cf-one-required
    24  }
    25  target-arrowhead: {
    26    shape: cf-many
    27  }
    28}
    29User <-> Card: "card/owner" {
    30  # o2o optional
    31  source-arrowhead: {
    32    shape: cf-one-required
    33  }
    34  target-arrowhead: {
    35    shape: cf-one
    36  }
    37}
    38User <-> Post: "posts/author" {
    39  # o2m optional
    40  source-arrowhead: {
    41    shape: cf-one-required
    42  }
    43  target-arrowhead: {
    44    shape: cf-many
    45  }
    46}
    47User <-> Metadata: "metadata/user" {
    48  # o2m optional
    49  source-arrowhead: {
    50    shape: cf-one-required
    51  }
    52  target-arrowhead: {
    53    shape: cf-many
    54  }
    55}
    56User <-> Info: "info/user" {
    57  # o2m optional
    58  source-arrowhead: {
    59    shape: cf-one-required
    60  }
    61  target-arrowhead: {
    62    shape: cf-many
    63  }
    64}
    65
    66# Tables
    67Card: {
    68  shape: sql_table
    69  id: int {constraint: primary_key}
    70  owner_id: int {constraint: foreign_key}
    71}
    72Info: {
    73  shape: sql_table
    74  id: int {constraint: primary_key}
    75  content: json.RawMessage
    76}
    77Metadata: {
    78  shape: sql_table
    79  id: int {constraint: primary_key}
    80  age: int
    81}
    82Pet: {
    83  shape: sql_table
    84  id: int {constraint: primary_key}
    85  owner_id: int {constraint: foreign_key}
    86}
    87Post: {
    88  shape: sql_table
    89  id: int {constraint: primary_key}
    90  text: string
    91  author_id: int {constraint: foreign_key}
    92}
    93User: {
    94  shape: sql_table
    95  id: int {constraint: primary_key}
    96  parent_id: int {constraint: foreign_key}
    97  spouse_id: int {constraint: foreign_key}
    98}

View as plain text