简体   繁体   中英

Invalid Instance definition. Only one autoincrement field allowed

const Category = sequelize.define("category",{

    categoryid:{
        type:DataTypes.INTEGER,
        autoIncrement:false,
        allowNull:false,
        primeryKey:true
    },

const Blog = sequelize.define("blog",{
    blogid:{
        type:DataTypes.INTEGER,
        autoIncrement:true,
        allowNull:false,
        primeryKey:true
    },

i want to create 2 tables but it gives error

i have 2 page blog and category and i called its on index.js but it gives error.

when i watch video his code worked but my code is not working

You misspelled the option primaryKey just fix the name ( primeryKey -> primaryKey ) and that does the trick.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM