overlookmotel / sequelize-hierarchy

Nested hierarchies for Sequelize
MIT License
302 stars 90 forks source link

isHierarchy is not a function #237

Open phamquoctuan1 opened 3 years ago

phamquoctuan1 commented 3 years ago

I define my model like that but got error

require('sequelize-hierarchy')(); module.exports = (sequelize, DataTypes) => { const Category = sequelize.define('category', { name: { type: DataTypes.STRING, allowNull: false, unique: true, }, slug: { type: DataTypes.STRING, unique: true, }, status: { type: DataTypes.BOOLEAN, }, }); Category.isHierarchy(); SequelizeSlugify.slugifyModel(Category, { source: ['name'] }); return Category; };

Category.isHierarchy is not a function

woodjs commented 3 years ago
const { Sequelize } = require('sequelize');
require('sequelize-hierarchy')(Sequelize);
cyruscuenca commented 2 years ago
const { Sequelize } = require('sequelize');
require('sequelize-hierarchy')(Sequelize);

What does this mean? I import my models in an api.js file with those rows, and I still get this error