修改表唯一约束

This commit is contained in:
whyour
2022-01-27 00:49:44 +08:00
parent a3a62f65dd
commit 891619ad55
7 changed files with 23 additions and 15 deletions
-6
View File
@@ -31,12 +31,6 @@ export default class CronService {
}
public async insert(payload: Crontab): Promise<Crontab> {
const cron = await CrontabModel.findOne({
where: { command: payload.command },
});
if (cron) {
return cron;
}
return await CrontabModel.create(payload, { returning: true });
}