Mercurial > gemma
comparison 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 |
comparison
equal
deleted
inserted
replaced
1994:a7c4005b723f | 1995:59055c8301df |
---|---|
38 enqueued, | 38 enqueued, |
39 kind, | 39 kind, |
40 username, | 40 username, |
41 signer, | 41 signer, |
42 summary | 42 summary |
43 FROM waterway.imports | 43 FROM import.imports |
44 ` | 44 ` |
45 | 45 |
46 selectHasImportSQL = ` | 46 selectHasImportSQL = ` |
47 SELECT true FROM Waterway.imports WHERE id = $1` | 47 SELECT true FROM import.imports WHERE id = $1` |
48 | 48 |
49 selectHasNoRunningImportSQL = ` | 49 selectHasNoRunningImportSQL = ` |
50 SELECT true FROM waterway.imports | 50 SELECT true FROM import.imports |
51 WHERE id = $1 AND state <> 'running'::waterway.import_state` | 51 WHERE id = $1 AND state <> 'running'::import_state` |
52 | 52 |
53 selectImportLogsSQL = ` | 53 selectImportLogsSQL = ` |
54 SELECT | 54 SELECT |
55 time, | 55 time, |
56 kind::varchar, | 56 kind::varchar, |
57 msg | 57 msg |
58 FROM waterway.import_logs | 58 FROM import.import_logs |
59 WHERE import_id = $1 | 59 WHERE import_id = $1 |
60 ORDER BY time` | 60 ORDER BY time` |
61 | 61 |
62 deleteLogsSQL = ` | 62 deleteLogsSQL = ` |
63 DELETE FROM waterway.import_logs WHERE import_id = $1` | 63 DELETE FROM import.import_logs WHERE import_id = $1` |
64 | 64 |
65 deleteImportSQL = ` | 65 deleteImportSQL = ` |
66 DELETE FROM waterway.imports WHERE id = $1` | 66 DELETE FROM import.imports WHERE id = $1` |
67 ) | 67 ) |
68 | 68 |
69 func toInt8Array(txt string) *pgtype.Int8Array { | 69 func toInt8Array(txt string) *pgtype.Int8Array { |
70 parts := strings.Split(txt, ",") | 70 parts := strings.Split(txt, ",") |
71 var ints []int64 | 71 var ints []int64 |
345 return | 345 return |
346 } | 346 } |
347 | 347 |
348 const ( | 348 const ( |
349 isPendingSQL = ` | 349 isPendingSQL = ` |
350 SELECT state = 'pending'::waterway.import_state, kind | 350 SELECT state = 'pending'::import_state, kind |
351 FROM waterway.imports | 351 FROM import.imports |
352 WHERE id = $1` | 352 WHERE id = $1` |
353 | 353 |
354 reviewSQL = ` | 354 reviewSQL = ` |
355 UPDATE waterway.imports SET | 355 UPDATE import.imports SET |
356 state = $1::waterway.import_state, | 356 state = $1::import_state, |
357 signer = $2 | 357 signer = $2 |
358 WHERE id = $3` | 358 WHERE id = $3` |
359 | 359 |
360 deleteImportDataSQL = `SELECT waterway.del_import($1)` | 360 deleteImportDataSQL = `SELECT import.del_import($1)` |
361 | 361 |
362 deleteImportTrackSQL = ` | 362 deleteImportTrackSQL = ` |
363 DELETE FROM waterway.track_imports WHERE import_id = $1` | 363 DELETE FROM import.track_imports WHERE import_id = $1` |
364 | 364 |
365 logDecisionSQL = ` | 365 logDecisionSQL = ` |
366 INSERT INTO waterway.import_logs (import_id, msg) VALUES ($1, $2)` | 366 INSERT INTO import.import_logs (import_id, msg) VALUES ($1, $2)` |
367 ) | 367 ) |
368 | 368 |
369 func reviewImports( | 369 func reviewImports( |
370 reviews interface{}, | 370 reviews interface{}, |
371 req *http.Request, | 371 req *http.Request, |