d2 icon indicating copy to clipboard operation
d2 copied to clipboard

[FR] sql_table: Support PK and FK composed by 2+ attributes

Open augustozanellato opened this issue 2 years ago • 2 comments

At the moment d2 can't represent FKs that are composed of more than one column. Example:

tenant: {
  shape: sql_table

  id: int {constraint: primary_key}
}

project: {
  shape: sql_table

  id: int
  tenant: int {constraint: foreign_key}
  # here i may want to have the PK defined as (id, tenant)
}

tenant.id <- project.tenant

augustozanellato avatar Jan 16 '23 14:01 augustozanellato