You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Basically what i want to achieve is to make a one to many relation ship between role and user models, one role can have many users but one user can only have one role
This way the relation is correct, i can insert and query for users with role or role with users, the problem is every time the server starts and sequelize.sync({alter: true}) runs, it inserts a new foreign key to users pointing to roles table
This is the model definition of my User model :
and this is the model definition of my Role model :
Basically what i want to achieve is to make a one to many relation ship between role and user models, one role can have many users but one user can only have one role
This way the relation is correct, i can insert and query for users with role or role with users, the problem is every time the server starts and sequelize.sync({alter: true}) runs, it inserts a new foreign key to users pointing to roles table
enter image description here
According to this issue: "#266"
i've tried modifying my user model like this:
but the foreign keys still got inserted
The text was updated successfully, but these errors were encountered: