mirror of
https://github.com/whyour/qinglong.git
synced 2025-06-01 06:26:08 +08:00
初始化更新不存在filterRelation的任务视图
This commit is contained in:
parent
e868e65208
commit
707709837d
|
@ -8,12 +8,24 @@ import groupBy from 'lodash/groupBy';
|
||||||
import { DependenceModel } from '../data/dependence';
|
import { DependenceModel } from '../data/dependence';
|
||||||
import { Op } from 'sequelize';
|
import { Op } from 'sequelize';
|
||||||
import config from '../config';
|
import config from '../config';
|
||||||
|
import { CrontabViewModel } from '../data/cronView';
|
||||||
|
|
||||||
export default async () => {
|
export default async () => {
|
||||||
const cronService = Container.get(CronService);
|
const cronService = Container.get(CronService);
|
||||||
const envService = Container.get(EnvService);
|
const envService = Container.get(EnvService);
|
||||||
const dependenceService = Container.get(DependenceService);
|
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(
|
await CrontabModel.update(
|
||||||
{ status: CrontabStatus.idle },
|
{ status: CrontabStatus.idle },
|
||||||
|
|
Loading…
Reference in New Issue
Block a user