Skip to content

Commit d6493af

Browse files
committed
Document and test that tbls.yml comments override schema comments
1 parent e6daf82 commit d6493af

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,8 @@ lintExclude:
875875

876876
For example, you can add comment about VIEW TABLE or SQLite tables/columns.
877877

878+
> **Notice:** Comments defined in `.tbls.yml` will override existing comments in the schema.
879+
878880
```yaml
879881
# .tbls.yml
880882
comments:

config/config_test.go

+4
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ func TestMergeAditionalData(t *testing.T) {
145145
if err != nil {
146146
t.Fatal(err)
147147
}
148+
if want := "users comment by tbls"; users.Comment != want {
149+
t.Errorf("got %v\nwant %v", users.Comment, want)
150+
}
151+
148152
posts, err := s.FindTableByName("posts")
149153
if err != nil {
150154
t.Fatal(err)

testdata/config_test_tbls.yml

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ relations:
1818
comments:
1919
-
2020
table: users
21+
tableComment: users comment by tbls
2122
indexComments:
2223
user_index: user index
2324
constraintComments:

0 commit comments

Comments
 (0)