Relative Content

Tag Archive for mysqltypescriptmysql-workbenchsequelize-typescript

Why does this foreign key constraint error appear?

I am trying to insert email and generated sessionId into a table in my mysql database (using Sequelize-TypeScript), I first check if the user exists and if the given passwords match. If this is the case, I execute the insert (create) query but it gives me the following error message: Cannot add or update a child row: a foreign key constraint fails (hyteams.sessions, CONSTRAINT sessions_ibfk_1 FOREIGN KEY (email) REFERENCES users (email)).