Replies: 1 comment
-
Implemented in #709 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
To make defining common database patterns easier and more efficient in DBML, we're proposing a new feature:
TablePartial
.The core idea is to allow you to define reusable blocks of columns, indexes, and settings that can be easily included in multiple table definitions. Think of standard audit trails (
created_at
,updated_at
), soft delete fields, or common indexing patterns.This syntax is inspired by and aims to address many of the ideas and suggestions raised in the following discussions and issues:
Proposed Syntax:
Use
TablePartial
to define reusable blocks and~<partial_name>
to include them in tables.Example:
Design Considerations:
We explored various ways to achieve reusability. The chosen approach, using
TablePartial
with the~
include syntax, functions like composition or mixins - the contents of the partial are effectively copied directly into the target table definition ("auto-inject").We opted for this composition model over implementing OOP-style table inheritance for several reasons:
We'd love your feedback on this proposal! Please share your thoughts below.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions