Waterline supports indexing out of the box,遗憾的是没有任何适配器。
sails-mysql适配器似乎不支持它。
例如,在模型中跟随字段会出错:
user: {
model: 'user',
index: true
}
错误:
user
模型上的属性topic
包含无效的属性。财产index
不是公认的财产。
问题是,如果适配器不支持索引,那么在SailsJS中执行此操作的最佳方法是什么?
我正在使用:
{
"sails": "^1.0.0-27",
"sails-mysql": "^1.0.0-7",
"waterline": "v0.13.0-rc4"
}
答案 0 :(得分:4)
对sails-mysql
,waterline-schema
和waterline
模块进行逆向工程后,我发现无法在autoMigrations
属性中设置索引。如下:
foo: {
type: 'number'
autoMigrations: { index: true }
}