From 734cc94048d7d03d0ae054560f70cb8cac7d3ed2 Mon Sep 17 00:00:00 2001 From: whyour Date: Mon, 14 Nov 2022 22:59:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9filterRelation=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/data/cronView.ts | 6 +++++- back/loaders/initData.ts | 11 ----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/back/data/cronView.ts b/back/data/cronView.ts index 3dfd055d..7f1d6fe2 100644 --- a/back/data/cronView.ts +++ b/back/data/cronView.ts @@ -46,6 +46,10 @@ export const CrontabViewModel = sequelize.define( isDisabled: DataTypes.NUMBER, filters: DataTypes.JSON, sorts: DataTypes.JSON, - filterRelation: { type: DataTypes.STRING, defaultValue: 'and' }, + filterRelation: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: 'and', + }, }, ); diff --git a/back/loaders/initData.ts b/back/loaders/initData.ts index 15b291ee..7571a787 100644 --- a/back/loaders/initData.ts +++ b/back/loaders/initData.ts @@ -15,17 +15,6 @@ export default async () => { const envService = Container.get(EnvService); const dependenceService = Container.get(DependenceService); - // 更新所有不存在filterRelation的任务视图 - const views = await CrontabViewModel.findAll({ where: {}, raw: true }); - for (const view of views) { - if (!view.filterRelation) { - await CrontabViewModel.update( - { filterRelation: 'and' }, - { where: { id: view.id } }, - ); - } - } - // 初始化更新所有任务状态为空闲 await CrontabModel.update( { status: CrontabStatus.idle },