Hi i am having trouble adding boolean column, i am able to add the column but unable to insert the value into the column Can you provide an example for it please
Hi @vam, here is an example.
To add a Boolean column(Model):
is_activated: { type: DataTypes.BOOLEAN, defaultValue: false, },
To insert a value into the column:
By default, it will always be False, but if you want to change it to true, pass true as the value. I mean a boolean true
False
true
example:
User.create({ is_activated: true });
Hi @Vam, here is an example.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi i am having trouble adding boolean column, i am able to add the column but unable to insert the value into the column
Can you provide an example for it please
Hi @vam, here is an example.
To add a Boolean column(Model):
To insert a value into the column:
By default, it will always be
False
, but if you want to change it totrue
, passtrue
as the value. I mean a booleantrue
example:
User.create({
is_activated: true
});
Hi @Vam, here is an example.
To add a Boolean column(Model):
To insert a value into the column:
By default, it will always be
False
, but if you want to change it totrue
, passtrue
as the value. I mean a booleantrue
example:
User.create({
is_activated: true
});