feat(dbml): support multiline table notes in DBML
Release / test (push) Successful in 1m45s
Release / release (push) Successful in 12m24s
Release / pkg-rpm (push) Successful in 2m3s
Release / pkg-deb (push) Successful in 2m17s
Release / pkg-aur (push) Successful in 2m47s

* Add parsing for triple-quoted table notes in DBML
* Update writer to format multiline notes correctly
* Enhance tests for multiline table notes handling
This commit is contained in:
2026-09-09 21:38:11 +02:00
parent ee5c009234
commit 161ac317f0
9 changed files with 159 additions and 17 deletions
+17
View File
@@ -59,6 +59,23 @@ func TestWriter_WriteTable(t *testing.T) {
assert.Contains(t, output, "Note: 'User accounts table'")
}
func TestWriter_WriteTable_MultilineNote(t *testing.T) {
table := models.InitTable("cities", "info")
table.Description = "Cities and municipalities worldwide.\n\nSPATIAL:\nProximity queries use a GiST index."
outputPath := filepath.Join(t.TempDir(), "cities.dbml")
writer := NewWriter(&writers.WriterOptions{OutputPath: outputPath})
if err := writer.WriteTable(table); err != nil {
t.Fatalf("WriteTable() error = %v", err)
}
output, err := os.ReadFile(outputPath)
if err != nil {
t.Fatalf("failed to read generated DBML: %v", err)
}
assert.Contains(t, string(output), "Note: '''\nCities and municipalities worldwide.\n\nSPATIAL:\nProximity queries use a GiST index.\n '''")
}
func TestWriter_WriteDatabase_WithRelationships(t *testing.T) {
db := models.InitDatabase("test_db")
schema := models.InitSchema("public")