dbml
dbml copied to clipboard
Proposal: DBML Tag
DBML Tag
Concept
- Support metadata tag/label for DBML element (table, schema,...)
- Each element can have multiple tags associated.
- Each tag can be associated with multiple elements.
Syntax
Define the tag block separately.
Tag v1.0 {
note: 'version 1.0'
tables: [users, cities, countries]
}
Tag transaction {
note: 'transaction tables'
tables: [users, orders]
}
Table orders {
id int [pk]
user_id int [ref: > users.id]
status order_status
created_at datetime
}
...
- All the tag's attributes (note, associated tables) can be declared in the long-form format.
Define tag inside element
Table orders [tags: [transaction, v1.0]] {
id int [pk]
user_id int [ref: > users.id]
status order_status
created_at datetime
}
// or
Table orders {
id int [pk]
user_id [ref: > users.id]
status order_status
created_at datetime
Tags {
v1.0
transaction
}
}