How to set a default value in Knex migration?
Here is a quick copy/paste answer for those who came here searching "How to set a default value in Knex migration"
table.string('state').notNullable().defaultTo('pending')
Note: notNullable()
is not required.