更新时间:2021-12-31 04:03:45
需要提供外键使用的列.这些线路上的东西
You need to provide the columns which are used in the foreign key. Something on these lines
questions.associate = function(models) {
// associations can be defined here
models.questions.hasOne(models.question_categories, { foreignKey: 'question_id' });
models.questions.hasMany(models.question_answers, { foreignKey: 'question_id' });
};
这将在表 question_categories 中创建一个外键,指向表 questions
This will create a foreign key in table question_categories, pointing to the table questions
question_categories.question_id -> questions.id