dbml icon indicating copy to clipboard operation
dbml copied to clipboard

Inheritance syntax for common columns

Open danielh-official opened this issue 4 years ago • 6 comments

It would be cool if you could make a table inherit columns from another table. Something like this:

Component global {
    id int [pk, increment]
}

Table customer : global {
    first_name varchar
    last_name varchar
}

This would cut down on code reuse tremendously if implemented.

UPDATE

Better yet, multiple inheritance syntax would be a godsend.

Component global {
    id int [pk, increment]
}

Component names {
    first_name varchar
    last_name varchar
}

Table customer : global, names {
}

danielh-official avatar Jul 23 '20 15:07 danielh-official

Hello Daniel, DBML maker here.

Thanks for the recommendation! I have noted this down for our team to discuss and prioritize in the future. If you have any other feedback, let me know at [email protected]!

tuanmonn avatar Jul 27 '20 10:07 tuanmonn

This would be a hugely useful feature that I would love to see!

lscoughlin avatar Feb 19 '21 08:02 lscoughlin

I'm just wondering if there's been any update to this idea @tuanmonn? It and similar ideas have been a requested class of features since at least issue #12, is there a branch to test or any specific documentation dedicated to the idea? This is about 1/3 of the necessary features needed to support xml-compatible schemas, which is also a heavily requested capability. I'd like to contribute however i can to make that a reality, so where do i start?

chrstfer avatar Aug 06 '21 00:08 chrstfer

Any updates on this?

gbanfalvi avatar Apr 11 '23 07:04 gbanfalvi

I also think the feature will be useful.

Aside from that, put a similar ticket with other implementation recommendation in here #302

curiouslaw avatar Jan 10 '24 10:01 curiouslaw