fix: add collections after update hook

This commit is contained in:
chenos 2020-12-21 09:34:34 +08:00
parent d408cd4c1f
commit 71024dbaa0
2 changed files with 12 additions and 2 deletions

View File

@ -0,0 +1,8 @@
import CollectionModel from '../models/collection';
export default async function (model: CollectionModel, options: any = {}) {
const { migrate = true } = options;
if (migrate) {
await model.migrate(options);
}
}

View File

@ -1,16 +1,18 @@
import collectionsBeforeValidate from './collections-before-validate';
import collectionsAfterCreate from './collections-after-create';
import collectionsAfterUpdate from './collections-after-update';
import fieldsBeforeValidate from './fields-before-validate';
import fieldsAfterCreate from './fields-after-create';
import generateName from './generateName';
import fieldsAfterBulkUpdate from './fields-after-bulk-update';
import generateName from './generateName';
export default {
collections: {
beforeValidate: collectionsBeforeValidate,
afterCreate: collectionsAfterCreate,
afterUpdate: collectionsAfterCreate,
afterUpdate: collectionsAfterUpdate,
},
fields: {
beforeValidate: fieldsBeforeValidate,