0
module.exports = function(sequelize, DataTypes) {
var MenuTranslation = sequelize.define('MenuTranslation', {
name: DataTypes.STRING,
description: DataTypes.STRING
},{
tableName: 'menu_translations',
timestamps: false,
associate: function(models){
MenuTranslation.belongsTo(models.Menu, { onDelete: 'cascade' });
MenuTranslation.belongsTo(models.Language);
}
});
return MenuTranslation;
};
更新:我將「onDelete:'cascade'」添加到我的MenuTranslation模型中。但是這次它像onDelete一樣工作:'null'如何刪除SequelizeJS中刪除對象的所有關聯數據?
你是對的,但是這次級聯不起作用。請檢查更新 – Burak