dbml icon indicating copy to clipboard operation
dbml copied to clipboard

UUID Marked as a Syntax Error in MySQL Adapter

Open BenMorganMY opened this issue 1 year ago • 1 comments

I have begun a new dbdocs project with two legacy MariaDB databases. Currently, there is a column called api_key that is of uuid datatype and is causing a syntax error:

  `api_key` uuid NOT NULL,
$ sql2dbml ~/Repos/myhi/db/structure.sql -o ./database.dbml --mysql
  ERROR:
    You have a syntax error at "structure.sql" line 1899 column 12. no viable alternative at input '...,\n  `api_key` uuid'

  A complete log can be found in:
     /Users/ben/Repos/dbdocs/dbml-error.log

I'm wondering it it's possible to update the parser to recognize uuid's?

BenMorganMY avatar Apr 09 '24 22:04 BenMorganMY

Hi @BenMorganMY ,

Currently, we are supporting import from native mysql database only so the uuid column is not valid.

To remove this error, you should try replace the uuid type by varchar(36) or binary(16) instead. You can check it out here https://dev.mysql.com/blog-archive/storing-uuid-values-in-mysql-tables/

Moreover, we will add your parser updating suggestion on our backlog and consider implementing it in the future. Anyway, if you're interested, please open a PR to remedy this issue; we highlly appreciate you contribution.

I hope this helps.

huyleminh01 avatar Apr 10 '24 04:04 huyleminh01