Sequelize.js foreign key

前端 未结 5 1584
长发绾君心
长发绾君心 2020-12-24 05:26

When using Sequelize.js, the following code doesn\'t add any foreign key on tables.

var MainDashboard = sequelize.define(\'main_dashboard\', {
  title: Sequ         


        
5条回答
  •  囚心锁ツ
    2020-12-24 06:21

    You need to add foreignKeyConstraint: true

    Try:

    MainClient.hasOne(MainDashboard, { foreignKey: 'idClient', foreignKeyConstraint: true })
    

提交回复
热议问题