node.jspostgresqlsequelize.js

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


Solution

  • So syntax for this is

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