I am using AdonisJS to make a backend application. In migrations, specifically in models, we have the option of creating models, but I can't use a default value in enun type. After reading the Knex.js documentation, I couldn't find a way to put this default value in enum type (table.enu) in SGDB Mysql. Could anyone help?
Asked
Active
Viewed 6,885 times
1 Answers
14
Did you try defaultTo()
:
defaultTo — column.defaultTo(value)
Sets the default value for the column on an insert.
Example :
table.enu('role', ['one', 'two', 'three']).defaultTo('two', options={})

crbast
- 2,192
- 1
- 11
- 21