changeset 2053:c06a2e5397fc unify_imports

Scheduler: Adjusted booting of scheduled imports to new database schema.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sun, 27 Jan 2019 23:19:30 +0100
parents 0b203a3b3e8e
children b03e487117df
files pkg/scheduler/boot.go
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/scheduler/boot.go	Sun Jan 27 23:09:42 2019 +0100
+++ b/pkg/scheduler/boot.go	Sun Jan 27 23:19:30 2019 +0100
@@ -26,13 +26,18 @@
 	bootRole = "sys_admin"
 
 	selectImportConfSQL = `
-SELECT id, username, cron
-FROM import.import_configuration
-WHERE cron IS NOT NULL`
+SELECT c.id, username, a.v
+FROM import.import_configuration c
+JOIN import.import_configuration_attributes a
+ON c.id = a.import.import_configuration_id
+WHERE
+  c.id IN (SELECT import_configuration_id WHERE k = 'cron')`
 
 	scheduledIDsSQL = `
 SELECT id from import.import_configuration
-WHERE username = $1 AND cron IS NOT NULL`
+WHERE
+  username = $1
+  AND id IN (SELECT import_configuration_id WHERE k = 'cron')`
 )
 
 func init() { go boot() }