holistics / holistics/dbml

Note not possible in index settings

Open
#82 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.7k
Forks
233
Avg merge
1d 23h
Merged PRs (30d)
4

Description

The Index example from the docs fails:

```
Table bookings {
id integer
country varchar
booking_date date
created_at timestamp

indexes {
(id, country) [pk] // composite primary key
created_at [note: 'Date']
booking_date
(country, booking_date) [unique]
booking_date [type: hash]
(`id*2`)
(`id*3`,`getdate()`)
(`id*3`,id)
}
}
```

Error message:

```
ERROR: You have a syntax error at "table.dbml" line 9 column 19. Expected " ", "name:", "type:", "unique", PK, comment, or whitespace but "n" found.
```

Here we have a `note` in `created_at` index, which is not allowed by the syntax.
According to the [IndexSetting](https://github.com/holistics/dbml/blob/master/packages/dbml-core/src/parse/dbml/parser.pegjs#L505) syntax, only `"unique"`, `name` or `type` allowed in index settings.

Should either add `note` to possible index settings, or fix the example in docs

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.