holistics / holistics/dbml

sql2dbml - Mysql 8.0.13+ reference to column in DEFAULT generates incorrect dbml

Open
#687 1 comment 0 reactions 1 assignee Claimed by @huydo862003 View on GitHub
bug
Dominant language
JavaScript
Stars
3.7k
Forks
233
Avg merge
1d 23h
Merged PRs (30d)
4

Description

I ran into the issue that for sql statements like the following
```sql
CREATE TABLE `some_table` (
code VARCHAR(6)
);

-- migration file later on
UPDATE TABLE `some_table`
ADD name VARCHAR(80) DEFAULT(`code`);
```
generates incorrect dbml when generated from an sql dump. The resulting dbml will have double backticks around the word `code`, as follows:

```dbml
name VARCHAR(80) DEFAULT(``code``)
```

This leads to tools following in the pipeline to error.

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.