Sequelize onDelete not working

前端 未结 2 1677
天涯浪人
天涯浪人 2020-12-18 13:08

I have associations between two models defined as below:

For Contact Model (in a separate file)

classMethods: {
      associate: function (models){
          


        
2条回答
  •  醉梦人生
    2020-12-18 13:20

    I think you need to define it the other way around.

    Contact.belongsTo(models.Users, {
        foreignKeyConstraint: true
        , onDelete: 'cascade'
    })
    

提交回复
热议问题