Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to define default value in Sequelize migration?

There is no documentation details about addColumn options, so I'm trying this:

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

and it does not work. ps: I'm using postgres

like image 833
Andrey Khataev Avatar asked Dec 16 '18 04:12

Andrey Khataev


1 Answers

So syntax for this is

queryInterface.addColumn('OrderBackups', 'my_column', {
  type: Sequelize.INTEGER,
  defaultValue: 0
})
like image 139
Nimish Gupta Avatar answered Nov 01 '22 01:11

Nimish Gupta