Reputation: 751
We have been running an app on sailsJS 0.12 - once 1.0 was released ran through the upgrade process and upgraded
previously, some of the models were supporting "array" type, it's no longer supported. what's the alternative to this ? it's not covered in sample app or the documentation
model I have is :
module.exports = {
attributes: {
provider: 'string',
uid: 'string',
email: 'string',
name: 'string',
firstName: 'string',
lastName: 'string',
password: 'string',
projects: {
collection: 'project',
via: 'owner'
},
creditsHistory:{
collection: 'creditsHistory',
via: 'owner'
},
userRoles: {type: 'array', defaultsTo : [roles.USER]}
},
supported types in sails 1.0 are : https://sailsjs.com/documentation/concepts/models-and-orm/attributes
there isn't any example or sample on what to replace the array type with sails 0.12 supported types: https://0.12.sailsjs.com/documentation/concepts/models-and-orm/attributes
does anyone has any idea on this ?
Upvotes: 1
Views: 1128
Reputation: 396
You can use it like that:
'coordinate': {
'type': 'json',
'required': true,
},
Or you can use it like this :
'cost_price': {
'type': 'ref',
'columnType': "double"
},
in colunmType
you can define database colunm type
Upvotes: 2