In sequelize.js I try to use migration to create a table, here is how I define an id column in my code:
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.createTable(tableName, {
id: {
type: Sequelize.INTEGER,
autoIncrement: true,
primaryKey: true,
defaultValue: 100,
I want the id column auto increase from 100
However, when I try to run this migration, the terminal tell me:
ERROR: Invalid default value for 'id'
I find out if I commentted the autoIncrement
attribute, it could work. But maybe it cannot auto increase.
How can I let the id column auto increase from a default value?