Open Ihebdhouibi opened 4 years ago
still required to view your User.js without it can't figure out where is the issue also if possible output of the mysql command DESC table_name;
This is my User.js file
module.exports = (sequelize, DataTypes) => sequelize.define('User', { email: { type: DataTypes.STRING, unique: true }, password: DataTypes.STRING })
I've been doing some research and It seems it's something related to sequelize and in order for it to set a unique constraint to the email I had to call .sync() on the model ( which is not recommended ) or add queryInterface.addIndex()
Still newbie with sequelize so I am completely confused what to do, besides changing the error message dynamically is challenging as well, I go dig into it
it seems ok, I think you need to use sync forcefully option but it will erase your data. I personally not using not using sequelize as my project is not that big. I feel its like a tank to kill an ant so I am not using sequilize. In your case just juse force sync. That's all.
When I pass the request the same email it's accepted and increase the ID with the same email and password as the precedent user I had
unique : true
in my User.js file