Mercurial > gemma
diff pkg/controllers/importqueue.go @ 1995:59055c8301df
Move import queue to its own database namespace
Authorisation of the import queue has to be handled differently
from the waterway-related data in the waterway schema. This is
easier to handle, if both are in their own schema/namespace.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 24 Jan 2019 12:56:31 +0100 |
parents | cdc8933949f2 |
children | 20d9b71f4125 |
line wrap: on
line diff
--- a/pkg/controllers/importqueue.go Thu Jan 24 12:50:17 2019 +0100 +++ b/pkg/controllers/importqueue.go Thu Jan 24 12:56:31 2019 +0100 @@ -40,30 +40,30 @@ username, signer, summary -FROM waterway.imports +FROM import.imports ` selectHasImportSQL = ` -SELECT true FROM Waterway.imports WHERE id = $1` +SELECT true FROM import.imports WHERE id = $1` selectHasNoRunningImportSQL = ` -SELECT true FROM waterway.imports -WHERE id = $1 AND state <> 'running'::waterway.import_state` +SELECT true FROM import.imports +WHERE id = $1 AND state <> 'running'::import_state` selectImportLogsSQL = ` SELECT time, kind::varchar, msg -FROM waterway.import_logs +FROM import.import_logs WHERE import_id = $1 ORDER BY time` deleteLogsSQL = ` -DELETE FROM waterway.import_logs WHERE import_id = $1` +DELETE FROM import.import_logs WHERE import_id = $1` deleteImportSQL = ` -DELETE FROM waterway.imports WHERE id = $1` +DELETE FROM import.imports WHERE id = $1` ) func toInt8Array(txt string) *pgtype.Int8Array { @@ -347,23 +347,23 @@ const ( isPendingSQL = ` -SELECT state = 'pending'::waterway.import_state, kind -FROM waterway.imports +SELECT state = 'pending'::import_state, kind +FROM import.imports WHERE id = $1` reviewSQL = ` -UPDATE waterway.imports SET - state = $1::waterway.import_state, +UPDATE import.imports SET + state = $1::import_state, signer = $2 WHERE id = $3` - deleteImportDataSQL = `SELECT waterway.del_import($1)` + deleteImportDataSQL = `SELECT import.del_import($1)` deleteImportTrackSQL = ` -DELETE FROM waterway.track_imports WHERE import_id = $1` +DELETE FROM import.track_imports WHERE import_id = $1` logDecisionSQL = ` -INSERT INTO waterway.import_logs (import_id, msg) VALUES ($1, $2)` +INSERT INTO import.import_logs (import_id, msg) VALUES ($1, $2)` ) func reviewImports(