From 707709837d0dfdf36a6377bd8635ab765fae6490 Mon Sep 17 00:00:00 2001 From: whyour Date: Mon, 14 Nov 2022 21:36:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E4=B8=8D=E5=AD=98=E5=9C=A8filterRelation=E7=9A=84=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E8=A7=86=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/loaders/initData.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/back/loaders/initData.ts b/back/loaders/initData.ts index a3973884..15b291ee 100644 --- a/back/loaders/initData.ts +++ b/back/loaders/initData.ts @@ -8,12 +8,24 @@ import groupBy from 'lodash/groupBy'; import { DependenceModel } from '../data/dependence'; import { Op } from 'sequelize'; import config from '../config'; +import { CrontabViewModel } from '../data/cronView'; export default async () => { const cronService = Container.get(CronService); 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 },