在 SailsJS 1.0 模型中定义一个数组
Define an array in SailsJS 1.0 Model
我们已经 运行 sailsJS 0.12 上的应用程序 -
一旦 1.0 发布 运行 通过升级过程并升级
之前部分机型支持"array"类型,现在不再支持了。有什么选择呢?它未包含在示例应用程序或文档中
我的型号是:
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]}
},
sails 1.0 中支持的类型是:https://sailsjs.com/documentation/concepts/models-and-orm/attributes
没有关于用什么替换数组类型的示例或样本
帆 0.12 支持的类型:
https://0.12.sailsjs.com/documentation/concepts/models-and-orm/attributes
有人对此有任何想法吗?
你可以这样使用它:
'coordinate': {
'type': 'json',
'required': true,
},
或者你可以这样使用它:
'cost_price': {
'type': 'ref',
'columnType': "double"
},
在colunmType
中你可以定义数据库列类型
我们已经 运行 sailsJS 0.12 上的应用程序 - 一旦 1.0 发布 运行 通过升级过程并升级
之前部分机型支持"array"类型,现在不再支持了。有什么选择呢?它未包含在示例应用程序或文档中
我的型号是:
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]}
},
sails 1.0 中支持的类型是:https://sailsjs.com/documentation/concepts/models-and-orm/attributes
没有关于用什么替换数组类型的示例或样本 帆 0.12 支持的类型: https://0.12.sailsjs.com/documentation/concepts/models-and-orm/attributes
有人对此有任何想法吗?
你可以这样使用它:
'coordinate': {
'type': 'json',
'required': true,
},
或者你可以这样使用它:
'cost_price': {
'type': 'ref',
'columnType': "double"
},
在colunmType
中你可以定义数据库列类型