dbml icon indicating copy to clipboard operation
dbml copied to clipboard

sql2dbml fails for Mysql auto_increment

Open haily-tripla opened this issue 6 years ago • 1 comments

Hi, sql2dmbl returns an error when my table definition includes auto_increment

Sample create table script

CREATE TABLE test_table
(
   id          INT            NOT NULL AUTO_INCREMENT
   PRIMARY KEY (id)
)
;

Error: You have a syntax error at "test_db.ddl" line 3 column 40. Expected ")", ",", "CHECK", "CONSTRAINT", "DEFAULT", "DEFERRABLE", "GENERATED", "INITIALLY", "NOT", "NULL", "PRIMARY", "REFERENCES", or "UNIQUE" but "A" found.

Can you please support mysql auto increment?

haily-tripla avatar Sep 16 '20 07:09 haily-tripla

Add a comma at the end of each line and it should work

CREATE TABLE test_table
(
   id          INT            NOT NULL AUTO_INCREMENT  ,
   PRIMARY KEY (id)
)
;

khanh-tran-quoc avatar Sep 17 '20 03:09 khanh-tran-quoc