Is this possible to create model with sequelize to look like:
var User = sequelize.define('User', {
username: DataTypes.STRING,
email: DataTypes.STRING,
password: DataTypes.STRING,
facebook: {
id: DataTypes.STRING,
token: DataTypes.STRING,
email: DataTypes.STRING,
name: DataTypes.STRING
},
})
Idea is: When i will get user data from DB i would like to see
User: {
facebook: {
id,
token,
...
}
}
No.
Either
User.facebook
a DataType.JSON
field (which is supported by postgresql only)Option i) is fine, but you don't get any support from sequelize to check integrity and validity if you make it a json field.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With