Table inheritance

First: I really enjoy using this tool, it’s great to be able to collaborate more effectively on database design! (And the neat freak in me loves the new ability to move relationship lines…)

Since I saw in the “whats new” section that the new DBML parser should enable future support for table inheritance, is there any guess as to when this could become available?

It’s a really neat feature that would improve our database design significantly and being able to represent that in dbdiagrams would be fantastic.

For those not familiar with the concept, here is a short intro:

Table vehicles{
  id uuid [ pk, unique]
  registration text
  owner_id uuid
Table cars{
    passengers int
} [inherits vehicles] //(or something like it)
Table trucks{
    loading_capacity int
}[inherits vehicles]

Both trucks and vehicles have the id, registration and owner_id columns as well as their specified columns. Inserting a car creates one row in vehicles and one row in cars, linked. This can, of course, be implemented using tables with foreign keys, joins and multiple inserts but when the schema gets complicated, this really helps keeping the clutter and boilerplate code down.

This feature is available in, at least, PostgreSQL (I don’t know if any other sql dialect support it)

Hi @Johannes_Nordh ,

I’m Huy Le from the dbdiagram team.

Currently, we are not supporting the ability to extend a table.

But we already had it on our backlog, and there is a feature suggestion for this functionality too. You can visit it here and give it an upvote.

Anyway, I and my team highly appreciate your contribution!

Best regards,
Huy Le

1 Like