Mercurial > gemma
diff pkg/imports/st.go @ 4389:5e38667f740c stretches-for-responsibility
Use stretches as areas of responsibility.
This is heavily based on a patch by Tom Gottfried
(read: >90% of the work was done by Tom).
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Thu, 12 Sep 2019 18:13:47 +0200 |
parents | f9bb06f2dbe3 |
children | aeb2aedd3abd |
line wrap: on
line diff
--- a/pkg/imports/st.go Wed Sep 11 10:32:19 2019 +0200 +++ b/pkg/imports/st.go Thu Sep 12 18:13:47 2019 +0200 @@ -57,23 +57,23 @@ const ( stDeleteSQL = ` -DELETE FROM waterway.stretches WHERE +DELETE FROM users.stretches WHERE staging_done AND name = ( SELECT name - FROM waterway.stretches WHERE + FROM users.stretches WHERE id = ( SELECT key from import.track_imports WHERE import_id = $1 AND - relation = 'waterway.stretches'::regclass) + relation = 'users.stretches'::regclass) AND NOT staging_done )` stStageDoneSQL = ` -UPDATE waterway.stretches SET staging_done = true +UPDATE users.stretches SET staging_done = true WHERE id IN ( SELECT key from import.track_imports WHERE import_id = $1 AND - relation = 'waterway.stretches'::regclass)` + relation = 'users.stretches'::regclass)` stInsertSQL = ` WITH @@ -94,7 +94,7 @@ (SELECT b FROM bounds ORDER BY b USING >~ FETCH FIRST ROW ONLY)) AS r), axs AS ( SELECT ISRSrange_axis((SELECT r FROM r), $16::double precision) AS axs) -INSERT INTO waterway.stretches ( +INSERT INTO users.stretches ( name, stretch, area, @@ -116,9 +116,9 @@ RETURNING id` stInsertCountrySQL = ` -INSERT INTO waterway.stretch_countries ( - stretches_id, - country_code +INSERT INTO users.stretch_countries ( + stretch_id, + country ) VALUES ( $1, $2 @@ -214,7 +214,7 @@ } } - if err := track(ctx, tx, importID, "waterway.stretches", id); err != nil { + if err := track(ctx, tx, importID, "users.stretches", id); err != nil { return nil, err }