Skip to content Skip to sidebar Skip to footer

Sequelize Model Is Not Associated With Model

I've been spending hours for nothing. I've had so many sources, they are all kinda the same, but I just couldn't make my project work. This question Sequelize.js - 'is not associat

Solution 1:

By this code

// Models
  db.appsettings = require("./app/models/appsettings/appsettings.model")(db.sequelize, db.Sequelize)
  db.countries = require("./app/models/appsettings/country.model")(db.sequelize, db.Sequelize)

  db.users = require("./app/models/user/user.model")(db.sequelize, db.Sequelize)
  db.roles = require("./app/models/user/role.model")(db.sequelize, db.Sequelize)
  db.userscores = require("./app/models/user/userscore.model")(db.sequelize, db.Sequelize)

  db.answers = require("./app/models/game/answer.model")(db.sequelize, db.Sequelize)
  db.categories = require("./app/models/game/category.model")(db.sequelize, db.Sequelize)
  db.questions = require("./app/models/game/question.model")(db.sequelize, db.Sequelize)
  db.useracoomplishedquestions = require("./app/models/game/useracoomplishedquestion.model")(db.sequelize, db.Sequelize)

you overridden model definitions registered in models/index.js that's why these models don't have associations. Just remove these lines.

Post a Comment for "Sequelize Model Is Not Associated With Model"