Skip to content
Snippets Groups Projects
Commit 72e5c214 authored by Audrey Hamelers's avatar Audrey Hamelers
Browse files

change to jobs seed - only seed new jobs

parent 0bd0c55c
No related branches found
No related tags found
3 merge requests!380Pipeline changes,!379Build step added for the master branch,!378k8s release
exports.seed = async (knex, Promise) => {
await knex('config.job').del()
const midnight = new Date()
midnight.setHours(0, 0, 0, 0)
await knex('config.job').insert([
const seeds = [
{
name: 'tagging-alert',
running: false,
......@@ -110,5 +109,16 @@ exports.seed = async (knex, Promise) => {
frequency: '0 5 * * 0,3',
description: 'Updates the local NLM Catalog-based journal list',
},
])
]
// Inserts seed entries if name not already in database
seeds.reduce(async (promise, seed) => {
await promise
const rows = await knex('config.job')
.select()
.where('name', seed.name)
if (rows.length === 0) return knex('config.job').insert(seed)
return Promise.resolve()
}, Promise.resolve())
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment