q-koa 11.8.0 → 11.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/core/app.js
CHANGED
|
@@ -618,6 +618,11 @@ class APP {
|
|
|
618
618
|
...this.app[appName].attributes,
|
|
619
619
|
[folder]: _attributes,
|
|
620
620
|
}
|
|
621
|
+
const indexes = _.get(
|
|
622
|
+
this.app[appName].config[folder],
|
|
623
|
+
'indexList',
|
|
624
|
+
[]
|
|
625
|
+
)
|
|
621
626
|
|
|
622
627
|
const instance = this.app[appName].sequelize.define(
|
|
623
628
|
folder,
|
|
@@ -643,6 +648,11 @@ class APP {
|
|
|
643
648
|
}
|
|
644
649
|
},
|
|
645
650
|
},
|
|
651
|
+
...(indexes.length > 0
|
|
652
|
+
? {
|
|
653
|
+
indexes,
|
|
654
|
+
}
|
|
655
|
+
: {}),
|
|
646
656
|
}
|
|
647
657
|
)
|
|
648
658
|
instance.getName = function () {
|
|
@@ -203,6 +203,13 @@ exports.bulkCreateList = {
|
|
|
203
203
|
defaultValue: [],
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
+
exports.indexList = {
|
|
207
|
+
type: Sequelize.JSON,
|
|
208
|
+
comment: '索引',
|
|
209
|
+
allowNull: false,
|
|
210
|
+
defaultValue: [],
|
|
211
|
+
}
|
|
212
|
+
|
|
206
213
|
exports.alias = {
|
|
207
214
|
type: Sequelize.VIRTUAL,
|
|
208
215
|
comment: 'alias',
|
|
@@ -107,6 +107,7 @@ exports.loadModel = async ({ app, appName }) => {
|
|
|
107
107
|
editInline: config.editInline,
|
|
108
108
|
deleteCheckList: config.deleteCheckList,
|
|
109
109
|
bulkCreateList: config.bulkCreateList,
|
|
110
|
+
indexList: config.indexList,
|
|
110
111
|
list: attributes.map((attr, index) => {
|
|
111
112
|
const name = attr.match(/exports.(.*)=/)[1].trim()
|
|
112
113
|
let defaultValue = ''
|
|
@@ -231,6 +231,8 @@ exports.showTables = async (ctx) => {
|
|
|
231
231
|
deleteCheckList: lodash.get(target, 'deleteCheckList', []),
|
|
232
232
|
// 批量更新字段
|
|
233
233
|
bulkCreateList: lodash.get(target, 'bulkCreateList', []),
|
|
234
|
+
// 索引
|
|
235
|
+
indexList: lodash.get(target, 'indexList', []),
|
|
234
236
|
|
|
235
237
|
fn: app.controller[_model] ? Object.keys(app.controller[_model]) : [],
|
|
236
238
|
}
|