default value sequelize migration code example

Example 1: sequelize migration default value

queryInterface.addColumn('OrderBackups', 'my_column', {
  type: Sequelize.INTEGER,
  defaultValue: 0
})

Example 2: sequelize migration add default value

queryInterface.addColumn('My_table', 'my_column', {
  type: Sequelize.INTEGER,
  defaultValue: 0
})

Example 3: sequelize migration set default value

await queryInterface.addColumn('my_list', 'is_deleted', {
  type: Sequelize.BOOLEAN,
  defaultValue: false
});

Tags:

Sql Example