Skip to content

Commit d6d438c

Browse files
authored
Add support for TableGroup (#22)
* Add support for TableGroup
1 parent d67f39a commit d6d438c

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

syntaxes/dbml.tmLanguage.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"structures": {
6161
"comment": "Main data structure tags",
6262
"name": "entity.name.type.dbml",
63-
"match": "\\b([pP]roject|[tT]able|[rR]ef|[eE]num|[iI]ndexes|[nN]ote)\\b"
63+
"match": "\\b([pP]roject|[tT]able([gG]roup)?|[rR]ef|[eE]num|[iI]ndexes|[nN]ote)\\b"
6464
},
6565
"keywords": {
6666
"name": "keyword.dbml",

test/mysql.dbml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ Table "orders" {
3939
"created_at" varchar(255) [note: 'When order created']
4040
}
4141

42+
TableGroup "order" [note: "Tables related to orders"] {
43+
"orders"
44+
"order_items"
45+
}
46+
4247
Table "products" {
4348
"id" int [pk]
4449
"name" varchar(255)

test/postgres.dbml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ Table "orders" {
3939
"created_at" varchar [note: 'When order created']
4040
}
4141

42+
TableGroup "order" [note: "Tables related to orders"] {
43+
"orders"
44+
"order_items"
45+
}
46+
4247
Table "products" {
4348
"id" int [pk]
4449
"name" varchar

test/test.dbml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,9 @@ Table products {
9898
}
9999

100100
Ref: products.merchant_id > merchants.id // many-to-one
101+
102+
// TableGroups: You can combine multiple tables in a TableGroup
103+
TableGroup order {
104+
orders
105+
order_items
106+
}

0 commit comments

Comments
 (0)