'Sequlize Postgres id auto increment not working
I am using Node, sequlize, Postgres to develop a application.
I have a model called User
const User = sequelize.define('User', {
id: {
type: Sequelize.INTEGER,
allowNull: false,
primaryKey: true,
autoIncrement: true,
},
name: {
type: Sequelize.STRING
},
})
module.exports = User;
Migration ok with out any error.
But when I am going to insert data without id its saving id as null ?
return modelName.create(body).then((payload) => {
payload.success = true
return payload
}).catch(err => {
err.success = false
return err
})
its saving all data without id.
sequlize version
"sequelize": "^5.21.3"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
