Skip to main content

I'm exporting an ERD to SQL Server. The diagram consists of one entity with a 1-to-1 relationship to a second table. Looking at the generated SQL the foreign keys are MISSING. Am I doing something wrong? Any way to fix this other than manually edit the generated SQL I export?

 

CREATE TABLE `flights_payment` (
`payment_id` int,
`payment_amount` int,
PRIMARY KEY (`payment_id`)
);

CREATE TABLE `users_booking` (
`booking_id` int,
`payment_id` int,
`booking_confirmationCode` VARCHAR(255) NOT NULL ,
PRIMARY KEY (`booking_id`)
);

 

Additionally, I have noticed that nullability is not defined even though the diagram cardinality is defined

 

CREATE TABLE `passport` (
  `passport_id` int,
  `user_id` int,
  PRIMARY KEY (`passport_id`)
);

CREATE TABLE `user` (
  `user_id` int,
  `name` string,
  PRIMARY KEY (`user_id`)
);

 

Hi ​@eberteo

Thank you for your post! Can you confirm that relationships are connected in the corresponding table at the connection points for the columns in your data?


Hey Kelsey, relationships are indeed connected at the connection dots for its respective row. Highlighted with red color, if that’s to what you refer.

 


Hi ​@eberteo

Thank you for the reply! Can you provide the output from the SQL server when trying to run the script? Can you please send a temporary Support PIN for this document? This will allow me to take a closer look at the issue you’re experiencing. For more information on generating a Support PIN, check out this Help Center article.
 


Kelsey,

I think you have misunderstood me. The issue I’m having is in the query that has been generated by LucidChart, the foreign key is not being declared within the generated query even though in the diagram chart I set a 1 to 1 relationship. Temporary Pin YpTfs6ETv67p

 

 

// NO FK DECLARED

CREATE TABLE `user` (
`user_id` int,
`user_name` string,
PRIMARY KEY (`user_id`)
);

CREATE TABLE `passport` (
`passport_id` int,
`user_id` int,
`passport_number` int,
PRIMARY KEY (`passport_id`)
);

 

I believe this could be a bug from LucidChart.


Hi ​@eberteo, thanks for clarifying with that additional information. You have indeed identified a bug, and I have reported this to our development team. I apologize for any disruption this may cause, and will update this thread with any new information about a fix. Please follow along on this thread for updates, and post any additional questions or concerns below.


Reply