Error when trying to add multi reference field to table

Dear all,

I get the following error message when I am trying to add a multi-reference field to a table.

Error: alter table ‘training_attendees’ ass constraint ‘training_attendees_training_id_foreign’ foreign key ('training_id) references ‘training’(‘id’) on update CASCA on delete CASCADE - ER_CANNOT_ADD_FOREIGN: Cannot add foreign key constraint.

PS: Is there a way to copy the content of the error message in Wappler? I tried to copy the text from the dialog box Data Base Update Failed, but it was not possible. I think it would be very helpful to be able to copy the error messages.

I have two tables - one table training with the Primary Key ‘id’ the data type is int(11). This table includes also data fields for the name, start and end-date and a reference to the training provider. I now wanted to work with the multi reference functionality to assign multiple employees to a training. Employee information is stored in the table employee, also with a primary key ‘id’ with the data type int(11).

When I open my database outside the database manager in Wappler I see that Wappler despite the error message created a new table called ‘training_attendees’ with two columns. ‘training_id’ and ‘employee_id’. However, both have a data type of int(10) unsigned. Might this be the problem when the program tries to create the foreign key as the primary keys have the data type int(11) and Wappler now creates the multi reference table with int(10) unsigned?

What can I do to solve the problem?

I appreciate your help.

Thank you very much

Community Page
Last updated: