Primary key not created in MySQL export

I tried creating a primary key like:

Table teams {
id int PK
name varchar
created_at datetime
updated_at datetime
}

But when I export to MySQL the PK is ignored:

CREATE TABLE teams
(
id int,
name varchar(255),
created_at datetime,
updated_at datetime
);

So I have to add it manually in the SQL file, and of course none of my foreign keys in the database will work until I do this.

Am I doing something wrong or is this a bug?

Hi, thank you for using dbdiagram! Yes this does look like a bug on our side. Let us work on a fix for this!

Thanks, please let me know! Loving the interface so far other than this glitch.

Thanks for your :heart:. This has been fixed, hope you’ll continue enjoy it! :v:

I still got the same error when I did it at 2025.04.03… This post was written in 2019, but I got the same error after 6 years later.

Hi @harampark , could you provide an example that you believe would trigger the error? Alternatively, sharing the diagram link would also be helpful.