Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to set default value for a field in Sails models using Waterline ORM?

A very simple question but I am unable to find the answer to it. So in my Sails app I have a User model and I am trying to make a boolean field with a default value to be False.

Is there a way to specify defaults like some kind of default attribute etc??

I want something like this:

is_admin: {
        type: 'boolean',
        default: 'false'
    }

Thanks for your time.

like image 860
Gagandeep Singh Avatar asked May 03 '14 11:05

Gagandeep Singh


1 Answers

use defaultsTo look this Waterline Docs

like image 103
zieglar Avatar answered Sep 21 '22 10:09

zieglar